Module: RedminePluginsHelper::Migration::Code::ClassMethods
- Defined in:
- lib/redmine_plugins_helper/migration/code.rb
Instance Method Summary collapse
- #from_code ⇒ Enumerable<RedminePluginsHelper::Migration>
- #from_core_code ⇒ Enumerable<RedminePluginsHelper::Migration>
- #from_path_code(path) ⇒ Enumerable<RedminePluginsHelper::Migration>
- #from_plugins_code ⇒ Enumerable<RedminePluginsHelper::Migration>
Instance Method Details
#from_code ⇒ Enumerable<RedminePluginsHelper::Migration>
10 11 12 |
# File 'lib/redmine_plugins_helper/migration/code.rb', line 10 def from_code from_core_code + from_plugins_code end |
#from_core_code ⇒ Enumerable<RedminePluginsHelper::Migration>
15 16 17 18 19 |
# File 'lib/redmine_plugins_helper/migration/code.rb', line 15 def from_core_code ::Rails.application.paths['db/migrate'].flat_map do |path| from_path_code(path) end end |
#from_path_code(path) ⇒ Enumerable<RedminePluginsHelper::Migration>
22 23 24 25 |
# File 'lib/redmine_plugins_helper/migration/code.rb', line 22 def from_path_code(path) ::Dir["#{path}/*.rb"].map { |p| File.basename(p).match(/0*(\d+)_/)[1].to_i }.sort .map { |version| new(PLUGIN_ID_CORE_VALUE, version) } end |
#from_plugins_code ⇒ Enumerable<RedminePluginsHelper::Migration>
28 29 30 31 32 |
# File 'lib/redmine_plugins_helper/migration/code.rb', line 28 def from_plugins_code ::Redmine::Plugin.registered_plugins.values.flat_map do |plugin| plugin.migrations.map { |version| new(plugin.id, version) } end end |