Class: RedminePluginsHelper::Migrations
- Inherits:
-
Object
- Object
- RedminePluginsHelper::Migrations
- Defined in:
- lib/redmine_plugins_helper/migrations.rb
Class Method Summary collapse
- .db_all_versions ⇒ Object
- .db_versions ⇒ Object
- .local_versions ⇒ Object
- .parse_plugin_version(version) ⇒ Object
Class Method Details
.db_all_versions ⇒ Object
29 30 31 32 |
# File 'lib/redmine_plugins_helper/migrations.rb', line 29 def db_all_versions ::ActiveRecord::SchemaMigration.create_table ::ActiveRecord::SchemaMigration.all.pluck(:version) end |
.db_versions ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/redmine_plugins_helper/migrations.rb', line 17 def db_versions r = {} db_all_versions.each do |v| pv = parse_plugin_version(v) next unless pv r[pv[:plugin]] ||= [] r[pv[:plugin]] << pv[:timestamp] end r end |
.local_versions ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/redmine_plugins_helper/migrations.rb', line 6 def local_versions r = {} Redmine::Plugin.registered_plugins.each_value do |p| p.migrations.each do |ts| r[p.id] ||= [] r[p.id] << ts end end r end |
.parse_plugin_version(version) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/redmine_plugins_helper/migrations.rb', line 34 def parse_plugin_version(version) m = version.match(/^(\d+)\-(\S+)$/) return nil unless m { plugin: m[2].to_sym, timestamp: m[1].to_i } end |