avm-tools 0.68.0 → 0.70.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/data/instance/files_unit.rb +1 -1
  3. data/lib/avm/eac_rails_base0/apache_host.rb +17 -0
  4. data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
  5. data/lib/avm/eac_rails_base0/deploy.rb +51 -0
  6. data/lib/avm/eac_rails_base0/instance.rb +14 -0
  7. data/lib/avm/eac_redmine_base0/deploy.rb +4 -4
  8. data/lib/avm/eac_redmine_base0/instance.rb +6 -5
  9. data/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
  10. data/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
  11. data/lib/avm/eac_ubuntu_base0/docker_image.rb +14 -0
  12. data/lib/avm/eac_webapp_base0/apache_host.rb +103 -0
  13. data/lib/avm/eac_webapp_base0/deploy.rb +102 -0
  14. data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +25 -0
  15. data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +42 -0
  16. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +49 -0
  17. data/lib/avm/eac_webapp_base0/deploy/version.rb +20 -0
  18. data/lib/avm/eac_webapp_base0/instance.rb +50 -0
  19. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +39 -0
  20. data/lib/avm/eac_webapp_base0/runner/data.rb +25 -0
  21. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +69 -0
  22. data/lib/avm/eac_webapp_base0/runner/data/load.rb +66 -0
  23. data/lib/avm/eac_webapp_base0/runner/deploy.rb +59 -0
  24. data/lib/avm/git/issue/complete/_git_subrepos.rb +1 -0
  25. data/lib/avm/instances/base/auto_values/filesystem.rb +3 -1
  26. data/lib/avm/instances/entries.rb +5 -8
  27. data/lib/avm/instances/entry.rb +47 -0
  28. data/lib/avm/instances/entry_keys.rb +2 -0
  29. data/lib/avm/self/instance.rb +1 -1
  30. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +3 -3
  31. data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +2 -2
  32. data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +2 -2
  33. data/lib/avm/tools/runner/eac_rails_base0.rb +9 -14
  34. data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +3 -26
  35. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
  36. data/lib/avm/tools/runner/eac_rails_base0/data.rb +2 -2
  37. data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +3 -3
  38. data/lib/avm/tools/runner/eac_redmine_base0/data.rb +1 -1
  39. data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +2 -2
  40. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +2 -2
  41. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +1 -0
  42. data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +3 -25
  43. data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +2 -2
  44. data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +2 -2
  45. data/lib/avm/tools/runner/git/deploy.rb +3 -1
  46. data/lib/avm/tools/version.rb +1 -1
  47. data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
  48. data/template/avm/{stereotypes/eac_rails_base0 → eac_rails_base0}/deploy/config/database.yml.template +0 -0
  49. data/template/avm/{stereotypes/eac_webapp_base0 → eac_webapp_base0}/apache_host/no_ssl.conf +0 -0
  50. data/template/avm/self/docker_image/Dockerfile +1 -1
  51. data/vendor/eac_cli/Gemfile +5 -0
  52. data/vendor/eac_cli/eac_cli.gemspec +18 -0
  53. data/vendor/eac_cli/lib/eac_cli.rb +7 -0
  54. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
  55. data/vendor/eac_cli/lib/eac_cli/default_runner.rb +14 -0
  56. data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
  57. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
  58. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -0
  59. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
  60. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +27 -0
  61. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +77 -0
  62. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +45 -0
  63. data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
  64. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
  65. data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
  66. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
  67. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
  68. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
  69. data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
  70. data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
  71. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
  72. data/vendor/eac_cli/lib/eac_cli/runner.rb +87 -0
  73. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
  74. data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
  75. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
  76. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
  77. data/vendor/eac_cli/lib/eac_cli/version.rb +5 -0
  78. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
  79. data/vendor/eac_cli/spec/rubocop_spec.rb +7 -0
  80. data/vendor/eac_cli/spec/spec_helper.rb +100 -0
  81. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  82. data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo +9 -7
  83. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
  84. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +5 -1
  85. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  86. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +10 -0
  87. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +6 -5
  88. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +5 -34
  89. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +42 -0
  90. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
  91. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  92. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
  93. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +8 -2
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
  100. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
  101. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
  102. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +53 -0
  104. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  105. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
  106. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
  107. metadata +66 -22
  108. data/lib/avm/instances/entries/entry_reader.rb +0 -45
  109. data/lib/avm/stereotypes/eac_rails_base0/apache_host.rb +0 -19
  110. data/lib/avm/stereotypes/eac_rails_base0/deploy.rb +0 -52
  111. data/lib/avm/stereotypes/eac_rails_base0/instance.rb +0 -16
  112. data/lib/avm/stereotypes/eac_ubuntu_base0/apache.rb +0 -27
  113. data/lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb +0 -61
  114. data/lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb +0 -16
  115. data/lib/avm/stereotypes/eac_webapp_base0/apache_host.rb +0 -97
  116. data/lib/avm/stereotypes/eac_webapp_base0/deploy.rb +0 -104
  117. data/lib/avm/stereotypes/eac_webapp_base0/deploy/appended_directories.rb +0 -27
  118. data/lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb +0 -43
  119. data/lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb +0 -51
  120. data/lib/avm/stereotypes/eac_webapp_base0/deploy/version.rb +0 -22
  121. data/lib/avm/stereotypes/eac_webapp_base0/instance.rb +0 -52
  122. data/lib/avm/stereotypes/eac_webapp_base0/runner/data.rb +0 -27
  123. data/lib/avm/stereotypes/eac_webapp_base0/runner/data/dump.rb +0 -71
  124. data/lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb +0 -68
  125. data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +0 -61
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
+
5
+ RSpec.describe ::RuboCop, slow: true do
6
+ include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ # # This allows you to limit a spec run to individual examples or groups
52
+ # # you care about by tagging them with `:focus` metadata. When nothing
53
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
54
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
55
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
56
+ # config.filter_run_when_matching :focus
57
+ #
58
+ # # Allows RSpec to persist some state between runs in order to support
59
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
60
+ # # you configure your source control system to ignore this file.
61
+ # config.example_status_persistence_file_path = "spec/examples.txt"
62
+ #
63
+ # # Limits the available syntax to the non-monkey patched syntax that is
64
+ # # recommended. For more details, see:
65
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
66
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
68
+ # config.disable_monkey_patching!
69
+ #
70
+ # # This setting enables warnings. It's recommended, but in some cases may
71
+ # # be too noisy due to issues in dependencies.
72
+ # config.warnings = true
73
+ #
74
+ # # Many RSpec users commonly either run the entire suite or an individual
75
+ # # file, and it's useful to allow more verbose output when running an
76
+ # # individual spec file.
77
+ # if config.files_to_run.one?
78
+ # # Use the documentation formatter for detailed output,
79
+ # # unless a formatter has already been configured
80
+ # # (e.g. via a command-line flag).
81
+ # config.default_formatter = "doc"
82
+ # end
83
+ #
84
+ # # Print the 10 slowest examples and example groups at the
85
+ # # end of the spec run, to help surface which specs are running
86
+ # # particularly slow.
87
+ # config.profile_examples = 10
88
+ #
89
+ # # Run specs in random order to surface order dependencies. If you find an
90
+ # # order dependency and want to debug it, you can fix the order by providing
91
+ # # the seed, which is printed after each run.
92
+ # # --seed 1234
93
+ # config.order = :random
94
+ #
95
+ # # Seed global randomization in this process using the `--seed` CLI option.
96
+ # # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # # test failures related to randomization by passing the same `--seed` value
98
+ # # as the one that triggered the failure.
99
+ # Kernel.srand config.seed
100
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
@@ -8,6 +8,8 @@
8
8
  # Exit on any errors:
9
9
  set -e
10
10
 
11
+ export FILTER_BRANCH_SQUELCH_WARNING=1
12
+
11
13
  # Import Bash+ helper functions:
12
14
  SOURCE="$BASH_SOURCE"
13
15
  while [[ -h $SOURCE ]]; do
@@ -549,7 +551,7 @@ subrepo:pull() {
549
551
  fi
550
552
  else
551
553
  o "Merge in changes from $refs_subrepo_fetch"
552
- FAIL=false OUT=true RUN git merge "$refs_subrepo_fetch"
554
+ FAIL=false RUN git merge "$refs_subrepo_fetch"
553
555
  if ! OK; then
554
556
  say "The \"git merge\" command failed:"
555
557
  say
@@ -765,8 +767,8 @@ subrepo:branch() {
765
767
  o "Create with content"
766
768
  local PREVIOUS_IFS=$IFS
767
769
  IFS=$'\n'
768
- local author_info=( $(git log -1 --format=%ad%n%ae%n%an "$commit") )
769
- local commiter_info=( $(git log -1 --format=%cd%n%ce%n%cn "$commit") )
770
+ local author_info=( $(git log -1 --date=default --format=%ad%n%ae%n%an "$commit") )
771
+ local commiter_info=( $(git log -1 --date=default --format=%cd%n%ce%n%cn "$commit") )
770
772
  IFS=$PREVIOUS_IFS
771
773
 
772
774
  # When we create new commits we leave the author information unchanged
@@ -774,7 +776,7 @@ subrepo:branch() {
774
776
  # This should be analog how cherrypicking is handled allowing git
775
777
  # to store both the original author but also the responsible committer
776
778
  # that created the local version of the commit and pushed it.
777
- prev_commit=$(git log -n 1 --format=%B "$commit" |
779
+ prev_commit=$(git log -n 1 --date=default --format=%B "$commit" |
778
780
  GIT_AUTHOR_DATE="${author_info[0]}" \
779
781
  GIT_AUTHOR_EMAIL="${author_info[1]}" \
780
782
  GIT_AUTHOR_NAME="${author_info[2]}" \
@@ -959,7 +961,7 @@ subrepo:clean() {
959
961
 
960
962
  o "Clean $subdir"
961
963
  git:remove-worktree
962
- if [[ -e .git/$ref ]]; then
964
+ if git:branch-exists "$branch"; then
963
965
  o "Remove branch '$branch'."
964
966
  RUN git update-ref -d "$ref"
965
967
  clean_list+=("branch '$branch'")
@@ -1505,7 +1507,7 @@ assert-subdir-ready-for-init() {
1505
1507
  error "The subdir '$subdir' is already a subrepo."
1506
1508
  fi
1507
1509
  # Check that subdir is part of the repo
1508
- if [[ -z $(git log -1 -- $subdir) ]]; then
1510
+ if [[ -z $(git log -1 --date=default -- $subdir) ]]; then
1509
1511
  error "The subdir '$subdir' is not part of this repo."
1510
1512
  fi
1511
1513
  }
@@ -1535,7 +1537,7 @@ get-all-subrepos() {
1535
1537
  add-subrepo() {
1536
1538
  if ! $ALL_wanted; then
1537
1539
  for path in "${subrepos[@]}"; do
1538
- [[ $1 =~ ^$path ]] && return
1540
+ [[ $1/ =~ ^$path/ ]] && return
1539
1541
  done
1540
1542
  fi
1541
1543
  subrepos+=("$1")
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'eac_cli', '~> 0.3'
16
- s.add_dependency 'eac_ruby_gems_utils', '~> 0.6'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.39'
15
+ s.add_dependency 'eac_cli', '~> 0.7'
16
+ s.add_dependency 'eac_ruby_gems_utils', '~> 0.7', '>= 0.7.2'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.46'
18
18
 
19
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
20
20
  end
@@ -28,8 +28,12 @@ module EacRubyBase0
28
28
  end
29
29
  end
30
30
 
31
+ def application_version
32
+ context(:application).version.to_s
33
+ end
34
+
31
35
  def show_version
32
- out(context(:application).version + "\n")
36
+ out("#{application_version}\n")
33
37
  end
34
38
  end
35
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_utils/envs'
5
+ require 'rubygems'
5
6
 
6
7
  module EacRubyGemsUtils
7
8
  class Gem
@@ -22,6 +23,11 @@ module EacRubyGemsUtils
22
23
  ::EacRubyGemsUtils::Gem::Command.new(self, %w[bundle] + args).envvar_gemfile
23
24
  end
24
25
 
26
+ # @return A [Pathname] array with relative paths from root listed in gemspec's .file directive.
27
+ def files
28
+ gemspec.files.map(&:to_pathname)
29
+ end
30
+
25
31
  def gemfile_lock_gem_version(gem_name)
26
32
  gemfile_lock_content.specs.find { |gem| gem.name == gem_name }.if_present(&:version)
27
33
  end
@@ -67,6 +73,10 @@ module EacRubyGemsUtils
67
73
  gemfile_path.basename_sub { |b| "#{b}.lock" }
68
74
  end
69
75
 
76
+ def gemspec_uncached
77
+ ::Gem::Specification.load(gemspec_path.to_path)
78
+ end
79
+
70
80
  def gemspec_path_uncached
71
81
  ::Pathname.glob("#{root.to_path}/*#{GEMSPEC_EXTNAME}").first
72
82
  end
@@ -10,11 +10,7 @@ module EacRubyGemsUtils
10
10
  VERSION_LINE_PATTERN = /\A(\s*)VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"](\s*)\z/.freeze
11
11
 
12
12
  def value
13
- path.read.each_line do |line|
14
- VERSION_LINE_PATTERN.if_match(line.rstrip, false) do |m|
15
- ::Gem::Version.new(m[2])
16
- end
17
- end
13
+ path.read.each_line.lazy.map { |line| line_value(line) }.find { |v| v }
18
14
  end
19
15
 
20
16
  def value=(new_value)
@@ -23,6 +19,11 @@ module EacRubyGemsUtils
23
19
 
24
20
  private
25
21
 
22
+ # @return Version found in line, nil otherwise.
23
+ def line_value(line)
24
+ VERSION_LINE_PATTERN.if_match(line.rstrip, false) { |m| ::Gem::Version.new(m[2]) }
25
+ end
26
+
26
27
  def new_value_content(new_value)
27
28
  path.read.each_line
28
29
  .map { |line| new_value_line(line, new_value) }
@@ -7,6 +7,7 @@ require 'eac_ruby_utils/core_ext'
7
7
  module EacRubyGemsUtils
8
8
  module Tests
9
9
  class Multiple
10
+ require_sub __FILE__
10
11
  enable_console_speaker
11
12
  enable_simple_cache
12
13
  common_constructor :gems, :options, default: [{}]
@@ -26,14 +27,9 @@ module EacRubyGemsUtils
26
27
  decorated_gems.flat_map(&:tests)
27
28
  end
28
29
 
29
- def bundle_all_gems
30
- infom 'Bundling all gems...'
31
- decorated_gems.each do |gem|
32
- next unless gem.gemfile_path.exist?
33
-
34
- infov 'Bundle install', gem
35
- gem.bundle.execute!
36
- end
30
+ def prepare_all_gems
31
+ infom 'Preparing all gems...'
32
+ decorated_gems.each(&:prepare)
37
33
  end
38
34
 
39
35
  def decorated_gems_uncached
@@ -61,7 +57,7 @@ module EacRubyGemsUtils
61
57
 
62
58
  def run
63
59
  start_banner
64
- bundle_all_gems
60
+ prepare_all_gems
65
61
  test_all_gems
66
62
  final_results_banner
67
63
  end
@@ -76,31 +72,6 @@ module EacRubyGemsUtils
76
72
  infov test, Result.new(test.result).tag
77
73
  end
78
74
  end
79
-
80
- class DecoratedGem < ::SimpleDelegator
81
- def tests
82
- [::EacRubyGemsUtils::Tests::Minitest.new(__getobj__),
83
- ::EacRubyGemsUtils::Tests::Rspec.new(__getobj__)]
84
- end
85
- end
86
-
87
- class Result
88
- common_constructor :result
89
-
90
- COLORS = {
91
- ::EacRubyGemsUtils::Tests::Base::RESULT_FAILED => :red,
92
- ::EacRubyGemsUtils::Tests::Base::RESULT_NONEXISTENT => :white,
93
- ::EacRubyGemsUtils::Tests::Base::RESULT_SUCCESSFUL => :green
94
- }.freeze
95
-
96
- def tag
97
- result.to_s.send(color)
98
- end
99
-
100
- def color
101
- COLORS.fetch(result)
102
- end
103
- end
104
75
  end
105
76
  end
106
77
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyGemsUtils
4
+ module Tests
5
+ class Multiple
6
+ class DecoratedGem < ::SimpleDelegator
7
+ enable_console_speaker
8
+
9
+ def prepare
10
+ return unless gemfile_path.exist?
11
+
12
+ log('running "bundle install"...')
13
+ return if bundle('install').execute.fetch(:exit_code).zero?
14
+
15
+ if can_remove_gemfile_lock?
16
+ log('"bundle install" failed, removing Gemfile.lock and trying again...')
17
+ gemfile_lock_path.unlink if gemfile_lock_path.exist?
18
+ bundle('install').execute!
19
+ else
20
+ raise '"bundle install" failed and the Gemfile.lock is part of gem' \
21
+ '(Should be changed by developer)'
22
+ end
23
+ end
24
+
25
+ def tests
26
+ [::EacRubyGemsUtils::Tests::Minitest.new(__getobj__),
27
+ ::EacRubyGemsUtils::Tests::Rspec.new(__getobj__)]
28
+ end
29
+
30
+ private
31
+
32
+ def log(message)
33
+ infov self, message
34
+ end
35
+
36
+ def can_remove_gemfile_lock?
37
+ !files.include?(gemfile_lock_path.relative_path_from(root))
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyGemsUtils
4
+ module Tests
5
+ class Multiple
6
+ class Result
7
+ common_constructor :result
8
+
9
+ COLORS = {
10
+ ::EacRubyGemsUtils::Tests::Base::RESULT_FAILED => :red,
11
+ ::EacRubyGemsUtils::Tests::Base::RESULT_NONEXISTENT => :white,
12
+ ::EacRubyGemsUtils::Tests::Base::RESULT_SUCCESSFUL => :green
13
+ }.freeze
14
+
15
+ def tag
16
+ result.to_s.send(color)
17
+ end
18
+
19
+ def color
20
+ COLORS.fetch(result)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.2'
5
5
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_gems_utils/gem'
4
+
5
+ ::RSpec.describe ::EacRubyGemsUtils::Gem::VersionFile do
6
+ let(:stubs_dir) { ::Pathname.new(__dir__).join('version_file_spec_files') }
7
+ let(:stub_file) { stubs_dir.join('a_version_file.rb') }
8
+ let(:instance) { described_class.new(stub_file) }
9
+ let(:target_version) { ::Gem::Version.new('0.69.1') }
10
+
11
+ describe '#value' do
12
+ it { expect(instance.value).to eq(target_version) }
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Tools
5
+ VERSION = '0.69.1'
6
+ end
7
+ end
@@ -21,10 +21,10 @@ module EacRubyUtils
21
21
 
22
22
  class Setup
23
23
  include ::EacRubyUtils::SimpleCache
24
- attr_reader :a_module, :common_constructor
24
+ attr_reader :a_module, :common_concern
25
25
 
26
- def initialize(common_constructor, a_module)
27
- @common_constructor = common_constructor
26
+ def initialize(common_concern, a_module)
27
+ @common_concern = common_concern
28
28
  @a_module = a_module
29
29
  end
30
30
 
@@ -47,7 +47,7 @@ module EacRubyUtils
47
47
  end
48
48
 
49
49
  def setup_after_callback(base)
50
- common_constructor.after_callback.if_present do |v|
50
+ common_concern.after_callback.if_present do |v|
51
51
  base.instance_eval(&v)
52
52
  end
53
53
  end