avm-tools 0.116.1 → 0.117.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/launcher/instances/settings.rb +7 -3
  3. data/lib/avm/projects/stereotypes.rb +2 -2
  4. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +1 -1
  5. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +1 -1
  6. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +1 -3
  7. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +1 -1
  8. data/lib/avm/ruby/bundler/incompatible_parser.rb +1 -1
  9. data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb +1 -1
  10. data/lib/avm/tools/runner/app_src/test.rb +2 -2
  11. data/lib/avm/tools/runner/app_src/version_bump.rb +4 -9
  12. data/lib/avm/tools/runner/git/deploy.rb +4 -4
  13. data/lib/avm/tools/runner/git/dirty_files.rb +1 -1
  14. data/lib/avm/tools/runner/git/revisions_test.rb +1 -1
  15. data/lib/avm/tools/runner/ruby/rubocop.rb +2 -2
  16. data/lib/avm/tools/version.rb +1 -1
  17. data/sub/avm/avm.gemspec +3 -3
  18. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
  19. data/sub/avm/lib/avm/registry/base.rb +2 -2
  20. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
  21. data/sub/avm/lib/avm/scms/base.rb +13 -0
  22. data/sub/avm/lib/avm/sources/base/configuration.rb +2 -1
  23. data/sub/avm/lib/avm/sources/base/parent.rb +31 -0
  24. data/sub/avm/lib/avm/sources/base.rb +4 -6
  25. data/sub/avm/lib/avm/sources/configuration/{_locale.rb → locale.rb} +5 -3
  26. data/sub/avm/lib/avm/sources/configuration/rubocop.rb +26 -0
  27. data/sub/avm/lib/avm/sources/configuration/tests.rb +29 -0
  28. data/sub/avm/lib/avm/sources/configuration.rb +5 -1
  29. data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
  30. data/sub/avm/lib/avm/version.rb +1 -1
  31. data/sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec +1 -1
  32. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base/version_bump.rb +35 -0
  33. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base.rb +4 -1
  34. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
  35. data/sub/avm-eac_generic_base0/locale/en.yaml +6 -0
  36. data/sub/avm-eac_generic_base0/locale/pt-BR.yaml +6 -0
  37. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +1 -1
  38. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  39. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +1 -1
  40. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -1
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +3 -3
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +17 -2
  43. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  44. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +2 -8
  45. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile_apache_setup +8 -0
  46. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +1 -1
  47. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  48. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb +56 -0
  49. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb +19 -0
  50. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb +34 -0
  51. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb +11 -0
  52. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +31 -0
  53. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +17 -0
  54. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +41 -0
  55. data/{lib/avm/ruby → sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1}/rubocop.rb +2 -2
  56. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb +23 -0
  57. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +11 -0
  58. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +1 -1
  59. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +1 -1
  60. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb +0 -1
  61. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  62. data/sub/avm-files/avm-files.gemspec +1 -1
  63. data/sub/avm-files/lib/avm/files/appendable.rb +1 -1
  64. data/sub/avm-files/lib/avm/files/formatter/formats/ruby.rb +2 -2
  65. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  66. data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +1 -3
  67. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  68. data/sub/eac_cli/eac_cli.gemspec +2 -2
  69. data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +1 -1
  70. data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +1 -1
  71. data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +1 -1
  72. data/sub/eac_cli/lib/eac_cli/parser.rb +2 -2
  73. data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +9 -22
  74. data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +50 -0
  75. data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +0 -9
  76. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +1 -1
  77. data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
  78. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +4 -4
  79. data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +2 -2
  80. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  81. data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +23 -17
  82. data/sub/eac_config/eac_config.gemspec +1 -1
  83. data/sub/eac_config/lib/eac_config/entry.rb +1 -1
  84. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +1 -1
  85. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +1 -1
  86. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  87. data/sub/eac_fs/eac_fs.gemspec +1 -1
  88. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  89. data/sub/eac_git/eac_git.gemspec +1 -1
  90. data/sub/eac_git/lib/eac_git/local/remote.rb +2 -2
  91. data/sub/eac_git/lib/eac_git/local.rb +1 -1
  92. data/sub/eac_git/lib/eac_git/version.rb +1 -1
  93. data/sub/eac_rest/eac_rest.gemspec +1 -1
  94. data/sub/eac_rest/lib/eac_rest/api.rb +14 -3
  95. data/sub/eac_rest/lib/eac_rest/request.rb +22 -1
  96. data/sub/eac_rest/lib/eac_rest/response.rb +41 -1
  97. data/sub/eac_rest/lib/eac_rest/version.rb +1 -1
  98. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
  99. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +2 -2
  100. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  101. data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  102. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +2 -2
  103. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  104. data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  105. data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +2 -2
  106. data/sub/eac_ruby_utils/lib/eac_ruby_utils/core_ext.rb +1 -0
  107. data/sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb +1 -1
  108. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +1 -1
  109. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +1 -1
  110. data/sub/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +1 -1
  111. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +16 -4
  112. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +12 -2
  113. data/sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +1 -1
  114. data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb +4 -0
  115. data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_gem.rb +47 -0
  116. data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/module_i18n_translate.rb +74 -0
  117. data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb +9 -0
  118. data/sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb +35 -0
  119. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb +2 -25
  120. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/method_class.rb +9 -0
  121. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +6 -0
  122. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +86 -33
  123. data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +1 -1
  124. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  125. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/{temp_spec.rb → directory_spec.rb} +0 -0
  126. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb +4 -4
  127. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +169 -106
  128. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/method_class_spec.rb +46 -0
  129. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +52 -17
  130. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +5 -3
  131. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/method_class_spec.rb +20 -0
  132. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +5 -3
  133. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +3 -3
  134. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +21 -18
  135. data/sub/eac_ruby_utils/spec/locales/pt-BR.yml +3 -0
  136. data/sub/eac_templates/eac_templates.gemspec +1 -1
  137. data/sub/eac_templates/lib/eac_templates/directory.rb +1 -1
  138. data/sub/eac_templates/lib/eac_templates/version.rb +1 -1
  139. metadata +45 -18
  140. data/lib/avm/projects/stereotypes/rails_application/update.rb +0 -14
  141. data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +0 -60
  142. data/lib/avm/ruby/rubocop/_configured.rb +0 -29
  143. data/lib/avm/ruby/rubocop/_envvar.rb +0 -15
  144. data/lib/avm/ruby/rubocop/_gemfile.rb +0 -39
  145. data/sub/avm/lib/avm/sources/configuration/_rubocop.rb +0 -24
  146. data/sub/avm/lib/avm/sources/configuration/_tests.rb +0 -27
  147. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +0 -7
  148. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches.rb +0 -4
@@ -12,7 +12,8 @@ module Avm
12
12
  enable_simple_cache
13
13
 
14
14
  BASE_IMAGE = 'ubuntu:20.04'
15
- INSTALLER_TARGET_TASK = 'redmine_as_apache_base'
15
+ INSTALLER_TARGET_TASK_WITH_WEB_PATH_BLANK = 'redmine_as_apache_base'
16
+ INSTALLER_TARGET_TASK_WITH_WEB_PATH_PRESENT = 'redmine_as_apache_path'
16
17
  DATABASE_INTERNAL_HOSTNAME = 'localhost'
17
18
  REDMINE_SOURCE_HOST_SUBPATH = 'redmine_source'
18
19
 
@@ -20,6 +21,12 @@ module Avm
20
21
  instance.id
21
22
  end
22
23
 
24
+ def apache_setup
25
+ return '' if web_path_present?
26
+
27
+ template.child('Dockerfile_apache_setup').apply(self)
28
+ end
29
+
23
30
  def base_image
24
31
  eac_ubuntu_base0_instance.docker_image.provide.id
25
32
  end
@@ -30,7 +37,11 @@ module Avm
30
37
  end
31
38
 
32
39
  def installer_target_task
33
- INSTALLER_TARGET_TASK
40
+ if web_path_present?
41
+ INSTALLER_TARGET_TASK_WITH_WEB_PATH_PRESENT
42
+ else
43
+ INSTALLER_TARGET_TASK_WITH_WEB_PATH_BLANK
44
+ end
34
45
  end
35
46
 
36
47
  def redmine_user
@@ -53,6 +64,10 @@ module Avm
53
64
  '/start.sh'
54
65
  end
55
66
 
67
+ def web_path_present?
68
+ ::Addressable::URI.parse(instance.web_url).path.present?
69
+ end
70
+
56
71
  private
57
72
 
58
73
  def eac_ubuntu_base0_instance
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
@@ -22,19 +22,13 @@ RUN SKIP_DATABASE='%%skip_database%%' \
22
22
  '%%redmine_path%%/plugins/redmine_installer/installer/run.sh' '%%installer_target_task%%'
23
23
 
24
24
  # Apache / Configuração do virtualhost
25
- COPY apache_http_virtualhost.conf /etc/apache2/sites-available/redmine.conf
26
- COPY apache_https_virtualhost.conf /etc/apache2/sites-available/redmine_ssl.conf
27
- USER root
28
- RUN a2ensite redmine
29
- RUN a2ensite redmine_ssl
30
- RUN a2dissite 000-default
31
- RUN a2enmod ssl
32
- RUN service apache2 restart
25
+ %%apache_setup%%
33
26
 
34
27
  # Portas
35
28
  EXPOSE 80/tcp 443/tcp 22/tcp
36
29
 
37
30
  # Execução
31
+ USER root
38
32
  COPY start.sh '%%start_path%%'
39
33
  RUN /bin/chmod +x '%%start_path%%'
40
34
  RUN /bin/chown '%%redmine_user%%:%%redmine_user%%' '%%start_path%%'
@@ -0,0 +1,8 @@
1
+ COPY apache_http_virtualhost.conf /etc/apache2/sites-available/redmine.conf
2
+ COPY apache_https_virtualhost.conf /etc/apache2/sites-available/redmine_ssl.conf
3
+ USER root
4
+ RUN a2ensite redmine
5
+ RUN a2ensite redmine_ssl
6
+ RUN a2dissite 000-default
7
+ RUN a2enmod ssl
8
+ RUN service apache2 restart
@@ -34,7 +34,7 @@ function postgresql_start() {
34
34
 
35
35
  function request_http_interface() {
36
36
  title 'Requesting web interface...'
37
- wget 'http://localhost' &> /dev/null
37
+ wget 'http://localhost%%web.path%%' &> /dev/null
38
38
  }
39
39
 
40
40
  function redmine_log() {
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
 
15
15
  s.add_dependency 'avm', '~> 0.9'
16
- s.add_dependency 'avm-eac_generic_base0', '~> 0.1'
16
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.2'
17
17
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.8'
18
18
  s.add_dependency 'eac_ruby_utils', '~> 0.80'
19
19
 
20
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
20
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
21
21
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module Bundler
8
+ class Gemfile
9
+ class AddOrReplaceGemLine
10
+ enable_method_class
11
+ common_constructor :sender, :gem_name, :gem_specs
12
+ delegate :lines, to: :sender
13
+
14
+ def existing_gem_line_index
15
+ lines.index { |line| line.start_with?(gem_line_prefix) }
16
+ end
17
+
18
+ def result
19
+ if existing_gem_line_index.present?
20
+ replace_line
21
+ else
22
+ add_line
23
+ end
24
+ end
25
+
26
+ def add_line
27
+ lines.insert(add_line_index, new_gem_line)
28
+ end
29
+
30
+ def add_line_index
31
+ (gems_lines_start_index..(lines.count - 1)).each do |e|
32
+ return e if new_gem_line < lines[e]
33
+ end
34
+ lines.count
35
+ end
36
+
37
+ def gems_lines_start_index
38
+ lines.index { |line| line.start_with?('gem ') } || lines.count
39
+ end
40
+
41
+ def new_gem_line
42
+ ([gem_line_prefix] + gem_specs).join(', ')
43
+ end
44
+
45
+ def gem_line_prefix
46
+ "gem '#{gem_name}'"
47
+ end
48
+
49
+ def replace_line
50
+ lines[existing_gem_line_index] = new_gem_line
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module Bundler
8
+ class Gemfile
9
+ class Dependency
10
+ common_constructor :gemfile, :gem_name
11
+
12
+ def version_specs=(version_specs)
13
+ gemfile.add_or_replace_gem_line(gem_name, version_specs)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module Bundler
8
+ class Gemfile
9
+ require_sub __FILE__, require_dependency: true
10
+
11
+ class << self
12
+ def from_file(path)
13
+ new(path.read.each_line.map(&:rstrip))
14
+ end
15
+ end
16
+
17
+ common_constructor :lines
18
+
19
+ # @return [Avm::EacRubyBase1::Bundler::Gemfile::Dependency]
20
+ def dependency(gem_name)
21
+ ::Avm::EacRubyBase1::Bundler::Gemfile::Dependency.new(self, gem_name)
22
+ end
23
+
24
+ def write(path)
25
+ path.to_pathname.write(to_text)
26
+ end
27
+
28
+ def to_text
29
+ lines.map { |line| "#{line}\n" }.join
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module Bundler
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/configuration'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ class Rubocop
8
+ module Configured
9
+ def configured_rubocop_command_uncached
10
+ configured_rubocop_command_by_command || configured_rubocop_command_by_gemfile
11
+ end
12
+
13
+ def configured_rubocop_command_by_command
14
+ configuration.if_present(&:rubocop_command)
15
+ end
16
+
17
+ def configured_rubocop_command_by_gemfile
18
+ configuration.if_present(&:rubocop_gemfile).if_present do |v|
19
+ rubocop_command_by_gemfile_path(v.parent)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def configuration_uncached
26
+ ::Avm::Sources::Configuration.find_by_path(base_path)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ class Rubocop
8
+ module Envvar
9
+ RUBOCOP_COMMAND_ENVVAR_NAME = 'RUBOCOP_COMMAND'
10
+
11
+ def env_rubocop_command
12
+ ENV[RUBOCOP_COMMAND_ENVVAR_NAME].present? ? cmd(ENV[RUBOCOP_COMMAND_ENVVAR_NAME]) : nil
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches/eac_ruby_gems_utils/gem'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ class Rubocop
9
+ module Gemfile
10
+ def gemfile_rubocop_command
11
+ return nil unless rubocop_gemfile?
12
+
13
+ rubocop_command_by_gemfile_path(mygem.root)
14
+ end
15
+
16
+ def rubocop_command_by_gemfile_path(path)
17
+ ::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop').chdir_root
18
+ end
19
+
20
+ def rubocop_gemfile?
21
+ return false if mygem.blank?
22
+
23
+ mygem.bundle('install').execute!
24
+ mygem.gemfile_lock_gem_version('rubocop').present?
25
+ end
26
+
27
+ private
28
+
29
+ def mygem_uncached
30
+ find_gem(::Pathname.new(base_path).expand_path)
31
+ end
32
+
33
+ def find_gem(path)
34
+ r = ::EacRubyGemsUtils::Gem.new(path)
35
+ return r if r.gemfile_path.exist?
36
+ return find_gem(path.dirname) unless path.root?
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -4,9 +4,9 @@ require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_utils/ruby/on_clean_environment'
5
5
 
6
6
  module Avm
7
- module Ruby
7
+ module EacRubyBase1
8
8
  class Rubocop
9
- require_sub __FILE__
9
+ require_sub __FILE__, include_modules: true
10
10
  enable_speaker
11
11
  enable_simple_cache
12
12
  common_constructor :base_path, :rubocop_args
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_generic_base0/sources/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ module Sources
9
+ class Base < ::Avm::EacGenericBase0::Sources::Base
10
+ module VersionBump
11
+ def after_sub_version_bump_do_changes
12
+ the_gem.bundle('install').chdir_root.execute!
13
+ end
14
+
15
+ def version_bump_do_changes(target_version)
16
+ self.version = target_version
17
+ the_gem.bundle('install').chdir_root.execute!
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -3,6 +3,7 @@
3
3
  require 'avm/eac_generic_base0/sources/base'
4
4
  require 'avm/eac_ruby_base1/sources/update'
5
5
  require 'avm/eac_ruby_base1/sources/tester'
6
+ require 'avm/version_number'
6
7
  require 'eac_ruby_gems_utils/gem'
7
8
  require 'eac_ruby_utils/core_ext'
8
9
 
@@ -10,6 +11,7 @@ module Avm
10
11
  module EacRubyBase1
11
12
  module Sources
12
13
  class Base < ::Avm::EacGenericBase0::Sources::Base
14
+ require_sub __FILE__, include_modules: :prepend, require_dependency: true
13
15
  delegate :gemspec_path, to: :the_gem
14
16
 
15
17
  def gemfile_path
@@ -33,6 +35,15 @@ module Avm
33
35
  def update
34
36
  ::Avm::EacRubyBase1::Sources::Update.new(self)
35
37
  end
38
+
39
+ # @return [Avm::VersionNumber]
40
+ def version
41
+ the_gem.version.if_present { |v| ::Avm::VersionNumber.new(v) }
42
+ end
43
+
44
+ def version=(value)
45
+ the_gem.version_file.value = value
46
+ end
36
47
  end
37
48
  end
38
49
  end
@@ -19,7 +19,7 @@ module Avm
19
19
  # @return [EacRubyGemsUtils::Gem::Command, nil]
20
20
  def bundle_test_command
21
21
  source.read_configuration_as_shell_words(BUNDLE_TEST_COMMAND_CONFIGURATION_KEY)
22
- .if_present { |args| the_gem.bundle(*args).chdir_root }
22
+ .if_present { |args| the_gem.bundle(*args).chdir_root }
23
23
  end
24
24
 
25
25
  # @return [EacRubyGemsUtils::Gem::Command, nil]
@@ -18,7 +18,7 @@ module Avm
18
18
  if commit.no_scm_changed_files.any?
19
19
  commit = commit.reword(no_scm_update_commit_message)
20
20
  source.scm.commit_if_change { source_update.bundle_update }
21
- .if_present { |v| v.merge_with(commit) }
21
+ .if_present { |v| v.merge_with(commit) }
22
22
  else
23
23
  commit.reword(scm_update_commit_message)
24
24
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_ruby_base1/patches/i18n'
4
3
  require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.3.1'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.76'
18
18
  s.add_dependency 'eac_templates', '~> 0.2'
19
19
 
20
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
20
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
21
21
  end
@@ -35,7 +35,7 @@ module Avm
35
35
 
36
36
  def append_file_content(target_path, content)
37
37
  appended << ::Avm::Files::Appendable::FileContent
38
- .new(self, target_path, content)
38
+ .new(self, target_path, content)
39
39
  self
40
40
  end
41
41
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/files/formatter/formats/generic_plain'
4
- require 'avm/ruby/rubocop'
4
+ require 'avm/eac_ruby_base1/rubocop'
5
5
 
6
6
  module Avm
7
7
  module Files
@@ -12,7 +12,7 @@ module Avm
12
12
  VALID_TYPES = ['x-ruby'].freeze
13
13
 
14
14
  def internal_apply(files)
15
- ::Avm::Ruby::Rubocop.new('.', ['-a', '--ignore-parent-exclusion'] + files).run
15
+ ::Avm::EacRubyBase1::Rubocop.new('.', ['-a', '--ignore-parent-exclusion'] + files).run
16
16
  super(files)
17
17
  end
18
18
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Files
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.2'
6
6
  end
7
7
  end
@@ -8,9 +8,7 @@ module Avm
8
8
  module Git
9
9
  module Scms
10
10
  class GitSubrepo < ::Avm::Scms::Base
11
- def commit_if_change(_message)
12
- nyi
13
- end
11
+ delegate :commit_if_change, to: :parent_scm
14
12
 
15
13
  def update
16
14
  git_subrepo.command('clean').execute!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.3.2'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'colorize', '~> 0.8.1'
16
16
  s.add_dependency 'eac_config', '~> 0.8'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.83'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.95'
18
18
 
19
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
20
20
  end
@@ -17,7 +17,7 @@ module EacCli
17
17
  ::EacConfig::PathsHash.parse_entry_key(entry_key)
18
18
  end
19
19
  path.join('_').gsub(/[^a-z0-9_]/i, '').gsub(/\A_+/, '').gsub(/_+\z/, '')
20
- .gsub(/_{2,}/, '_').upcase
20
+ .gsub(/_{2,}/, '_').upcase
21
21
  end
22
22
  end
23
23
 
@@ -8,7 +8,7 @@ module EacCli
8
8
  enable_simple_cache
9
9
  common_constructor :options do
10
10
  self.options = options.to_h.symbolize_keys
11
- .assert_valid_keys(DEFAULT_VALUES.keys).freeze
11
+ .assert_valid_keys(DEFAULT_VALUES.keys).freeze
12
12
  end
13
13
 
14
14
  DEFAULT_VALUES = {
@@ -33,7 +33,7 @@ module EacCli
33
33
  # @return [EacCli::Definition::BaseOption] The option collected.
34
34
  def short_option_collect_char(char)
35
35
  option = find_short_option(char)
36
- raise_error "Invalid short option \"#{char}\"" unless option
36
+ raise_argv_current_invalid_option unless option
37
37
 
38
38
  option_collect_option(option)
39
39
  end
@@ -19,12 +19,12 @@ module EacCli
19
19
 
20
20
  def alternatives_parsed(error)
21
21
  alternatives.select { |a| error == a.error? }.map(&:parsed).reverse
22
- .inject(::EacRubyUtils::Struct.new) { |a, e| a.merge(e) }
22
+ .inject(::EacRubyUtils::Struct.new) { |a, e| a.merge(e) }
23
23
  end
24
24
 
25
25
  def alternatives_uncached
26
26
  definition.alternatives
27
- .map { |alternative| ::EacCli::Parser::Alternative.new(alternative, argv) }
27
+ .map { |alternative| ::EacCli::Parser::Alternative.new(alternative, argv) }
28
28
  end
29
29
 
30
30
  def first_error_uncached
@@ -1,23 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/speaker'
4
- require 'eac_ruby_utils/speaker'
3
+ require 'eac_cli/definition'
4
+ require 'eac_cli/runner/class_runner'
5
5
 
6
6
  module EacCli
7
7
  module Runner
8
8
  module AfterClassMethods
9
+ # @return [EacCli::Runner::ClassRunner]
10
+ def class_runner(runner_context_args)
11
+ ::EacCli::Runner::ClassRunner.new(self, runner_context_args)
12
+ end
13
+
9
14
  def create(*runner_context_args)
10
- r = new
11
- r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
12
- r
15
+ class_runner(runner_context_args).create
13
16
  end
14
17
 
15
18
  def run(*runner_context_args)
16
- on_asserted_speaker do
17
- r = create(*runner_context_args)
18
- r.run_run
19
- r
20
- end
19
+ class_runner(runner_context_args).run
21
20
  end
22
21
 
23
22
  def runner_definition(&block)
@@ -29,18 +28,6 @@ module EacCli
29
28
  def super_runner_definition
30
29
  superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
31
30
  end
32
-
33
- private
34
-
35
- def on_asserted_speaker
36
- if ::EacRubyUtils::Speaker.context.optional_current
37
- yield
38
- else
39
- ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
40
- yield
41
- end
42
- end
43
- end
44
31
  end
45
32
  end
46
33
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/speaker'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/speaker'
6
+
7
+ module EacCli
8
+ module Runner
9
+ class ClassRunner
10
+ PARSER_ERROR_EXIT_CODE = 1
11
+
12
+ common_constructor :klass, :context_args
13
+
14
+ def create
15
+ r = klass.new
16
+ r.runner_context = ::EacCli::Runner::Context.new(r, *context_args)
17
+ r
18
+ end
19
+
20
+ def run
21
+ on_asserted_speaker do
22
+ r = create
23
+ begin
24
+ r.run_run
25
+ rescue ::EacCli::Parser::Error => e
26
+ run_parser_error(r, e)
27
+ end
28
+ r
29
+ end
30
+ end
31
+
32
+ def run_parser_error(runner_instance, error)
33
+ $stderr.write("#{runner_instance.program_name}: #{error}\n")
34
+ ::Kernel.exit(PARSER_ERROR_EXIT_CODE)
35
+ end
36
+
37
+ private
38
+
39
+ def on_asserted_speaker
40
+ if ::EacRubyUtils::Speaker.context.optional_current
41
+ yield
42
+ else
43
+ ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
44
+ yield
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end