redmine_plugins_helper 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaaaeded613ef8e1008c1132a077516083ccb224dd6c3e14762ec6b9ce57cd4f
|
4
|
+
data.tar.gz: d554fd7dd558929f38e0c8c57b5bdfdcbc2e12dc903610b2477e30fe6e6b9e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbed1ae45933b914612c964b232e8bd3ad15a5514b60fca9e2030ba9531e11fa9fa0dbe53acadaa7f8a3c005d1c723bf401f5167227da0af4e979c89379418ec
|
7
|
+
data.tar.gz: 41b1c4b5899809adb2c2270ec6ff2f1c147197b9d3e278d9745997cfc837aed2b116765b2395229ffa615ed66f23751aae8d8e956cd417d660099042be286943
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
3
5
|
module RedminePluginsHelper
|
4
6
|
class Migrate
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(plugin_name, migration_version)
|
8
|
-
@plugin_name = plugin_name
|
9
|
-
@migration_version = migration_version
|
7
|
+
common_constructor :plugin_name, :migration_version do
|
10
8
|
run
|
11
9
|
end
|
12
10
|
|
@@ -21,41 +19,21 @@ module RedminePluginsHelper
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def run_all
|
24
|
-
versions_sorted.each
|
25
|
-
migrate_plugin_version(v)
|
26
|
-
end
|
22
|
+
versions_sorted.each(&:apply)
|
27
23
|
end
|
28
24
|
|
29
25
|
def run_version
|
30
26
|
::Redmine::Plugin.migrate(plugin_name, migration_version)
|
31
27
|
end
|
32
28
|
|
33
|
-
|
34
|
-
return if migrated?(version)
|
35
|
-
|
36
|
-
::Redmine::Plugin.registered_plugins[version[:plugin]].migrate(version[:timestamp])
|
37
|
-
end
|
38
|
-
|
29
|
+
# @return [Enumerable<RedminePluginsHelper::Migration>]
|
39
30
|
def versions_sorted
|
40
|
-
versions.
|
31
|
+
versions.sort
|
41
32
|
end
|
42
33
|
|
34
|
+
# @return [Enumerable<RedminePluginsHelper::Migration>]
|
43
35
|
def versions
|
44
|
-
|
45
|
-
::RedminePluginsHelper::Migrations.local_versions.each do |plugin, ts|
|
46
|
-
ts.each { |t| r << { plugin: plugin, timestamp: t } }
|
47
|
-
end
|
48
|
-
r
|
49
|
-
end
|
50
|
-
|
51
|
-
def migrated?(version)
|
52
|
-
return false unless db_versions.key?(version[:plugin])
|
53
|
-
|
54
|
-
db_versions[version[:plugin]].include?(version[:timestamp])
|
55
|
-
end
|
56
|
-
|
57
|
-
def db_versions
|
58
|
-
@db_versions ||= ::RedminePluginsHelper::Migrations.db_versions
|
36
|
+
::RedminePluginsHelper::Migration.from_code.select(&:plugin?)
|
59
37
|
end
|
60
38
|
end
|
61
39
|
end
|
@@ -10,6 +10,19 @@ module RedminePluginsHelper
|
|
10
10
|
self.plugin_id = plugin_id.to_sym
|
11
11
|
self.version = version.to_i
|
12
12
|
end
|
13
|
+
compare_by :version, :plugin_id
|
14
|
+
|
15
|
+
# @return [void]
|
16
|
+
def apply
|
17
|
+
return if applied?
|
18
|
+
|
19
|
+
nyi unless plugin?
|
20
|
+
|
21
|
+
::Redmine::Plugin::Migrator.current_plugin = plugin
|
22
|
+
::Redmine::Plugin::MigrationContext.new(plugin.migration_directory).up do |m|
|
23
|
+
m.version == version
|
24
|
+
end
|
25
|
+
end
|
13
26
|
|
14
27
|
# @return [Boolean]
|
15
28
|
def applied?
|
@@ -27,6 +40,11 @@ module RedminePluginsHelper
|
|
27
40
|
plugin_id == PLUGIN_ID_CORE_VALUE
|
28
41
|
end
|
29
42
|
|
43
|
+
# @return [Redmine::Plugin]
|
44
|
+
def plugin
|
45
|
+
plugin? ? ::Redmine::Plugin.find(plugin_id) : nil
|
46
|
+
end
|
47
|
+
|
30
48
|
# @return [Boolean]
|
31
49
|
def plugin?
|
32
50
|
!core?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_plugins_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- 0.13.
|
7
|
+
- 0.13.1
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|