Created
January 27, 2011 04:58
-
-
Save rohitarondekar/798094 to your computer and use it in GitHub Desktop.
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
your_rails_app/script/runner | |
====== | |
#!/usr/bin/env ruby | |
path_to_rails = File.dirname(File.expand_path(__FILE__)) | |
exec("#{path_to_rails}/rails runner #{ARGV[0]}") | |
====== | |
You can just drop it in your_rails_app/script/runner — chmod +x the file and use it in place of rails runner. The main advantage of using this is that you can use it in your script files using a shebang: | |
====== | |
#!/usr/bin/env /home/rohit/code/runmeapp/script/runner | |
Product.find(:all).each { |p| p.price *= 2 ; p.save! } | |
====== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment