eac_redmine_base0 0.4.3 → 0.6.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: 5f20d973844997c94e102f1dcae7d62813603b0fd5558789c18519863efc59ba
4
- data.tar.gz: f178cebf40e416799afc9f396193fa196121e3a6433307006f2656c8f61dfd86
3
+ metadata.gz: 91906aa80bde0e5374befc79a7293eacd41689e22e753018497e10da46eaabd0
4
+ data.tar.gz: d73c3246ba32b768191a38dd8ebad8f815b17b8f6f8a6f36b4ca835579cdb79c
5
5
  SHA512:
6
- metadata.gz: 252ec79683fdb73426457865ef716cc73b7b16aa3411e4124f282397bf42c634916821824beca95c7a629ce25166922e6d40e4bae44c2f37d428827e53fd03e0
7
- data.tar.gz: 03b548c664aadafd6de0b32f7725e95832d1592f4e74d05e1ea3efa261c1385d14ba893b8adf9dd5ca2bb79ef70447f83858b8c3ddd37245dcbaf1ef43780e8b
6
+ metadata.gz: 8e5313c3a2983672ce2956b77302b94be540eab5d48bb1ae01d2483057dd78923de9ca5bec9aec148580141d0f479d4e20afdba51ac781f29005fc5ba603d7a7
7
+ data.tar.gz: e5dfcb0f0ab8bd798c5749164c0940891d668d56f1e46b364852f211007ad5b60c71c51b68712776066ad4c9c69791dda9dd83c38f4674d05507bb9574da2abe
data/init.rb CHANGED
@@ -10,7 +10,3 @@ Redmine::Plugin.register :eac_redmine_base0 do
10
10
  description ::EacRedmineBase0::SUMMARY
11
11
  version ::EacRedmineBase0::VERSION
12
12
  end
13
-
14
- Rails.configuration.to_prepare do
15
- require 'eac_redmine_base0/maintained_plugins'
16
- end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRedmineBase0
6
+ module Tasks
7
+ class System
8
+ common_constructor :command_string
9
+
10
+ def banner
11
+ ::Rails.logger.info("Command string: #{command_string}")
12
+ ::Rails.logger.info("Command arguments: #{command_args}")
13
+ end
14
+
15
+ # @return [EacRubyUtils::Envs::Command]
16
+ def command
17
+ host_env.command(*command_args)
18
+ end
19
+
20
+ # @return [Array<String>]
21
+ def command_args
22
+ ::Shellwords.split(command_string)
23
+ end
24
+
25
+ # @return [EacRubyUtils::Envs::Local]
26
+ def host_env
27
+ ::EacRubyUtils::Envs.local
28
+ end
29
+
30
+ def perform
31
+ banner
32
+ command.system!
33
+ end
34
+ end
35
+ end
36
+ 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.4.3'
7
+ VERSION = '0.6.0'
8
8
  end
@@ -1,22 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift(::File.join(::File.dirname(__dir__)))
4
- require 'eac_redmine_base0'
5
-
6
3
  namespace :eac_redmine_base0 do
7
- namespace :plugins do
8
- desc 'Lists plugins maintained by E.A.C..'
9
- task list: :environment do
10
- ::EacRedmineBase0.maintained_plugins.each do |plugin|
11
- ::Rails.logger.info("Plugin: #{plugin.name} (ID: #{plugin.id})")
12
- end
13
- end
14
-
15
- desc 'Tests plugins maintained by E.A.C..'
16
- task test: :environment do
17
- ::EacRedmineBase0::PluginsTest.new.run
18
- end
4
+ desc 'Execute a system command'
5
+ task :system, [:command_string] => :environment do |_t, args|
6
+ ::EacRedmineBase0::Tasks::System.new(args.command_string).perform
19
7
  end
20
-
21
- task plugins: 'plugins:list'
22
8
  end
metadata CHANGED
@@ -1,63 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_redmine_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
- - 0.4.3
7
+ - 0.6.0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-06 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: avm-eac_redmine_base0
14
+ name: eac_ruby_utils
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.6.1
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '0.6'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.6.1
33
- - !ruby/object:Gem::Dependency
34
- name: avm-eac_redmine_plugin_base0
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.1'
19
+ version: '0.119'
40
20
  type: :runtime
41
21
  prerelease: false
42
22
  version_requirements: !ruby/object:Gem::Requirement
43
23
  requirements:
44
24
  - - "~>"
45
25
  - !ruby/object:Gem::Version
46
- version: '0.1'
26
+ version: '0.119'
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: eac_ruby_gem_support
49
29
  requirement: !ruby/object:Gem::Requirement
50
30
  requirements:
51
31
  - - "~>"
52
32
  - !ruby/object:Gem::Version
53
- version: 0.5.1
33
+ version: 0.6.0
54
34
  type: :development
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
37
  requirements:
58
38
  - - "~>"
59
39
  - !ruby/object:Gem::Version
60
- version: 0.5.1
40
+ version: 0.6.0
61
41
  description:
62
42
  email:
63
43
  executables: []
@@ -66,13 +46,7 @@ extra_rdoc_files: []
66
46
  files:
67
47
  - init.rb
68
48
  - lib/eac_redmine_base0.rb
69
- - lib/eac_redmine_base0/maintained_plugins.rb
70
- - lib/eac_redmine_base0/plugins_test.rb
71
- - lib/eac_redmine_base0/plugins_test/base_test.rb
72
- - lib/eac_redmine_base0/plugins_test/plugin.rb
73
- - lib/eac_redmine_base0/plugins_test/rake_task_test.rb
74
- - lib/eac_redmine_base0/plugins_test/rubocop_test.rb
75
- - lib/eac_redmine_base0/plugins_test/unmaintened_stub_test.rb
49
+ - lib/eac_redmine_base0/tasks/system.rb
76
50
  - lib/eac_redmine_base0/version.rb
77
51
  - lib/tasks/eac_redmine_base0.rake
78
52
  homepage: https://github.com/esquilo-azul/eac_redmine_base0
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'redmine/plugin'
4
-
5
- module EacRedmineBase0
6
- MAINTAINED_PLUGINS_NAMES = %w[
7
- eac_redmine_base0 eac_redmine_usability notifyme redmine_avm redmine_events_manager
8
- redmine_installer redmine_nonproject_modules redmine_plugins_helper redmine_remotes
9
- redmine_tasks_scheduler redmine_with_git
10
- ].freeze
11
-
12
- class << self
13
- def maintained_plugins
14
- @maintained_plugins ||= ::Redmine::Plugin.registered_plugins.values.select do |plugin|
15
- MAINTAINED_PLUGINS_NAMES.include?(plugin.id.to_s)
16
- end
17
- end
18
- end
19
- end
@@ -1,50 +0,0 @@
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
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_redmine_base0/sources/base'
4
- require 'avm/eac_redmine_plugin_base0/sources/base'
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
- ::Avm::EacRedminePluginBase0::Sources::Base.new(directory)
35
- end
36
-
37
- def rails_gem_uncached
38
- ::Avm::EacRedmineBase0::Sources::Base.new(::Rails.root)
39
- end
40
- end
41
- end
42
- end
@@ -1,29 +0,0 @@
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
@@ -1,36 +0,0 @@
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
@@ -1,15 +0,0 @@
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,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/speaker'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/envs'
6
- require 'eac_ruby_utils/speaker'
7
-
8
- module EacRedmineBase0
9
- class PluginsTest
10
- enable_speaker
11
-
12
- def run
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
19
- end
20
- end
21
-
22
- def check_plugin(plugin)
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
31
- results_banner
32
- end
33
-
34
- def results_banner
35
- infom 'Tests\' results:'
36
- @tests.each do |test|
37
- infov " * #{test}", test.test_result.label
38
- end
39
- end
40
-
41
- def tests_failed
42
- @tests.select { |test| test.test_result.error? }
43
- end
44
-
45
- def check_results
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")
50
- else
51
- success 'All tests passed'
52
- end
53
- end
54
- end
55
- end