Skip to content

Commit

Permalink
Try 'app:' task prefix on migration annotaiton
Browse files Browse the repository at this point in the history
Since Rails full engines run as non-namespaced applications
but all their app-related tasks still prefixed with app:.
  • Loading branch information
mgpnd committed Feb 15, 2019
1 parent 89bce57 commit 81bbbd9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/tasks/annotate_models_migrate.rake
Expand Up @@ -5,16 +5,21 @@
# run after doing db:migrate.

namespace :db do
annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
'app:set_annotation_options'
else
'set_annotation_options'
end
[:migrate, :rollback].each do |cmd|
task cmd do
Rake::Task['set_annotation_options'].invoke
Rake::Task[annotation_options_task].invoke
Annotate::Migration.update_annotations
end

namespace cmd do
[:change, :up, :down, :reset, :redo].each do |t|
task t do
Rake::Task['set_annotation_options'].invoke
Rake::Task[annotation_options_task].invoke
Annotate::Migration.update_annotations
end
end
Expand Down Expand Up @@ -46,6 +51,8 @@ module Annotate
def self.update_routes
if Rake::Task.task_defined?("annotate_routes")
Rake::Task["annotate_routes"].invoke
elsif Rake::Task.task_defined?("app:annotate_routes")
Rake::Task["app:annotate_routes"].invoke
end
end
end
Expand Down

0 comments on commit 81bbbd9

Please sign in to comment.