Skip to content

Instantly share code, notes, and snippets.

View monkseal's full-sized avatar

Kevin English monkseal

  • Kenglish.co - Ruby, React.js, Javascript Developer
  • South Lake Tahoe/San Diego/Honolulu
View GitHub Profile
@monkseal
monkseal / commit-msg
Last active August 29, 2015 14:20
Simple 'commit-msg' hook to reject commits that don't contain the issue number
#!/bin/sh
#
# This example tests that the commit message contains DS, exit 1 will fail the commit.
test "" != "$(grep '\[DS-[0-9]\+\]' "$1")" || {
echo >&2 "ERROR: Commit message is missing Jira issue number."
exit 1
}
#!/bin/sh
echo "Running pre-commit hook, to run with out do 'git commit -n'"
bin/rake ci:rubocop_changed
@monkseal
monkseal / .rubocop.yml
Created April 22, 2015 15:42
My standard .rubocop.yml
inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- db/schema.rb
- db/migrate/*
- bin/*
RunRailsCops: true
Documentation:
namespace :ci do
require 'rubocop/rake_task'
def changed_files
cmd = %q( git diff --name-only --diff-filter=ACMRTUXB \
$(git merge-base HEAD master) \
| egrep '\.rake$|\.rb$' )
diff = `#{cmd}`
diff.split("\n")
@monkseal
monkseal / ws_strip.rb
Created June 30, 2014 16:59
Ruby/Rails Whitespace Stripper
#!/usr/bin/env ruby
# Original Author, Dan Kubb (https://github.com/dkubb)
# Modified by Kevin English (https://github.com/monkseal)
# encoding: utf-8
require 'pathname'
# files and extensions to process
FILES = %w[ capfile Capfile Gemfile Gemfile.lock Guardfile CHANGELOG LICENSE Manifest README README.rdoc README_FOR_APP RUBY-STYLE RUNNING_UNIT_TESTS Rakefile RUBY-STYLE SPECS TODO USAGE .autotest .gitignore .htaccess .rspec .rcov .rvmrc Vagrantfile .yardopts ].freeze