This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :code do | |
task :trailing_spaces do | |
grep "app", "spec" | |
end | |
def grep *file_patterns | |
files_found = "" | |
file_patterns.each do |file_pattern| | |
files_found << `grep -r -E '^.*[[:space:]]+$' --include '*.rb' #{file_pattern}` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#-*-ruby-*- | |
# A script to run ctags on all .rb files in a project. Can be run on | |
# the current dir, called from a git callback, or install itself as a | |
# git post-merge and post-commit callback. | |
CTAGS = '/usr/local/bin/ctags' | |
HOOKS = %w{ post-merge post-commit post-checkout } | |
HOOKS_DIR = '.git/hooks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'spec' | |
class Foo | |
def self.foo | |
Bar.bar | |
rescue StandardError | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want to check that something's true or false in the normal ruby sense | |
# (ie anything other than false or nil is true), you can use double negation | |
# to force it into an actual boolean (eg !!foo.should be_true). To keep this | |
# ugliness out of your tests, stick these matchers in your spec helper: | |
def be_truish | |
return simple_matcher do |obj, matcher| | |
matcher.description = 'be true(ish)' | |
matcher.failure_message = "Expected #{obj.inspect} to be true(ish)" | |
matcher.negative_failure_message = "Expected #{obj.inspect} not to be true(ish)" |
NewerOlder