Skip to content

Commit 3c0cead

Browse files
committed
Try app: task prefix on migration annotaiton
Since Rails full engines run as non-namespaced applications but all their app-related tasks still prefixed with app:.
1 parent 92f707e commit 3c0cead

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/tasks/annotate_models_migrate.rake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55
# run after doing db:migrate.
66

77
namespace :db do
8+
annotation_options_task = if Rake::Task.task_defined?('app:set_annotation_options')
9+
'app:set_annotation_options'
10+
else
11+
'set_annotation_options'
12+
end
813
[:migrate, :rollback].each do |cmd|
914
task cmd do
10-
Rake::Task['set_annotation_options'].invoke
15+
Rake::Task[annotation_options_task].invoke
1116
Annotate::Migration.update_annotations
1217
end
1318

1419
namespace cmd do
1520
[:change, :up, :down, :reset, :redo].each do |t|
1621
task t do
17-
Rake::Task['set_annotation_options'].invoke
22+
Rake::Task[annotation_options_task].invoke
1823
Annotate::Migration.update_annotations
1924
end
2025
end
@@ -46,6 +51,8 @@ module Annotate
4651
def self.update_routes
4752
if Rake::Task.task_defined?("annotate_routes")
4853
Rake::Task["annotate_routes"].invoke
54+
elsif Rake::Task.task_defined?("app:annotate_routes")
55+
Rake::Task["app:annotate_routes"].invoke
4956
end
5057
end
5158
end

0 commit comments

Comments
 (0)