Created
July 9, 2010 12:41
-
-
Save alloy/469413 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Rails example | |
recipe :ignore | |
ignore(/(^tmp|jpg|png|gif|css|\.DS_Store)$/) | |
recipe :rails | |
process do |files| | |
Ruby.run_tests(files.take_and_map do |file| | |
case file | |
when %r{^app/views/mailer} | |
"test/unit/mailer_test.rb" | |
when %r{^test/examples/accounts_quota.yml$} | |
"test/unit/account/quotum_test.rb" | |
end | |
end) | |
end |
This file contains hidden or 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
# Pure Ruby lib example | |
recipe :ignore | |
ignore(/^(html|tmp)/) | |
recipe :ruby | |
class Ruby | |
def self.is_test_file?(path) | |
path if File.exist?(File.expand_path("../#{path}", __FILE__)) | |
end | |
end | |
process do |files| | |
if files.any? { |file| file.start_with?('lib') } | |
log "Updating documentation in the background" | |
system "rake documentation:generate &> /dev/null &" | |
end | |
end | |
process do |files| | |
Ruby.run_tests(files.take_and_map do |file| | |
case file | |
when %r{^lib/(.+)\.rb$} | |
path = $1.gsub('/', '_') | |
[ | |
Ruby.is_test_file?("test/unit/#{path}_test.rb"), | |
Ruby.is_test_file?("test/functional/#{path}_test.rb") | |
].compact | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment