dotfiles/misc/method_missing.rb

23 lines
465 B
Ruby
Raw Permalink Normal View History

2009-09-27 10:46:37 +10:00
#!/usr/bin/env ruby
command = ARGV.shift
2009-10-19 15:25:35 +11:00
def run(cmd)
puts "Running #{cmd.inspect} instead"
exec(cmd)
2009-10-19 15:25:35 +11:00
end
2009-09-27 10:46:37 +10:00
case command
when /^git(@|:\/\/).*\.git$/
2009-10-19 15:25:35 +11:00
run("git clone #{command.inspect}")
2009-09-27 10:46:37 +10:00
when /^(?:ftp|https?):\/\/.+\.t(?:ar\.)?gz$/
2009-10-19 15:25:35 +11:00
run("curl #{command.inspect} | tar xzv")
when /^[a-z0-9_\-\/]+\.feature$/
run("cucumber #{command}")
when /(.+)\.gem$/
run("gem install #{$1}")
2009-09-27 10:46:37 +10:00
else
2011-10-24 14:48:33 +11:00
# $stderr.puts "No default action defined in #{__FILE__}"
2009-10-19 15:25:35 +11:00
abort
2010-11-22 23:29:23 +11:00
end