Skip to content

Commit cd23900

Browse files
mgpndctran
authored andcommitted
Try "app:" task prefix on migration annotaiton (#596)
Since Rails full engines run as non-namespaced applications but all their app-related tasks still prefixed with `app:`
1 parent dc82727 commit cd23900

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/tasks/annotate_models_migrate.rake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
%w(db:migrate db:migrate:up db:migrate:down db:migrate:reset db:migrate:redo db:rollback).each do |task|
88
Rake::Task[task].enhance do
99
Rake::Task[Rake.application.top_level_tasks.last].enhance do
10-
Rake::Task['set_annotation_options'].invoke
10+
annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
11+
'app:set_annotation_options'
12+
else
13+
'set_annotation_options'
14+
end
15+
Rake::Task[annotation_options_task].invoke
1116
Annotate::Migration.update_annotations
1217
end
1318
end
@@ -37,6 +42,8 @@ module Annotate
3742
def self.update_routes
3843
if Rake::Task.task_defined?("annotate_routes")
3944
Rake::Task["annotate_routes"].invoke
45+
elsif Rake::Task.task_defined?("app:annotate_routes")
46+
Rake::Task["app:annotate_routes"].invoke
4047
end
4148
end
4249
end

0 commit comments

Comments
 (0)