Skip to content

Commit

Permalink
Try "app:" task prefix on migration annotaiton (#596)
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 authored and ctran committed Feb 15, 2019
1 parent dc82727 commit cd23900
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/tasks/annotate_models_migrate.rake
Expand Up @@ -7,7 +7,12 @@
%w(db:migrate db:migrate:up db:migrate:down db:migrate:reset db:migrate:redo db:rollback).each do |task|
Rake::Task[task].enhance do
Rake::Task[Rake.application.top_level_tasks.last].enhance do
Rake::Task['set_annotation_options'].invoke
annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
'app:set_annotation_options'
else
'set_annotation_options'
end
Rake::Task[annotation_options_task].invoke
Annotate::Migration.update_annotations
end
end
Expand Down Expand Up @@ -37,6 +42,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 cd23900

Please sign in to comment.