redmine_plugins_helper 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 582af479fe7463ed0c0026e7cb0b491afbfc68abc2b8b87bf5578d36de44971d
4
- data.tar.gz: 12108993e80cc9f4f928fc805ad019ba082e39ff9a387f82d38686530a94611c
3
+ metadata.gz: ec7d061ed708bee800763185f37b128278339d01c1fdf9e79b810febd1a5e217
4
+ data.tar.gz: b42d886ec6e728964045da306639dd340aefdf5d9f3313ae61b0339e40d3e8db
5
5
  SHA512:
6
- metadata.gz: e44cc83605132efef7cff93eb95d68355a256e7014984d32ba83bf727e788f4f44c9fa64ee8a3a6d8ced3b4a9225ad7a8ec73f10dee49941776b7461b58e68c9
7
- data.tar.gz: 903bb9e6af7bc0131396a14c80365c574f794a407d9ca99a48ab6b27bed44676be2863ba7f8f8db766278f679161de2c7a3e3630e84255b18e871ce20024921b
6
+ metadata.gz: 3e06fabcb8dffcf25177040f37a367068bdd246ff591c8cb11b0dcbfa4473932856500cdd8a28527b8d7ed23f839d28b5d52677bc82aba2697a36ee1fdf62423
7
+ data.tar.gz: 2753b527bba4cc48d655add0b7a5cab05d833e2f3c9fb04ab698129d81598421744d02aed88d0336e810b40a4a37cd3eeee2ace806e7eab31520c41308e477fa
@@ -5,8 +5,8 @@ module RedminePluginsHelper
5
5
  class AfterPluginsLoaded < Redmine::Hook::Listener
6
6
  def after_plugins_loaded(_context = {})
7
7
  require 'redmine_plugins_helper/patches'
8
- Redmine::Plugin.all.sort.each(&:add_assets_paths)
9
- Redmine::Plugin.all.sort.each(&:load_initializers)
8
+ Redmine::Plugin.sorted_by_dependencies.each(&:add_assets_paths)
9
+ Redmine::Plugin.sorted_by_dependencies.each(&:load_initializers)
10
10
  RedminePluginsHelper::PluginsAutoloadAssets.instance.generate
11
11
  end
12
12
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module RedminePluginsHelper
6
4
  class Migrate
7
5
  common_constructor :plugin_name, :migration_version do
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module RedminePluginsHelper
6
4
  module Patches
7
5
  module Redmine
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/yaml'
3
+ require 'tsort'
5
4
 
6
5
  module RedminePluginsHelper
7
6
  module Patches
@@ -12,16 +11,19 @@ module RedminePluginsHelper
12
11
 
13
12
  DEPENDENCIES_FILE_BASENAMES = %w[yml yaml].map { |e| "dependencies.#{e}" }
14
13
 
15
- # @param other [Redmine::Plugin]
16
- # @return [Integer]
17
- def <=>(other)
18
- so = dependency?(other)
19
- os = other.dependency?(self)
20
-
21
- return 1 if so && !os
22
- return -1 if !so && os
14
+ module ClassMethods
15
+ # @return [Array<Redmine::Plugin>]
16
+ def sorted_by_dependencies
17
+ ::TSort.tsort(
18
+ all.method(:each),
19
+ ->(plugin, &block) { plugin.dependencies.each(&block) }
20
+ )
21
+ end
22
+ end
23
23
 
24
- super
24
+ # @return [Array<Redmine::Plugin>]
25
+ def dependencies
26
+ dependencies_ids.map { |plugin_id| ::Redmine::Plugin.find(plugin_id) }
25
27
  end
26
28
 
27
29
  # @return [Array<Symbol>]
@@ -30,13 +32,6 @@ module RedminePluginsHelper
30
32
  dependencies_hash.keys
31
33
  end
32
34
 
33
- # @param other [Redmine::Plugin]
34
- # @return [Boolean]
35
- def dependency?(other)
36
- load_dependencies_from_file
37
- recursive_dependencies_ids.include?(other.id)
38
- end
39
-
40
35
  # @param plugin_name [Symbol]
41
36
  # @param arg [Hash, String]
42
37
  # @return [Boolean]
@@ -77,12 +72,6 @@ module RedminePluginsHelper
77
72
  .each { |plugin_name, arg| requires_redmine_plugin(plugin_name, arg) }
78
73
  @dependencies_from_file_loaded = true
79
74
  end
80
-
81
- # @return [Set<Symbol>]
82
- def recursive_dependencies_ids
83
- ::EacRubyUtils::RecursiveBuilder
84
- .new(id) { |plugin_id| ::Redmine::Plugin.find(plugin_id).dependencies_ids }.result
85
- end
86
75
  end
87
76
  end
88
77
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module RedminePluginsHelper
6
4
  module Patches
7
5
  module Redmine
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module RedminePluginsHelper
6
4
  module Patches
7
5
  module Redmine
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'redmine_plugins_helper/test_tasks/base'
5
4
  require 'redmine_plugins_helper/test_tasks/minitest'
6
5
  require 'redmine_plugins_helper/test_tasks/rspec'
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'redmine_plugins_helper/test_tasks/base'
5
4
  require 'rake/task'
6
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module RedminePluginsHelper
6
4
  module TestTasks
7
5
  class Base
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'redmine_plugins_helper/test_tasks/base'
5
4
  require 'rake/testtask'
6
5
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'redmine_plugins_helper/test_tasks/base'
5
4
  require 'rspec/core/rake_task'
6
5
 
@@ -3,7 +3,7 @@
3
3
  module RedminePluginsHelper
4
4
  AUTHOR = 'Eduardo Henrique Bogoni'
5
5
  SUMMARY = 'Helper for Redmine plugins'
6
- VERSION = '0.18.0'
6
+ VERSION = '0.19.0'
7
7
 
8
8
  module Version
9
9
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_plugins_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
- - 0.18.0
7
+ - 0.19.0
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
@@ -38,7 +38,7 @@ dependencies:
38
38
  version: '0.15'
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.15.1
41
+ version: 0.15.3
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -48,7 +48,7 @@ dependencies:
48
48
  version: '0.15'
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: 0.15.1
51
+ version: 0.15.3
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: eac_ruby_utils
54
54
  requirement: !ruby/object:Gem::Requirement