code_junkie

RoR environment in Ruby standalone script

Nov 12th, 2011
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. #!/path/to/your/rails/script/runner
  4.  
  5. require "#{ENV['RAILS_ROOT']}/config/environment.rb"
  6.  
  7. # lib/tasks/mystuff.rake
  8. desc 'do my stuff'
  9. task :my_stuff => [:environment] do
  10. # do my stuff
  11. end
Add Comment
Please, Sign In to add comment