You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- require "rake"
-
-
- module RakeTaskHelper
- # Railsの rake task を一度だけロードする
- def load_rails_tasks!
- return if defined?(@rails_tasks_loaded) && @rails_tasks_loaded
- @rails_tasks_loaded = true
-
- Rake.application = Rake::Application.new
- Rails.application.load_tasks
- end
-
- def run_rake_task(full_name)
- load_rails_tasks!
-
- task = Rake::Task[full_name] # ここは rake[...] じゃなくて良い
- task.reenable
- task.invoke
- end
- end
|