eac_redmine_base0 0.3.2 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_redmine_base0/plugins_test/base_test.rb +50 -0
- data/lib/eac_redmine_base0/plugins_test/plugin.rb +41 -0
- data/lib/eac_redmine_base0/plugins_test/rake_task_test.rb +29 -0
- data/lib/eac_redmine_base0/plugins_test/rubocop_test.rb +36 -0
- data/lib/eac_redmine_base0/plugins_test/unmaintened_stub_test.rb +15 -0
- data/lib/eac_redmine_base0/plugins_test.rb +25 -82
- data/lib/eac_redmine_base0/version.rb +1 -1
- metadata +22 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338f8bfecc573d2e9e0e5bef3ce48477b0bb742ce70dfb64aa2ca8bf79287822
|
4
|
+
data.tar.gz: 95750c2e28d9cb697902af7f89928bb3a2698df66cd03212ac933ce9efbbdfc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83628836c8dcf3648e0e6b7d9fd310bdb46ec0b83d4d276b0f1946d830cda0b74945b61c68c568d9a2c33e21c3df41bd5e0e5a7c6ed69e0a70f3a0a4637e512
|
7
|
+
data.tar.gz: 997a3cae6e40548756fa57a9a2c4854c77c5bc740f71c1298ecd0a9e439f3cdec29722296052423c0bf3a7d1b0a8de1cdecc11eb84fc7c14ee11cc9cd8324779
|
@@ -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,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
require 'avm/result'
|
5
|
+
require 'eac_ruby_utils/simple_cache'
|
6
|
+
|
7
|
+
module EacRedmineBase0
|
8
|
+
class PluginsTest
|
9
|
+
class Plugin < ::SimpleDelegator
|
10
|
+
include ::EacRubyUtils::SimpleCache
|
11
|
+
|
12
|
+
def initialize(plugin)
|
13
|
+
super(plugin)
|
14
|
+
end
|
15
|
+
|
16
|
+
def maintained?
|
17
|
+
::EacRedmineBase0.maintained_plugins.any? { |plugin| plugin.id == id }
|
18
|
+
end
|
19
|
+
|
20
|
+
def tests
|
21
|
+
return [test_by_type(:unmaintened_stub)] unless maintained?
|
22
|
+
|
23
|
+
[test_by_type(:rake_task), test_by_type(:rubocop)]
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def test_by_type(type)
|
29
|
+
::EacRedmineBase0::PluginsTest.const_get(type.to_s.camelize + 'Test').new(self)
|
30
|
+
end
|
31
|
+
|
32
|
+
def plugin_gem_uncached
|
33
|
+
::EacRubyGemsUtils::Gem.new(directory)
|
34
|
+
end
|
35
|
+
|
36
|
+
def rails_gem_uncached
|
37
|
+
::EacRubyGemsUtils::Gem.new(::Rails.root)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
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
|
@@ -1,111 +1,54 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require 'eac_ruby_utils/console/speaker'
|
3
|
+
require 'eac_cli/speaker'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
6
5
|
require 'eac_ruby_utils/envs'
|
7
|
-
require 'eac_ruby_utils/
|
6
|
+
require 'eac_ruby_utils/speaker'
|
8
7
|
|
9
8
|
module EacRedmineBase0
|
10
9
|
class PluginsTest
|
11
|
-
|
10
|
+
enable_speaker
|
12
11
|
|
13
12
|
def run
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
|
14
|
+
@tests = []
|
15
|
+
::Redmine::Plugin.registered_plugins.each_value do |plugin|
|
16
|
+
check_plugin(plugin)
|
17
|
+
end
|
18
|
+
check_results
|
17
19
|
end
|
18
|
-
check_results
|
19
20
|
end
|
20
21
|
|
21
22
|
def check_plugin(plugin)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
::EacRedmineBase0::PluginsTest::Plugin.new(plugin).tests.each { |test| check_test(test) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_test(test)
|
27
|
+
infom "Checking test \"#{test}\"..."
|
28
|
+
test.test_result
|
29
|
+
infom "Test \"#{test}\" checked"
|
30
|
+
@tests << test
|
27
31
|
results_banner
|
28
32
|
end
|
29
33
|
|
30
34
|
def results_banner
|
31
|
-
infom '
|
32
|
-
@
|
33
|
-
infov " * #{
|
35
|
+
infom 'Tests\' results:'
|
36
|
+
@tests.each do |test|
|
37
|
+
infov " * #{test}", test.test_result.label
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
37
|
-
def
|
38
|
-
@
|
41
|
+
def tests_failed
|
42
|
+
@tests.select { |test| test.test_result.error? }
|
39
43
|
end
|
40
44
|
|
41
45
|
def check_results
|
42
|
-
if
|
46
|
+
if tests_failed.any?
|
43
47
|
fatal_error "Some test did not pass:\n" +
|
44
|
-
|
48
|
+
tests_failed.map { |test| " * #{test} (Log: #{test.stdout_log})" }.join("\n")
|
45
49
|
else
|
46
50
|
success 'All tests passed'
|
47
51
|
end
|
48
52
|
end
|
49
|
-
|
50
|
-
class PluginTest < ::SimpleDelegator
|
51
|
-
include ::EacRubyUtils::SimpleCache
|
52
|
-
|
53
|
-
def initialize(plugin)
|
54
|
-
super(plugin)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_task_name
|
58
|
-
"#{id}:test"
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_task?
|
62
|
-
::Rake::Task.task_defined?(test_task_name)
|
63
|
-
end
|
64
|
-
|
65
|
-
def stderr_log
|
66
|
-
log_path('stderr')
|
67
|
-
end
|
68
|
-
|
69
|
-
def stdout_log
|
70
|
-
log_path('stdout')
|
71
|
-
end
|
72
|
-
|
73
|
-
def maintained?
|
74
|
-
::EacRedmineBase0.maintained_plugins.any? { |plugin| plugin.id == id }
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def log_path(suffix)
|
80
|
-
r = ::Rails.root.join('log', 'eac_redmine_base0', "#{id}_test_#{suffix}.log")
|
81
|
-
::FileUtils.mkdir_p(::File.dirname(r))
|
82
|
-
r
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_result_uncached
|
86
|
-
return ::Avm::Result.neutral('not maintained by E.A.C.') unless maintained?
|
87
|
-
return ::Avm::Result.neutral("task \"#{test_task_name}\" not found") unless test_task?
|
88
|
-
|
89
|
-
::Avm::Result.success_or_error(
|
90
|
-
run_test ? 'success' : "failed (Log: #{stdout_log})",
|
91
|
-
run_test
|
92
|
-
)
|
93
|
-
end
|
94
|
-
|
95
|
-
def rails_gem_uncached
|
96
|
-
::EacRubyGemsUtils::Gem.new(::Rails.root)
|
97
|
-
end
|
98
|
-
|
99
|
-
def run_test_uncached
|
100
|
-
r = run_test_command.execute
|
101
|
-
::File.write(stderr_log, r.fetch(:stderr))
|
102
|
-
::File.write(stdout_log, r.fetch(:stdout))
|
103
|
-
r.fetch(:exit_code).zero?
|
104
|
-
end
|
105
|
-
|
106
|
-
def run_test_command
|
107
|
-
rails_gem.bundle('exec', 'rake', test_task_name).envvar('RAILS_ENV', 'test')
|
108
|
-
end
|
109
|
-
end
|
110
53
|
end
|
111
54
|
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.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- 0.
|
7
|
+
- 0.4.1
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm-tools
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.62'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.62.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.62'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.62.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: eac_ruby_gems_utils
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,33 +45,25 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0.4'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: eac_ruby_gem_support
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
54
|
-
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.74.0
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rubocop-rails
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
53
|
+
version: '0.1'
|
54
|
+
- - ">="
|
66
55
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
-
type: :
|
56
|
+
version: 0.1.2
|
57
|
+
type: :development
|
69
58
|
prerelease: false
|
70
59
|
version_requirements: !ruby/object:Gem::Requirement
|
71
60
|
requirements:
|
72
61
|
- - "~>"
|
73
62
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
63
|
+
version: '0.1'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.1.2
|
75
67
|
description:
|
76
68
|
email:
|
77
69
|
executables: []
|
@@ -82,6 +74,11 @@ files:
|
|
82
74
|
- lib/eac_redmine_base0.rb
|
83
75
|
- lib/eac_redmine_base0/maintained_plugins.rb
|
84
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
|
85
82
|
- lib/eac_redmine_base0/version.rb
|
86
83
|
- lib/tasks/eac_redmine_base0.rake
|
87
84
|
homepage: https://github.com/esquilo-azul/eac_redmine_base0
|
@@ -102,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
99
|
- !ruby/object:Gem::Version
|
103
100
|
version: '0'
|
104
101
|
requirements: []
|
105
|
-
|
106
|
-
rubygems_version: 2.7.7
|
102
|
+
rubygems_version: 3.1.6
|
107
103
|
signing_key:
|
108
104
|
specification_version: 4
|
109
105
|
summary: E.A.C. base for Redmine.
|