avm-tools 0.102.0 → 0.102.1

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: af55442cdb7aacd8752fa1cf1b548fe867d7bdd74dfc9e9abd72d754de22772c
4
- data.tar.gz: c9fd2f59d75013325820f1d7ff8c8d54a35c09851a1032ccd31ff95427304a5d
3
+ metadata.gz: 6182ce43a4fee65202cfec5b9134751ac9b15fb6df367b1393331263264339ef
4
+ data.tar.gz: 5ecb6def157bb85b53115f4bfe3fcda93f290c0a720a16969577d0606de9b1f9
5
5
  SHA512:
6
- metadata.gz: c19e110f9557287b2b84b18385370111d1ba5bb1e99636f2425ab2c6a5729599f7d9bdba985fde3e4b4f7e4aece5614c3e443a4e61150370d9c1f2ac08bf411e
7
- data.tar.gz: 87dfc0c5042d2c0deba256ad7e7869bf4b547f48c1376f9e25114834e739b6e3d6be7c49cc03d3975128fd27de2b586f933f0f8fd67edffdd5350824f49208eb
6
+ metadata.gz: bd57b81fdfb81500e6426f17c7e981d141547a174e13d6e109a11b16db0987773bf6ab82269d025da663cb6872464ff883d2367a9809f9a5cb878472c09ac380
7
+ data.tar.gz: 17af742c5cf348bb9efec3551000f3ce5f0cd79010d2522b2239c61dc4b294dd9e0806e322a6c81a00401171ef87c5710da5ed9757ec0710a7d0f2c2fa60244b
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/self/instance'
4
+ require 'eac_docker/registry'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
7
8
  module Docker
8
- class Registry
9
+ class Registry < ::EacDocker::Registry
9
10
  class << self
10
11
  def default
11
12
  @default ||= new(::Avm::Self.instance.read_entry(
@@ -13,16 +14,6 @@ module Avm
13
14
  ))
14
15
  end
15
16
  end
16
-
17
- common_constructor :name
18
-
19
- def to_s
20
- name
21
- end
22
-
23
- def sub(suffix)
24
- self.class.new("#{name}#{suffix}")
25
- end
26
17
  end
27
18
  end
28
19
  end
@@ -26,6 +26,8 @@ module Avm
26
26
  return result if result
27
27
  end
28
28
  divergent_result_check_result
29
+ rescue ::Avm::Launcher::Instances::Error => e
30
+ ::Avm::Launcher::Publish::CheckResult.blocked(e.message)
29
31
  rescue ::StandardError => e
30
32
  raise e unless remote_unavailable_error?(e)
31
33
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/launcher/git/mirror_update'
4
+ require 'avm/launcher/instances/error'
4
5
  require 'avm/launcher/vendor/github'
5
6
  require 'avm/projects/stereotypes/git/publish'
6
7
 
@@ -27,7 +28,17 @@ module Avm
27
28
 
28
29
  attr_reader :instance
29
30
 
31
+ def validate_source_current_revision
32
+ if source_git.rev_parse(source_instance.options.git_current_revision, false).present?
33
+ return
34
+ end
35
+
36
+ raise ::Avm::Launcher::Instances::Error, 'Refspec ' \
37
+ "\"#{source_instance.options.git_current_revision}\" not found in \"#{source_git}\""
38
+ end
39
+
30
40
  def update
41
+ validate_source_current_revision
31
42
  ::Avm::Launcher::Git::MirrorUpdate.new(
32
43
  path,
33
44
  source_instance.real,
@@ -3,9 +3,7 @@
3
3
  module Avm
4
4
  module Launcher
5
5
  module Instances
6
- module Errors
7
- class Error < StandardError
8
- end
6
+ class Error < StandardError
9
7
  end
10
8
  end
11
9
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.102.0'
5
+ VERSION = '0.102.1'
6
6
  end
7
7
  end
@@ -6,6 +6,7 @@ require 'docopt'
6
6
  module EacCli
7
7
  class DocoptRunner
8
8
  require_sub __FILE__
9
+ extend ::EacCli::DocoptRunner::ClassMethods
9
10
  include ::EacCli::DocoptRunner::Context
10
11
 
11
12
  class << self
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'docopt'
4
+
3
5
  module EacCli
4
6
  class DocoptRunner
5
- DOCOPT_ERROR_EXIT_CODE = 0xC0
7
+ module ClassMethods
8
+ DOCOPT_ERROR_EXIT_CODE = 0xC0
6
9
 
7
- class << self
8
10
  def run(options = {})
9
11
  create(options).send(:run)
10
- rescue Docopt::Exit => e
12
+ rescue ::Docopt::Exit => e
11
13
  STDERR.write(e.message + "\n")
12
14
  ::Kernel.exit(DOCOPT_ERROR_EXIT_CODE)
13
15
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_cli/speaker'
4
+ require 'eac_ruby_utils/speaker'
5
+
3
6
  module EacCli
4
7
  module Runner
5
8
  module AfterClassMethods
@@ -10,9 +13,11 @@ module EacCli
10
13
  end
11
14
 
12
15
  def run(*runner_context_args)
13
- r = create(*runner_context_args)
14
- r.run_run
15
- r
16
+ on_asserted_speaker do
17
+ r = create(*runner_context_args)
18
+ r.run_run
19
+ r
20
+ end
16
21
  end
17
22
 
18
23
  def runner_definition(&block)
@@ -24,6 +29,18 @@ module EacCli
24
29
  def super_runner_definition
25
30
  superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
26
31
  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
27
44
  end
28
45
  end
29
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.20.0'
4
+ VERSION = '0.20.2'
5
5
  end
@@ -39,13 +39,17 @@ module EacGit
39
39
  ::EacGit::Executables.git.command('-C', root_path.to_path, *args)
40
40
  end
41
41
 
42
+ def raise_error(message)
43
+ raise "#{root_path}: #{message}"
44
+ end
45
+
42
46
  def rev_parse(ref, required = false)
43
47
  r = command('rev-parse', ref).execute!(exit_outputs: { 128 => nil, 32_768 => nil })
44
48
  r.strip! if r.is_a?(String)
45
49
  return r if r.present?
46
50
  return nil unless required
47
51
 
48
- raise "Reference \"#{ref}\" not found"
52
+ raise_error "Reference \"#{ref}\" not found"
49
53
  end
50
54
 
51
55
  def subrepo(subpath)
@@ -12,7 +12,8 @@ module EacGit
12
12
 
13
13
  common_constructor :local, :subpath do
14
14
  self.subpath = subpath.to_pathname
15
- raise "Config file \"#{config_absolute_path}\" not found" unless config_absolute_path.file?
15
+ local.raise_error "Config file \"#{config_absolute_path}\" not found" unless
16
+ config_absolute_path.file?
16
17
  end
17
18
 
18
19
  def command(subrepo_subcommand, *subrepo_subcommand_args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_base0/application_xdg'
3
4
  require 'eac_ruby_gems_utils/gem'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
  require 'eac_ruby_utils/filesystem_cache'
@@ -21,16 +22,8 @@ module EacRubyBase0
21
22
  vendor_gems + [self_gem]
22
23
  end
23
24
 
24
- { cache: '.cache', config: '.config', data: '.local/share' }.each do |item, subpath|
25
- xdg_env_method_name = "#{item}_xdg_env"
26
-
27
- define_method xdg_env_method_name do
28
- ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
29
- end
30
-
31
- define_method "#{item}_dir" do
32
- (send(xdg_env_method_name) || home_dir.join(subpath)).join(name)
33
- end
25
+ ::EacRubyBase0::ApplicationXdg::DIRECTORIES.each_key do |item|
26
+ delegate "#{item}_xdg_env", "#{item}_dir", to: :app_xdg
34
27
  end
35
28
 
36
29
  def fs_cache
@@ -40,7 +33,7 @@ module EacRubyBase0
40
33
  end
41
34
 
42
35
  def home_dir
43
- @home_dir ||= (options[OPTION_HOME_DIR] || ENV.fetch('HOME')).to_pathname
36
+ app_xdg.user_home_dir
44
37
  end
45
38
 
46
39
  def name
@@ -53,6 +46,10 @@ module EacRubyBase0
53
46
 
54
47
  private
55
48
 
49
+ def app_xdg_uncached
50
+ ::EacRubyBase0::ApplicationXdg.new(name, options[OPTION_HOME_DIR])
51
+ end
52
+
56
53
  def self_gem_uncached
57
54
  ::EacRubyGemsUtils::Gem.new(gemspec_dir)
58
55
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyBase0
4
+ # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
5
+ class ApplicationXdg
6
+ class << self
7
+ # @return [Pathname]
8
+ def user_home_dir_from_env
9
+ ENV.fetch('HOME').to_pathname
10
+ end
11
+ end
12
+
13
+ DIRECTORIES = { cache: '.cache', config: '.config', data: '.local/share',
14
+ state: '.local/state' }.freeze
15
+
16
+ common_constructor :app_name, :user_home_dir, default: [nil] do
17
+ self.user_home_dir ||= self.class.user_home_dir_from_env
18
+ end
19
+
20
+ DIRECTORIES.each do |item, subpath|
21
+ xdg_env_method_name = "#{item}_xdg_env"
22
+
23
+ define_method xdg_env_method_name do
24
+ ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
25
+ end
26
+
27
+ define_method "#{item}_dir" do
28
+ (send(xdg_env_method_name) || user_home_dir.join(subpath)).join(app_name)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -12,6 +12,7 @@ module EacRubyBase0
12
12
  common_concern do
13
13
  include ::EacCli::Runner
14
14
  enable_settings_provider
15
+ enable_simple_cache
15
16
  runner_definition do
16
17
  bool_opt '--no', 'Deny confirmation without question.'
17
18
  bool_opt '--yes', 'Accept confirmation without question.'
@@ -31,6 +32,12 @@ module EacRubyBase0
31
32
  def run_confirm(message = nil)
32
33
  yield if confirm?(message)
33
34
  end
35
+
36
+ private
37
+
38
+ def cached_confirm_uncached?(message = nil)
39
+ confirm?(message)
40
+ end
34
41
  end
35
42
  end
36
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.7.4'
4
+ VERSION = '0.8.0'
5
5
  end
@@ -3,11 +3,19 @@
3
3
  module EacRubyUtils
4
4
  module SimpleCache
5
5
  UNCACHED_METHOD_NAME_SUFFIX = '_uncached'
6
- UNCACHED_METHOD_PATTERN = /\A(\s+)_#{::Regexp.quote(UNCACHED_METHOD_NAME_SUFFIX)}\z/.freeze
6
+ UNCACHED_METHOD_PATTERN = /
7
+ \A(\s+)_#{::Regexp.quote(UNCACHED_METHOD_NAME_SUFFIX)}([\!\?]?)\z
8
+ /x.freeze
7
9
 
8
10
  class << self
9
11
  def uncached_method_name(method_name)
10
- "#{method_name}#{UNCACHED_METHOD_NAME_SUFFIX}"
12
+ method_name = method_name.to_s
13
+ end_mark = nil
14
+ if %w[! ?].any? { |mark| method_name.end_with?(mark) }
15
+ end_mark = method_name[-1]
16
+ method_name = method_name[0..-2]
17
+ end
18
+ "#{method_name}#{UNCACHED_METHOD_NAME_SUFFIX}#{end_mark}"
11
19
  end
12
20
  end
13
21
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.67.0'
4
+ VERSION = '0.68.0'
5
5
  end
@@ -10,6 +10,14 @@ class CacheableObject
10
10
  @counter += 1
11
11
  end
12
12
 
13
+ def method_with_question_uncached?
14
+ 'question'
15
+ end
16
+
17
+ def method_with_exclamation_uncached!
18
+ 'exclamation'
19
+ end
20
+
13
21
  def method_with_args_uncached(arg1)
14
22
  @counter2 ||= 0
15
23
  @counter2 += 1
@@ -74,6 +82,16 @@ RSpec.describe ::EacRubyUtils::SimpleCache do
74
82
  end
75
83
  end
76
84
 
85
+ describe 'method with marks' do
86
+ it 'found uncached method with exclamation mark' do
87
+ expect(instance.method_with_exclamation!).to eq('exclamation')
88
+ end
89
+
90
+ it 'found uncached method with question mark' do
91
+ expect(instance.method_with_question?).to eq('question')
92
+ end
93
+ end
94
+
77
95
  describe '#respond_to?' do
78
96
  it 'responds to cached method without args' do
79
97
  expect(instance.respond_to?(:my_method)).to be(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.102.0
4
+ version: 0.102.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -734,10 +734,10 @@ files:
734
734
  - vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb
735
735
  - vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb
736
736
  - vendor/eac_cli/lib/eac_cli/docopt_runner.rb
737
- - vendor/eac_cli/lib/eac_cli/docopt_runner/_class_methods.rb
738
737
  - vendor/eac_cli/lib/eac_cli/docopt_runner/_doc.rb
739
738
  - vendor/eac_cli/lib/eac_cli/docopt_runner/_settings.rb
740
739
  - vendor/eac_cli/lib/eac_cli/docopt_runner/_subcommands.rb
740
+ - vendor/eac_cli/lib/eac_cli/docopt_runner/class_methods.rb
741
741
  - vendor/eac_cli/lib/eac_cli/docopt_runner/context.rb
742
742
  - vendor/eac_cli/lib/eac_cli/old_configs.rb
743
743
  - vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb
@@ -1060,6 +1060,7 @@ files:
1060
1060
  - vendor/eac_ruby_base0/eac_ruby_base0.gemspec
1061
1061
  - vendor/eac_ruby_base0/lib/eac_ruby_base0.rb
1062
1062
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb
1063
+ - vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb
1063
1064
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb
1064
1065
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb
1065
1066
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb