Commit 270d334b44a9dfe28fb745264987ea1a7032f36b
1 parent
7db6046a
Exists in
master
and in
22 other branches
Add plugins migrations paths
Showing
2 changed files
with
1 additions
and
13 deletions
Show diff stats
config/application.rb
@@ -118,6 +118,7 @@ module Noosfero | @@ -118,6 +118,7 @@ module Noosfero | ||
118 | config.time_zone = File.read('/etc/timezone').split("\n").first | 118 | config.time_zone = File.read('/etc/timezone').split("\n").first |
119 | config.active_record.default_timezone = :local | 119 | config.active_record.default_timezone = :local |
120 | 120 | ||
121 | + config.paths['db/migrate'] += Dir.glob "#{Rails.root}/{baseplugins,config/plugins/*}/db/migrate" | ||
121 | config.i18n.load_path += Dir.glob "#{Rails.root}/{baseplugins,config/plugins/*}/locales/*.{rb,yml}" | 122 | config.i18n.load_path += Dir.glob "#{Rails.root}/{baseplugins,config/plugins/*}/locales/*.{rb,yml}" |
122 | 123 | ||
123 | Noosfero::Plugin.setup(config) | 124 | Noosfero::Plugin.setup(config) |
lib/tasks/plugins.rake
@@ -6,17 +6,6 @@ namespace :noosfero do | @@ -6,17 +6,6 @@ namespace :noosfero do | ||
6 | 6 | ||
7 | plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate')) | 7 | plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate')) |
8 | 8 | ||
9 | - task :load_config do | ||
10 | - dirs = Dir.glob("{baseplugins,config/plugins}/*").uniq do |dir| | ||
11 | - File.basename(dir) | ||
12 | - end.map do |dir| | ||
13 | - File.join(dir, 'db/migrate') | ||
14 | - end | ||
15 | - dirs.each do |dir| | ||
16 | - ActiveRecord::Migrator.migrations_paths << dir | ||
17 | - end | ||
18 | - end | ||
19 | - | ||
20 | task :migrate do | 9 | task :migrate do |
21 | plugin_migration_dirs.each do |path| | 10 | plugin_migration_dirs.each do |path| |
22 | ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? | 11 | ActiveRecord::Migrator.migrate(path, ENV["VERSION"] ? |
@@ -26,5 +15,3 @@ namespace :noosfero do | @@ -26,5 +15,3 @@ namespace :noosfero do | ||
26 | end | 15 | end |
27 | end | 16 | end |
28 | 17 | ||
29 | -task 'db:migrate' => 'noosfero:plugins:load_config' | ||
30 | -task 'db:schema:load' => 'noosfero:plugins:load_config' |