eac_redmine_base0 0.3.0 → 0.4.0

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: ca08d63adeb5cb5ccb9b721d7768dbf97e9cced1ffd058364c6831e26225f422
4
- data.tar.gz: f59d7933c5eb5ee6c09bf86f40c54f08f341ce973ec3bfcc2d63aea26d6baaa9
3
+ metadata.gz: 2b1d04912b952e1e0f675a69e83c4f451f4a85d0d7d22d4b70e8608c390668be
4
+ data.tar.gz: 34bc31720ee8369d20cd473ba708df6e90033fcab02bd9c310036a6b3ad9df6e
5
5
  SHA512:
6
- metadata.gz: 5858ad42d57204763a12d3c462103056ae5be5e2d25e0f286a5d846308c03dc0cb625eec7a40ee16e265628a52183cdfd33123eaa7668ce4edc55913b96e2f16
7
- data.tar.gz: 9865b1c8f6938f47438d4b3c28d0fe28beeed7f2b6fe3b413b289d8d0b5c9341745a7f632e0da31dcbc7668c0ef9209557347e13b9d2c30eb5a657e657b528dc
6
+ metadata.gz: 7500c4beeb108d6d2d06e2c818dc5991663e6706517ed3031c19d3048209060edbc6c2309ff951bf872ffdab632137d919510b68c1d17cc9bfabfaa60ce69689
7
+ data.tar.gz: 7326614d2822ffcb1b148f89e5ccf5fe05a6e56be84444eebc2c9427e32e7abedbe59f8eb41cbdd71ef973ca8d9737298c39010cdef8f1269d3fe8a9a3a4b6c0
@@ -5,8 +5,8 @@ require 'redmine/plugin'
5
5
  module EacRedmineBase0
6
6
  MAINTAINED_PLUGINS_NAMES = %w[
7
7
  eac_redmine_base0 eac_redmine_usability notifyme redmine_avm redmine_events_manager
8
- redmine_nonproject_modules redmine_plugins_helper redmine_remotes redmine_tasks_scheduler
9
- redmine_with_git
8
+ redmine_installer redmine_nonproject_modules redmine_plugins_helper redmine_remotes
9
+ redmine_tasks_scheduler redmine_with_git
10
10
  ].freeze
11
11
 
12
12
  class << self
@@ -1,108 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/result'
4
3
  require 'eac_ruby_utils/console/speaker'
5
4
  require 'eac_ruby_utils/envs'
6
- require 'eac_ruby_utils/simple_cache'
7
5
 
8
6
  module EacRedmineBase0
9
7
  class PluginsTest
10
8
  include ::EacRubyUtils::Console::Speaker
11
9
 
12
10
  def run
13
- @plugins = []
14
- ::Redmine::Plugin.registered_plugins.values.each do |plugin|
11
+ @tests = []
12
+ ::Redmine::Plugin.registered_plugins.each_value do |plugin|
15
13
  check_plugin(plugin)
16
14
  end
17
15
  check_results
18
16
  end
19
17
 
20
18
  def check_plugin(plugin)
21
- infom "Checking plugin \"#{plugin.id}\"..."
22
- test_plugin = PluginTest.new(plugin)
23
- test_plugin.test_result
24
- infom "Plugin \"#{plugin.id}\" checked"
25
- @plugins << test_plugin
19
+ ::EacRedmineBase0::PluginsTest::Plugin.new(plugin).tests.each { |test| check_test(test) }
20
+ end
21
+
22
+ def check_test(test)
23
+ infom "Checking test \"#{test}\"..."
24
+ test.test_result
25
+ infom "Test \"#{test}\" checked"
26
+ @tests << test
26
27
  results_banner
27
28
  end
28
29
 
29
30
  def results_banner
30
- infom 'Plugins\' test results:'
31
- @plugins.each do |plugin|
32
- infov " * #{plugin.id}", plugin.test_result.label
31
+ infom 'Tests\' results:'
32
+ @tests.each do |test|
33
+ infov " * #{test}", test.test_result.label
33
34
  end
34
35
  end
35
36
 
36
- def plugins_failed
37
- @plugins.select { |plugin| plugin.test_result.error? }
37
+ def tests_failed
38
+ @tests.select { |test| test.test_result.error? }
38
39
  end
39
40
 
40
41
  def check_results
41
- if plugins_failed.any?
42
+ if tests_failed.any?
42
43
  fatal_error "Some test did not pass:\n" +
43
- plugins_failed.map { |p| " * #{p.id} (Log: #{p.stdout_log})" }.join("\n")
44
+ tests_failed.map { |test| " * #{test} (Log: #{test.stdout_log})" }.join("\n")
44
45
  else
45
46
  success 'All tests passed'
46
47
  end
47
48
  end
48
-
49
- class PluginTest < ::SimpleDelegator
50
- include ::EacRubyUtils::SimpleCache
51
-
52
- def initialize(plugin)
53
- super(plugin)
54
- end
55
-
56
- def test_task_name
57
- "#{id}:test"
58
- end
59
-
60
- def test_task?
61
- ::Rake::Task.task_defined?(test_task_name)
62
- end
63
-
64
- def stderr_log
65
- log_path('stderr')
66
- end
67
-
68
- def stdout_log
69
- log_path('stdout')
70
- end
71
-
72
- def maintained?
73
- ::EacRedmineBase0.maintained_plugins.any? { |plugin| plugin.id == id }
74
- end
75
-
76
- private
77
-
78
- def log_path(suffix)
79
- r = ::Rails.root.join('log', 'eac_redmine_base0', "#{id}_test_#{suffix}.log")
80
- ::FileUtils.mkdir_p(::File.dirname(r))
81
- r
82
- end
83
-
84
- def test_result_uncached
85
- return ::Avm::Result.neutral('not maintained by E.A.C.') unless maintained?
86
- return ::Avm::Result.neutral("task \"#{test_task_name}\" not found") unless test_task?
87
-
88
- ::Avm::Result.success_or_error(
89
- run_test ? 'success' : "failed (Log: #{stdout_log})",
90
- run_test
91
- )
92
- end
93
-
94
- def run_test_uncached
95
- r = run_test_command.execute
96
- ::File.write(stderr_log, r.fetch(:stderr))
97
- ::File.write(stdout_log, r.fetch(:stdout))
98
- r.fetch(:exit_code).zero?
99
- end
100
-
101
- def run_test_command
102
- ::EacRubyUtils::Envs.local.command('bundle', 'exec', 'rake', test_task_name)
103
- .envvar('RAILS_ENV', 'test')
104
- .chdir(::Rails.root)
105
- end
106
- end
107
49
  end
108
50
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRedmineBase0
6
+ class PluginsTest
7
+ class BaseTest
8
+ enable_simple_cache
9
+ common_constructor :plugin
10
+
11
+ def stderr_log
12
+ log_path('stderr')
13
+ end
14
+
15
+ def stdout_log
16
+ log_path('stdout')
17
+ end
18
+
19
+ def test_name
20
+ self.class.name.demodulize.gsub(/Test\z/, '').underscore
21
+ end
22
+
23
+ def to_s
24
+ "#{plugin.id}/#{test_name}"
25
+ end
26
+
27
+ private
28
+
29
+ def log_path(suffix)
30
+ r = ::Rails.root.join('log', 'eac_redmine_base0',
31
+ "#{plugin.id}_#{self.class.name.demodulize.underscore}_#{suffix}.log")
32
+ ::FileUtils.mkdir_p(::File.dirname(r))
33
+ r
34
+ end
35
+
36
+ def run_test_uncached
37
+ r = run_test_command.execute
38
+ ::File.write(stderr_log, r.fetch(:stderr))
39
+ ::File.write(stdout_log, r.fetch(:stdout))
40
+ r.fetch(:exit_code).zero?
41
+ end
42
+
43
+ def test_result_uncached
44
+ ::Avm::Result.success_or_error(
45
+ run_test, 'success', "failed (Log: #{stdout_log})"
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/configuration' # TO-DO: remove when fixed in gem "avm-tools"
4
+ require 'avm/patches/eac_ruby_gems_utils/gem'
5
+ require 'avm/result'
6
+ require 'eac_ruby_utils/simple_cache'
7
+
8
+ module EacRedmineBase0
9
+ class PluginsTest
10
+ class Plugin < ::SimpleDelegator
11
+ include ::EacRubyUtils::SimpleCache
12
+
13
+ def initialize(plugin)
14
+ super(plugin)
15
+ end
16
+
17
+ def maintained?
18
+ ::EacRedmineBase0.maintained_plugins.any? { |plugin| plugin.id == id }
19
+ end
20
+
21
+ def tests
22
+ return [test_by_type(:unmaintened_stub)] unless maintained?
23
+
24
+ [test_by_type(:rake_task), test_by_type(:rubocop)]
25
+ end
26
+
27
+ private
28
+
29
+ def test_by_type(type)
30
+ ::EacRedmineBase0::PluginsTest.const_get(type.to_s.camelize + 'Test').new(self)
31
+ end
32
+
33
+ def plugin_gem_uncached
34
+ ::EacRubyGemsUtils::Gem.new(directory)
35
+ end
36
+
37
+ def rails_gem_uncached
38
+ ::EacRubyGemsUtils::Gem.new(::Rails.root)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRedmineBase0
6
+ class PluginsTest
7
+ class RakeTaskTest < ::EacRedmineBase0::PluginsTest::BaseTest
8
+ def test_task?
9
+ ::Rake::Task.task_defined?(test_task_name)
10
+ end
11
+
12
+ def test_task_name
13
+ "#{plugin.id}:test"
14
+ end
15
+
16
+ private
17
+
18
+ def run_test_command
19
+ plugin.rails_gem.bundle('exec', 'rake', test_task_name).envvar('RAILS_ENV', 'test')
20
+ end
21
+
22
+ def test_result_uncached
23
+ return ::Avm::Result.neutral("task \"#{test_task_name}\" not found") unless test_task?
24
+
25
+ super
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRedmineBase0
6
+ class PluginsTest
7
+ class RubocopTest < ::EacRedmineBase0::PluginsTest::BaseTest
8
+ EXEC_NAME = GEM_NAME = 'rubocop'
9
+
10
+ def rubocop?
11
+ return false unless plugin.plugin_gem.gemfile_path.exist?
12
+
13
+ bundle_install_command.execute!
14
+ plugin.plugin_gem.gemfile_lock_gem_version(GEM_NAME).present?
15
+ end
16
+
17
+ private
18
+
19
+ def bundle_install_command
20
+ plugin.plugin_gem.bundle.chdir_root
21
+ end
22
+
23
+ def run_test_command
24
+ plugin.plugin_gem.bundle('exec', EXEC_NAME, '--ignore-parent-exclusion')
25
+ .envvar('RAILS_ENV', 'test')
26
+ .chdir_root
27
+ end
28
+
29
+ def test_result_uncached
30
+ return ::Avm::Result.neutral("gem \"#{GEM_NAME}\"not found") unless rubocop?
31
+
32
+ super
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRedmineBase0
6
+ class PluginsTest
7
+ class UnmaintenedStubTest < ::EacRedmineBase0::PluginsTest::BaseTest
8
+ private
9
+
10
+ def test_result_uncached
11
+ ::Avm::Result.neutral('not maintained by E.A.C.')
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,5 +4,5 @@ module EacRedmineBase0
4
4
  AUTHOR = 'Eduardo Henrique Bogoni'
5
5
  HOMEPAGE = 'https://github.com/esquilo-azul/eac_redmine_base0'
6
6
  SUMMARY = 'E.A.C. base for Redmine.'
7
- VERSION = '0.3.0'
7
+ VERSION = '0.4.0'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_redmine_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
- - 0.3.0
7
+ - 0.4.0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-tools
@@ -16,42 +16,54 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '0.62'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.62.4
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '0.9'
29
+ version: '0.62'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.62.4
27
33
  - !ruby/object:Gem::Dependency
28
- name: rubocop
34
+ name: eac_ruby_gems_utils
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.74.0
39
+ version: '0.4'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.74.0
46
+ version: '0.4'
41
47
  - !ruby/object:Gem::Dependency
42
- name: rubocop-rails
48
+ name: eac_ruby_gem_support
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: 2.2.1
48
- type: :runtime
53
+ version: '0.1'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.1.2
57
+ type: :development
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
61
  - - "~>"
53
62
  - !ruby/object:Gem::Version
54
- version: 2.2.1
63
+ version: '0.1'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.1.2
55
67
  description:
56
68
  email:
57
69
  executables: []
@@ -62,6 +74,11 @@ files:
62
74
  - lib/eac_redmine_base0.rb
63
75
  - lib/eac_redmine_base0/maintained_plugins.rb
64
76
  - lib/eac_redmine_base0/plugins_test.rb
77
+ - lib/eac_redmine_base0/plugins_test/base_test.rb
78
+ - lib/eac_redmine_base0/plugins_test/plugin.rb
79
+ - lib/eac_redmine_base0/plugins_test/rake_task_test.rb
80
+ - lib/eac_redmine_base0/plugins_test/rubocop_test.rb
81
+ - lib/eac_redmine_base0/plugins_test/unmaintened_stub_test.rb
65
82
  - lib/eac_redmine_base0/version.rb
66
83
  - lib/tasks/eac_redmine_base0.rake
67
84
  homepage: https://github.com/esquilo-azul/eac_redmine_base0
@@ -82,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
99
  - !ruby/object:Gem::Version
83
100
  version: '0'
84
101
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.7.7
102
+ rubygems_version: 3.0.8
87
103
  signing_key:
88
104
  specification_version: 4
89
105
  summary: E.A.C. base for Redmine.