avm-tools 0.113.3 → 0.114.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/launcher/context.rb +19 -8
  3. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +2 -2
  4. data/lib/avm/tools/runner/self.rb +2 -2
  5. data/lib/avm/tools/self.rb +0 -13
  6. data/lib/avm/tools/version.rb +1 -1
  7. data/sub/avm/lib/avm/instances/base/auto_values/data.rb +2 -2
  8. data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +6 -8
  9. data/sub/avm/lib/avm/instances/entry.rb +10 -4
  10. data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
  11. data/sub/avm/lib/avm/self/instance.rb +8 -0
  12. data/sub/avm/lib/avm/version.rb +1 -1
  13. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +0 -1
  14. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb +2 -0
  15. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  16. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_path_spec.rb +1 -1
  17. data/sub/avm-eac_rails_base0/spec/spec_helper.rb +1 -5
  18. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  19. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  20. data/sub/avm-git/avm-git.gemspec +1 -1
  21. data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +3 -3
  22. data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +1 -1
  23. data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +13 -6
  24. data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +3 -3
  25. data/sub/avm-git/lib/avm/git/issue/complete/push.rb +15 -9
  26. data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +2 -2
  27. data/sub/avm-git/lib/avm/git/issue/complete/test.rb +1 -1
  28. data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +1 -1
  29. data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +13 -5
  30. data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +1 -1
  31. data/sub/avm-git/lib/avm/git/issue/complete.rb +22 -7
  32. data/sub/avm-git/lib/avm/git/revision_test.rb +1 -1
  33. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  34. data/sub/eac_cli/eac_cli.gemspec +2 -2
  35. data/sub/eac_cli/lib/eac_cli/config/entry/options.rb +1 -1
  36. data/sub/eac_cli/lib/eac_cli/config/entry/undefined.rb +1 -1
  37. data/sub/eac_cli/lib/eac_cli/config/entry.rb +5 -1
  38. data/sub/eac_cli/lib/eac_cli/rspec/setup.rb +42 -0
  39. data/sub/eac_cli/lib/eac_cli/rspec.rb +9 -0
  40. data/sub/eac_cli/lib/eac_cli/speaker/constants.rb +13 -0
  41. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  42. data/sub/eac_config/eac_config.gemspec +1 -1
  43. data/sub/eac_config/lib/eac_config/entry.rb +4 -0
  44. data/sub/eac_config/lib/eac_config/node_entry.rb +4 -0
  45. data/sub/eac_config/lib/eac_config/rspec/setup.rb +19 -3
  46. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  47. data/sub/eac_fs/lib/eac_fs/cached_download.rb +1 -1
  48. data/sub/eac_fs/lib/eac_fs/contexts.rb +21 -0
  49. data/sub/eac_fs/lib/eac_fs/logs/file.rb +4 -0
  50. data/sub/eac_fs/lib/eac_fs/logs.rb +5 -0
  51. data/sub/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +9 -4
  52. data/sub/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +16 -6
  53. data/sub/eac_fs/lib/eac_fs/{cache.rb → storage_tree.rb} +6 -8
  54. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  55. data/sub/eac_fs/spec/lib/eac_fs/{cache_spec.rb → storage_tree_spec.rb} +5 -5
  56. data/sub/eac_git/eac_git.gemspec +1 -1
  57. data/sub/eac_git/lib/eac_git/local/branch.rb +27 -0
  58. data/sub/eac_git/lib/eac_git/local/commit.rb +1 -0
  59. data/sub/eac_git/lib/eac_git/local/remotes.rb +20 -0
  60. data/sub/eac_git/lib/eac_git/local.rb +18 -0
  61. data/sub/eac_git/lib/eac_git/version.rb +1 -1
  62. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
  63. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +9 -5
  64. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec/setup.rb +14 -0
  65. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec.rb +9 -0
  66. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +28 -9
  67. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  68. data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  69. data/sub/eac_ruby_utils/lib/eac_ruby_utils/context.rb +2 -0
  70. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/to_struct.rb +10 -0
  71. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/if_exist.rb +10 -0
  72. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/readlink_r.rb +11 -0
  73. data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/stub_speaker.rb +39 -0
  74. data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +7 -0
  75. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  76. metadata +28 -19
  77. data/sub/eac_cli/lib/eac_cli/old_configs_bridge.rb +0 -39
  78. data/sub/eac_cli/lib/eac_cli/speaker/_constants.rb +0 -12
  79. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3df7ad19d9031c2e3d94cb8051798479282760386da32c55533f461a85d51580
4
- data.tar.gz: 69fe1de1ee67d5000c1a56aae122d1bf98e55a65b175616c73e9a99d28c4d472
3
+ metadata.gz: ab94e9f5fae951a039dc33fadb807fa8331899a843526fa957beeb05193a8419
4
+ data.tar.gz: ebb72038ffaa5b8c9c37d20e8b7a6de6b6303886665940474c36318804cdc600
5
5
  SHA512:
6
- metadata.gz: 92453344e1eb2751ed5d653cb11fea487284315750b9e61e3044da5883c9aed8ec46d1ab5979489c1c733ed963ab844ede90a4bf81dbb0f1e8c6414bb35fceab
7
- data.tar.gz: c882830e166e9f7f59b1fca59d3658afccd2e3ad9dc6bf8929af4dae6a2ae6531537a9c97e924fdcd450c342d276b8d6029f917735c71702de8c9304884545ef
6
+ metadata.gz: b25329ca5da5c3aeda2bd26b9f2cf91edadfe965e3eba3e891eb590a3b7a9483870b80e45b2e804eb44d56877445c1da00a98b75b9c8feac81fb44165020e21a
7
+ data.tar.gz: bf211cebb15418b176c681020f825e64ba8d12cecd3d2022b3026326fcc3d062e846c763143b75cf17a2d38f7c71b244b4748166deb3cc873fe61eac319afc3b
@@ -8,6 +8,7 @@ require 'avm/launcher/context/instance_discovery'
8
8
  require 'avm/launcher/context/settings'
9
9
  require 'avm/launcher/paths/logical'
10
10
  require 'avm/launcher/project'
11
+ require 'avm/tools/self'
11
12
 
12
13
  module Avm
13
14
  module Launcher
@@ -15,10 +16,6 @@ module Avm
15
16
  include ::EacRubyUtils::SimpleCache
16
17
  enable_speaker
17
18
 
18
- DEFAULT_PROJECTS_ROOT = '.'
19
- DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
20
- DEFAULT_CACHE_ROOT = ::File.join(ENV['HOME'], '.cache', 'eac_launcher')
21
-
22
19
  class << self
23
20
  attr_writer :current
24
21
 
@@ -34,6 +31,8 @@ module Avm
34
31
  attr_reader :root, :settings, :cache_root
35
32
  attr_accessor :publish_options, :recache, :instance_manager
36
33
 
34
+ CONFIG_PATH_PREFIX = 'launcher'
35
+
37
36
  def initialize(options = {})
38
37
  @options = options.with_indifferent_access
39
38
  @root = ::Avm::Launcher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
@@ -59,15 +58,27 @@ module Avm
59
58
  private
60
59
 
61
60
  def build_option(key)
62
- @options[key] || env_option(key) || default_option(key)
61
+ @options[key] || config_option(key) || default_option(key)
62
+ end
63
+
64
+ def config_option(key)
65
+ ::Avm::Self::Instance.default.entry([CONFIG_PATH_PREFIX, key].join('.')).optional_value
63
66
  end
64
67
 
65
- def env_option(key)
66
- ENV["EAC_LAUNCHER_#{key}".underscore.upcase]
68
+ def default_cache_root
69
+ ::Avm::Tools::Self.application.cache_dir.join('launcher')
67
70
  end
68
71
 
69
72
  def default_option(key)
70
- self.class.const_get("DEFAULT_#{key}".underscore.upcase)
73
+ send("default_#{key}".underscore)
74
+ end
75
+
76
+ def default_projects_root
77
+ '.'
78
+ end
79
+
80
+ def default_settings_file
81
+ ::Avm::Tools::Self.application.config_dir.join('launcher.yaml')
71
82
  end
72
83
 
73
84
  def projects_uncached
@@ -17,7 +17,7 @@ module Avm
17
17
 
18
18
  def run
19
19
  infov 'Cache path', fs_cache.content_path
20
- infov 'Cached?', fs_cache.cached?
20
+ infov 'Cached?', fs_cache.stored?
21
21
  parser.gems_in_conflict.each do |gem_in_conflict|
22
22
  print_gem_in_conflict(gem_in_conflict)
23
23
  end
@@ -31,7 +31,7 @@ module Avm
31
31
  end
32
32
 
33
33
  def content_path
34
- fs_cache.write(bundle_update) unless fs_cache.cached? && parsed.last?
34
+ fs_cache.write(bundle_update) unless fs_cache.stored? && parsed.last?
35
35
  fs_cache.content_path
36
36
  end
37
37
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/tools/core_ext'
4
- require 'avm/tools/self'
4
+ require 'avm/self/instance'
5
5
 
6
6
  module Avm
7
7
  module Tools
@@ -14,7 +14,7 @@ module Avm
14
14
  end
15
15
 
16
16
  def instance
17
- ::Avm::Tools::Self.instance
17
+ ::Avm::Self::Instance.default
18
18
  end
19
19
  end
20
20
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/old_configs_bridge'
4
3
  require 'eac_ruby_base0/application'
5
4
  require 'eac_ruby_utils/require_sub'
6
5
  require 'avm/instances/base'
@@ -15,18 +14,6 @@ module Avm
15
14
  @application ||= ::EacRubyBase0::Application.new(root.to_path)
16
15
  end
17
16
 
18
- # @return [EacCli::OldConfigsBridge]
19
- def build_config(path = nil)
20
- ::EacCli::OldConfigsBridge.new(
21
- application.name,
22
- path.if_present({}) { |v| { storage_path: v } }
23
- )
24
- end
25
-
26
- def instance
27
- @instance ||= ::Avm::Tools::Self::Instance.by_id('avm-tools_self')
28
- end
29
-
30
17
  def root
31
18
  ::Pathname.new('../../..').expand_path(__dir__)
32
19
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.113.3'
5
+ VERSION = '0.114.0'
6
6
  end
7
7
  end
@@ -9,8 +9,8 @@ module Avm
9
9
  module AutoValues
10
10
  module Data
11
11
  def auto_data_default_dump_path
12
- ::Avm::Self
13
- .instance
12
+ ::Avm::Self::Instance
13
+ .default
14
14
  .read_entry_optional(::Avm::Self::Instance::EntryKeys::DATA_DEFAULT_PATH)
15
15
  .if_present do |v|
16
16
  ::File.join(
@@ -1,22 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
4
+
3
5
  module Avm
4
6
  module Instances
5
7
  class Base
6
8
  module AutoValues
7
9
  module Filesystem
8
- FS_PATH_KEY = :fs_path
9
-
10
10
  def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, FS_PATH_KEY) do |v|
12
- v + '/' + id
13
- end
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
12
+ ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
14
13
  end
15
14
 
16
15
  def auto_data_fs_path
17
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, :data_fs_path) do |v|
18
- v + '/' + id
19
- end
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
17
+ ::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
20
18
  end
21
19
 
22
20
  def auto_fs_url
@@ -27,11 +27,11 @@ module Avm
27
27
  end
28
28
 
29
29
  def optional_value
30
- read(required: false, noinput: true) || auto_value
30
+ context_entry.found? ? context_entry.value : auto_value
31
31
  end
32
32
 
33
- def read(extra_options = {})
34
- ::EacConfig::Node.context.current.entry(full_path, options.merge(extra_options)).value
33
+ def read
34
+ context_entry.value
35
35
  end
36
36
 
37
37
  def suffix_as_array
@@ -47,7 +47,13 @@ module Avm
47
47
  end
48
48
 
49
49
  def write(value)
50
- ::EacConfig::Node.context.current.entry(full_path).value = value
50
+ context_entry.value = value
51
+ end
52
+
53
+ private
54
+
55
+ def context_entry
56
+ ::EacConfig::Node.context.current.entry(full_path)
51
57
  end
52
58
  end
53
59
  end
@@ -42,7 +42,7 @@ module Avm
42
42
  end
43
43
 
44
44
  {
45
- '' => %w[fs_path host_id name source_instance_id],
45
+ '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
46
  database: %w[id hostname limit name password port system timeout username extra],
47
47
  docker: %w[registry],
48
48
  mailer: {
@@ -8,6 +8,14 @@ require 'avm/eac_ubuntu_base0/docker_image'
8
8
  module Avm
9
9
  module Self
10
10
  class Instance < ::Avm::Instances::Base
11
+ DEFAULT_INSTANCE_ID = 'avm_self'
12
+
13
+ class << self
14
+ def default
15
+ @default ||= by_id(DEFAULT_INSTANCE_ID)
16
+ end
17
+ end
18
+
11
19
  def docker_image_class
12
20
  ::Avm::Self::DockerImage
13
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.12.1'
4
+ VERSION = '0.14.0'
5
5
  end
@@ -15,6 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'avm-eac_rails_base1', '~> 0.1', '>= 0.1.3'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.80', '>= 0.80.2'
17
17
 
18
- s.add_development_dependency 'eac_cli', '~> 0.24', '~> 0.24.1'
19
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
20
19
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'avm/eac_rails_base0/instance'
4
4
  require 'avm/eac_rails_base0/deploy'
5
+ require 'avm/eac_rails_base0/apache_host'
6
+ require 'avm/eac_rails_base0/apache_path'
5
7
  require 'avm/eac_rails_base1/runner'
6
8
  require 'eac_ruby_utils/core_ext'
7
9
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ RSpec.describe ::Avm::EacRailsBase0::ApachePath do
12
12
  let(:expected_content) { expect_file.read }
13
13
 
14
14
  before do
15
- instance.entry(::Avm::Instances::Base::FS_PATH_KEY).write('/path/to/stub-app_0')
15
+ instance.entry(::Avm::Instances::EntryKeys::FS_PATH).write('/path/to/stub-app_0')
16
16
  instance.entry('web.url').write('http://stubapp.net/stub-app_0')
17
17
  end
18
18
 
@@ -2,8 +2,4 @@
2
2
 
3
3
  require 'eac_ruby_utils/rspec/default_setup'
4
4
  ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
5
-
6
- require 'eac_cli/old_configs_bridge'
7
- ::EacRubyUtils::Rspec.default_setup.stub_eac_config_node do |file|
8
- ::EacCli::OldConfigsBridge.new(file)
9
- end
5
+ ::EacRubyUtils::Rspec.default_setup.stub_eac_config_node
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Files
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'avm-files', '~> 0.1'
16
- s.add_dependency 'eac_git', '~> 0.9'
16
+ s.add_dependency 'eac_git', '~> 0.11'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.76'
18
18
 
19
19
  s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
@@ -15,7 +15,7 @@ module Avm
15
15
  return [] unless branch_hash && follow_master?
16
16
 
17
17
  interval = remote_master_hash ? "#{remote_master_hash}..#{branch_hash}" : branch_hash
18
- @git.execute!('rev-list', interval).each_line.map(&:strip)
18
+ launcher_git.execute!('rev-list', interval).each_line.map(&:strip)
19
19
  end
20
20
 
21
21
  def bifurcations_result
@@ -32,8 +32,8 @@ module Avm
32
32
  end
33
33
 
34
34
  def commit_parents(commit)
35
- @git.execute!('log', '--pretty=%P', '-n', '1', commit).split(' ').map(&:strip)
36
- .select(&:present?)
35
+ launcher_git.execute!('log', '--pretty=%P', '-n', '1', commit).split(' ').map(&:strip)
36
+ .select(&:present?)
37
37
  end
38
38
  end
39
39
  end
@@ -12,7 +12,7 @@ module Avm
12
12
  return ::Avm::Result.error('Unclean workspace') unless clean_workspace?
13
13
 
14
14
  infom 'Checking Git subrepos...'
15
- r = ::Avm::Git::SubrepoChecks.new(::EacGit::Local.new(@git)).add_all_subrepos
15
+ r = ::Avm::Git::SubrepoChecks.new(::EacGit::Local.new(launcher_git)).add_all_subrepos
16
16
  r.check_remote = true
17
17
  r.result
18
18
  end
@@ -7,16 +7,21 @@ module Avm
7
7
  module Issue
8
8
  class Complete
9
9
  module LocalBranch
10
+ NO_CURRENT_BRANCH_NAME = 'none'
11
+
12
+ # Retrieves the current local branch.
13
+ #
14
+ # @return [EacGit::Local::Branch, nil]
10
15
  def branch_uncached
11
- @git.current_branch
16
+ eac_git.current_branch
12
17
  end
13
18
 
14
19
  def branch_hash_uncached
15
- @git.rev_parse("refs/heads/#{branch}")
20
+ branch.if_present(&:current_commit_id)
16
21
  end
17
22
 
18
23
  def branch_name
19
- branch.split('/')[-1]
24
+ branch.if_present(NO_CURRENT_BRANCH_NAME, &:name)
20
25
  end
21
26
 
22
27
  def branch_name_result
@@ -38,14 +43,16 @@ module Avm
38
43
  end
39
44
 
40
45
  def follow_master?
41
- remote_master_hash ? @git.descendant?(branch_hash, remote_master_hash) : true
46
+ remote_master_hash ? launcher_git.descendant?(branch_hash, remote_master_hash) : true
42
47
  end
43
48
 
44
49
  def remove_local_branch
50
+ return unless branch
51
+
45
52
  info 'Removendo branch local...'
46
53
  bn = branch_name
47
- git(['checkout', branch_hash])
48
- git(['branch', '-D', bn])
54
+ git_execute(['checkout', branch_hash])
55
+ git_execute(['branch', '-D', bn])
49
56
  end
50
57
  end
51
58
  end
@@ -18,7 +18,7 @@ module Avm
18
18
 
19
19
  def delete_tag
20
20
  info 'Removendo tag...'
21
- git(['tag', '-d', branch_name])
21
+ git_execute(['tag', '-d', branch_name])
22
22
  end
23
23
 
24
24
  def tag
@@ -26,11 +26,11 @@ module Avm
26
26
  end
27
27
 
28
28
  def tag_hash
29
- @git.rev_parse(tag)
29
+ launcher_git.rev_parse(tag)
30
30
  end
31
31
 
32
32
  def create_tag
33
- git(['tag', branch_name, branch_hash])
33
+ git_execute(['tag', branch_name, branch_hash])
34
34
  end
35
35
  end
36
36
  end
@@ -12,13 +12,7 @@ module Avm
12
12
  def dry_push_result
13
13
  return ::Avm::Result.error('Nothing to push') if pushs.empty?
14
14
 
15
- r = @git.execute(dry_push_args)
16
- message = if r.fetch(:exit_code).zero?
17
- 'ok'
18
- else
19
- r.fetch(:stderr) + "\n#{::Shellwords.join(dry_push_args)}"
20
- end
21
- ::Avm::Result.success_or_error(r.fetch(:exit_code).zero?, message)
15
+ dry_push_execution_result
22
16
  end
23
17
 
24
18
  def push
@@ -26,7 +20,7 @@ module Avm
26
20
  info 'PUSH: Nada a enviar'
27
21
  else
28
22
  info "PUSH: enviando \"#{pushs}\"..."
29
- git(%w[push origin] + pushs)
23
+ git_execute(%w[push origin] + pushs)
30
24
  end
31
25
  end
32
26
 
@@ -39,7 +33,7 @@ module Avm
39
33
  end
40
34
 
41
35
  def remove_branch_push
42
- remote_branch_hash ? ":refs/heads/#{branch}" : nil
36
+ remote_branch_hash ? ":refs/heads/#{branch.name}" : nil
43
37
  end
44
38
 
45
39
  def tag_push
@@ -47,6 +41,18 @@ module Avm
47
41
 
48
42
  "#{branch_hash}:#{tag}"
49
43
  end
44
+
45
+ private
46
+
47
+ def dry_push_execution_result
48
+ r = launcher_git.execute(dry_push_args)
49
+ message = if r.fetch(:exit_code).zero?
50
+ 'ok'
51
+ else
52
+ r.fetch(:stderr) + "\n#{::Shellwords.join(dry_push_args)}"
53
+ end
54
+ ::Avm::Result.success_or_error(r.fetch(:exit_code).zero?, message)
55
+ end
50
56
  end
51
57
  end
52
58
  end
@@ -10,7 +10,7 @@ module Avm
10
10
  end
11
11
 
12
12
  def remote_branch_hash
13
- remote_hashs["refs/heads/#{branch}"]
13
+ remote_hashs["refs/heads/#{branch.name}"]
14
14
  end
15
15
 
16
16
  def remote_tag_hash
@@ -24,7 +24,7 @@ module Avm
24
24
  end
25
25
 
26
26
  def remote_hashs_uncached
27
- @git.remote_hashs(remote_name)
27
+ launcher_git.remote_hashs(remote_name)
28
28
  end
29
29
  end
30
30
  end
@@ -28,7 +28,7 @@ module Avm
28
28
 
29
29
  def test_performer
30
30
  ::Avm::Sources::Tests::Builder
31
- .new(::Avm::Registry.sources.detect(@git))
31
+ .new(::Avm::Registry.sources.detect(launcher_git))
32
32
  .include_main(true)
33
33
  .include_subs(true)
34
34
  .performer
@@ -19,7 +19,7 @@ module Avm
19
19
  end
20
20
 
21
21
  def branch_short_hash
22
- git(['log', '--pretty=format:%h', '-1', '-q', branch_hash])
22
+ git_execute(['log', '--pretty=format:%h', '-1', '-q', branch_hash])
23
23
  end
24
24
  end
25
25
  end
@@ -11,6 +11,8 @@ module Avm
11
11
  enable_simple_cache
12
12
  common_constructor :parent, :key, :label
13
13
 
14
+ SKIPPED_RESULT_MESSAGE = 'skipped'
15
+
14
16
  def skip?
15
17
  parent.skip_validations.include?(key)
16
18
  end
@@ -18,11 +20,17 @@ module Avm
18
20
  private
19
21
 
20
22
  def result_uncached
21
- if skip?
22
- ::Avm::Result.neutral('skipped')
23
- else
24
- parent.send("#{key}_result")
25
- end
23
+ skip? ? skipped_result : validation_result
24
+ end
25
+
26
+ def skipped_result
27
+ ::Avm::Result.neutral(SKIPPED_RESULT_MESSAGE)
28
+ end
29
+
30
+ def validation_result
31
+ parent.send("#{key}_result")
32
+ rescue ::RuntimeError => e
33
+ ::Avm::Result.error("error raised: #{e.message}")
26
34
  end
27
35
  end
28
36
  end
@@ -10,7 +10,7 @@ module Avm
10
10
  end
11
11
 
12
12
  def clean_workspace?
13
- @git.dirty_files.none?
13
+ launcher_git.dirty_files.none?
14
14
  end
15
15
  end
16
16
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/tools/core_ext'
4
+ require 'eac_git/local'
4
5
 
5
6
  module Avm
6
7
  module Git
@@ -10,14 +11,15 @@ module Avm
10
11
  enable_simple_cache
11
12
  enable_speaker
12
13
 
13
- attr_reader :skip_validations
14
+ BRANCH_NAME_ISSUE_ID_PATTERN =
15
+
16
+ attr_reader :dir, :skip_validations
14
17
 
15
18
  def initialize(options)
16
19
  consumer = ::EacRubyUtils::OptionsConsumer.new(options)
17
- dir, @skip_validations = consumer.consume_all(:dir, :skip_validations)
20
+ @dir, @skip_validations = consumer.consume_all(:dir, :skip_validations)
18
21
  validate_skip_validations
19
22
  consumer.validate
20
- @git = ::Avm::Launcher::Git::Base.new(dir)
21
23
  end
22
24
 
23
25
  def start_banner
@@ -35,16 +37,29 @@ module Avm
35
37
  end
36
38
 
37
39
  def issue_id
38
- m = branch_name.match(/\A#{Regexp.quote('issue_')}(\d+)\z/)
39
- m ? m[1].to_i : nil
40
+ branch ? issue_id_parser.parse(branch_name) : nil
41
+ end
42
+
43
+ # @return [EacRubyUtils::RegexpParser]
44
+ def issue_id_parser
45
+ /\A#{Regexp.quote('issue_')}(\d+)\z/.to_parser { |m| m[1].to_i }
40
46
  end
41
47
 
42
48
  private
43
49
 
44
- def git(args, exit_outputs = {})
45
- r = @git.execute!(args, exit_outputs: exit_outputs)
50
+ # @return [EacGit::Local]
51
+ def eac_git_uncached
52
+ ::EacGit::Local.new(dir)
53
+ end
54
+
55
+ def git_execute(args, exit_outputs = {})
56
+ r = launcher_git.execute!(args, exit_outputs: exit_outputs)
46
57
  r.is_a?(String) ? r.strip : r
47
58
  end
59
+
60
+ def launcher_git_uncached
61
+ ::Avm::Launcher::Git::Base.new(dir)
62
+ end
48
63
  end
49
64
  end
50
65
  end
@@ -77,7 +77,7 @@ module Avm
77
77
  end
78
78
 
79
79
  def successful_uncached
80
- if options.fetch(:no_cache) || !successful_cache.cached?
80
+ if options.fetch(:no_cache) || !successful_cache.stored?
81
81
  checkout_revision
82
82
  run_test
83
83
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.2'
6
6
  end
7
7
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*', 'Gemfile']
14
14
 
15
15
  s.add_dependency 'colorize', '~> 0.8.1'
16
- s.add_dependency 'eac_config', '~> 0.5', '>= 0.5.3'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.80'
16
+ s.add_dependency 'eac_config', '~> 0.8'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.83'
18
18
 
19
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
20
20
  end
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module EacCli
6
- class Config
6
+ class Config < ::SimpleDelegator
7
7
  class Entry
8
8
  class Options
9
9
  enable_simple_cache