Load rake files and run tasks from other files
You can either put your tasks into rakelib/ folder which rake loads by default or add a specific folder in your Rakefile via: Rake.add_rakelib ‘lib/tasks’
You can either put your tasks into rakelib/ folder which rake loads by default or add a specific folder in your Rakefile via: Rake.add_rakelib ‘lib/tasks’
If you start your rake task with task :testclass => :environment do, your Rails environment will be loaded and available for the task.
Something like this might work task :action do STDOUT.puts “I’m acting!” end task :check do STDOUT.puts “Are you sure? (y/n)” input = STDIN.gets.strip if input == ‘y’ Rake::Task[“action”].reenable Rake::Task[“action”].invoke else STDOUT.puts “So sorry for the confusion” end end Task reenabling and invoking from How to run Rake tasks from within Rake tasks?