eac_redmine_base0 0.3.4 → 0.4.2
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 +27 -82
- data/lib/eac_redmine_base0/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08dba2f8da9a36a165344ccb726aeb56e90079cc301b58f678f182f32ab5a06b'
|
4
|
+
data.tar.gz: c5cfae35d8edac0481a9087063ba6fe5bb1ba386346eb43acf3ee65b99864f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 914f7ff9963b080c4088da2d527471945d2f39645c6a17217985dab4a5fb4ad009648ee7b68bc0cb173b82084e2e59fda354140dfce541f72ddfde0f1e9cb785
|
7
|
+
data.tar.gz: 2476170eb485e172bc5eb7070aa38ae16bc1afa49939fceb69e0e1c0a877db95549eae86641e7cf8a0b38f6d2a37caef93ed52b3b80b7192e20e2d18f3ae9746
|
@@ -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,110 +1,55 @@
|
|
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
|
43
|
-
fatal_error "Some test did not pass:\n" +
|
44
|
-
|
46
|
+
if tests_failed.any?
|
47
|
+
fatal_error "Some test did not pass:\n" + tests_failed.map do |test|
|
48
|
+
" * #{test} (Log: #{test.stdout_log}, #{test.stderr_log})"
|
49
|
+
end.join("\n")
|
45
50
|
else
|
46
51
|
success 'All tests passed'
|
47
52
|
end
|
48
53
|
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
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
def rails_gem_uncached
|
95
|
-
::EacRubyGemsUtils::Gem.new(::Rails.root)
|
96
|
-
end
|
97
|
-
|
98
|
-
def run_test_uncached
|
99
|
-
r = run_test_command.execute
|
100
|
-
::File.write(stderr_log, r.fetch(:stderr))
|
101
|
-
::File.write(stdout_log, r.fetch(:stdout))
|
102
|
-
r.fetch(:exit_code).zero?
|
103
|
-
end
|
104
|
-
|
105
|
-
def run_test_command
|
106
|
-
rails_gem.bundle('exec', 'rake', test_task_name).envvar('RAILS_ENV', 'test')
|
107
|
-
end
|
108
|
-
end
|
109
54
|
end
|
110
55
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- 0.
|
7
|
+
- 0.4.2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm-tools
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
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.
|
29
|
+
version: '0.62'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.62.4
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: eac_ruby_gems_utils
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,6 +74,11 @@ files:
|
|
68
74
|
- lib/eac_redmine_base0.rb
|
69
75
|
- lib/eac_redmine_base0/maintained_plugins.rb
|
70
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
|
71
82
|
- lib/eac_redmine_base0/version.rb
|
72
83
|
- lib/tasks/eac_redmine_base0.rake
|
73
84
|
homepage: https://github.com/esquilo-azul/eac_redmine_base0
|
@@ -88,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
99
|
- !ruby/object:Gem::Version
|
89
100
|
version: '0'
|
90
101
|
requirements: []
|
91
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.1.6
|
92
103
|
signing_key:
|
93
104
|
specification_version: 4
|
94
105
|
summary: E.A.C. base for Redmine.
|