avm 0.81.0 → 0.83.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5aaacb2872fccfe58ccdafad10e0a1c431b2c86e020cdda80a9d352d6771451
4
- data.tar.gz: cf56541de76d828f5fdfa7fb1bd192fee610614ca7b51c02941f6e5293c801c0
3
+ metadata.gz: 604351198d39b18f5957ac599205ee2c3553b9158a830db6cd9473c337254762
4
+ data.tar.gz: 846e638a6fd9871a472da4a4dbef8614e40264e716e4bc1de6d5f99be1a26fc9
5
5
  SHA512:
6
- metadata.gz: dd31baa92bd54625915361d83eec55ecd425f241ecb216c3c01c13fa0f320dbc86e59d5e19509eeab0746911e48845881f880bd7e13382426fed44aab4b6ede0
7
- data.tar.gz: c96a21e64aed4dd953128bee69bfb72107dc5abc6f7977154dd8e8495ad1ddc7daa93dbbdf829a4e8435547ff9da5d3153e8080c9d1e7a6c9497500bd8b347e5
6
+ metadata.gz: f0493cd888a5f886c00d04241fa4b887fd8b591d64cdbe8052c54a3098879c57968091e955854cf1b5de130106ca5a7dce3ce0b1f9d73487f637221ff71f7565
7
+ data.tar.gz: 3e9410b1deb34a3f5ad68eb766db1221b05b2701c5959bfb72ec08db2791fd9ab7820762ce1df955b2e1c6112a12b9ab4ad7339a350b34eaaa5984e2947fe3b5
@@ -5,6 +5,8 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module ApplicationScms
7
7
  class Base
8
+ acts_as_abstract
9
+
8
10
  class << self
9
11
  # @return [String]
10
12
  def type_name
@@ -12,16 +14,25 @@ module Avm
12
14
  end
13
15
  end
14
16
 
15
- # !method initialize(url)
16
- # @param url [Addressable::URI]
17
- common_constructor :url do
18
- self.url = url.to_uri
19
- end
17
+ # !method initialize(application)
18
+ # @param application [Avm::Application::Base]
19
+ common_constructor :application
20
20
  delegate :type_name, to: :class
21
21
 
22
+ # @param path [Pathname]
23
+ # @return [Pathname]
24
+ def assert_main_at(path) # rubocop:disable Lint/UnusedMethodArgument
25
+ raise_abstract_method __method__
26
+ end
27
+
22
28
  # @return [String]
23
29
  def to_s
24
- "#{type_name}[#{url}]"
30
+ "#{type_name}[#{to_s_type_specific}]"
31
+ end
32
+
33
+ # @return [String]
34
+ def to_s_type_specific
35
+ ''
25
36
  end
26
37
  end
27
38
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/core_ext'
4
+
5
+ module Avm
6
+ module Applications
7
+ class Base
8
+ class AutoLocalSourcePath
9
+ acts_as_instance_method
10
+ common_constructor :application
11
+
12
+ # @return [Pathname]
13
+ def result
14
+ application.scm.assert_main_at(fs_cache.path.to_pathname)
15
+ end
16
+
17
+ # @return [String]
18
+ def fs_object_id
19
+ application.id.to_s.parameterize
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -10,7 +10,7 @@ module Avm
10
10
  module LocalSource
11
11
  # @return [Pathname]
12
12
  def local_source_path
13
- local_source_path_entry.value!.to_pathname
13
+ (local_source_path_entry.value || auto_local_source_path).to_pathname
14
14
  end
15
15
 
16
16
  # @return [EacConfig::Entry]
@@ -8,12 +8,12 @@ module Avm
8
8
  class Base
9
9
  module Scm
10
10
  common_concern do
11
- uri_components_entries_values 'scm', %w[repos_path type]
11
+ uri_components_entries_values 'scm', %w[repos_path ssh_username type]
12
12
  end
13
13
 
14
14
  # @return [Avm::ApplicationScms::Base]
15
15
  def scm
16
- @scm ||= ::Avm::Registry.application_scms.detect(scm_type, scm_url)
16
+ @scm ||= ::Avm::Registry.application_scms.detect(self)
17
17
  end
18
18
 
19
19
  # @param value [String]
@@ -6,9 +6,9 @@ module Avm
6
6
  module Registry
7
7
  class ApplicationScms < ::Avm::Registry::FromGems
8
8
  def class_detect(klass, detect_args)
9
- return nil unless klass.type_name == detect_args[0]
9
+ return nil unless klass.type_name == detect_args.fetch(0).scm_type
10
10
 
11
- klass.new(*detect_args[1..-1])
11
+ klass.new(*detect_args)
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Sources
7
+ class Base
8
+ class Sub
9
+ class Remove
10
+ acts_as_instance_method
11
+
12
+ # !method initialize(sub)
13
+ # @param sub [Avm::Sources::Base::Sub]
14
+ common_constructor :sub
15
+ delegate :source, to: :sub
16
+
17
+ # @return [void]
18
+ def result
19
+ source.scm.commit_if_change(commit_message) { do_changes }
20
+ end
21
+
22
+ private
23
+
24
+ # @return [String]
25
+ def commit_message
26
+ sub.i18n_translate(:remove_commit_message, sub_path: sub.sub_path)
27
+ end
28
+
29
+ # @return [void]
30
+ def do_changes
31
+ ::FileUtils.rm_rf(sub.absolute_path)
32
+ source.on_sub_updated
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/base/subs_paths'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Sources
8
+ class Base
9
+ class Sub
10
+ # !method initialize(source, sub_path)
11
+ # @param source [Avm::Sources::Base]
12
+ # @param sub_path [Pathname]
13
+ common_constructor :source, :sub_path do
14
+ self.sub_path = sub_path.to_pathname
15
+ end
16
+
17
+ # @return [Pathname]
18
+ def absolute_path
19
+ sub_path.expand_path(source.path)
20
+ end
21
+
22
+ require_sub __FILE__, require_mode: :kernel
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/sources/base/sub'
3
4
  require 'avm/sources/base/subs_paths'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -17,6 +18,12 @@ module Avm
17
18
  subs.lazy.map { |sub| path.expand_path.child_of?(sub.path) ? sub : nil }.find(&:present?)
18
19
  end
19
20
 
21
+ # @param sub_path [Pathname]
22
+ # @return [Avm::Sources::Base::Sub]
23
+ def sub(sub_path)
24
+ ::Avm::Sources::Base::Sub.new(self, sub_path)
25
+ end
26
+
20
27
  # @return [Enumerable<Avm::Sources::Base>]
21
28
  def subs
22
29
  subs_paths_to_search
data/lib/avm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.81.0'
4
+ VERSION = '0.83.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.81.0
4
+ version: 0.83.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.38'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.38.1
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '0.38'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.38.1
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: eac_config
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -243,6 +249,7 @@ files:
243
249
  - lib/avm/application_stereotypes/base.rb
244
250
  - lib/avm/applications.rb
245
251
  - lib/avm/applications/base.rb
252
+ - lib/avm/applications/base/auto_local_source_path.rb
246
253
  - lib/avm/applications/base/local_instance.rb
247
254
  - lib/avm/applications/base/local_source.rb
248
255
  - lib/avm/applications/base/naming.rb
@@ -418,6 +425,8 @@ files:
418
425
  - lib/avm/sources/base/organizational.rb
419
426
  - lib/avm/sources/base/parent.rb
420
427
  - lib/avm/sources/base/stereotype.rb
428
+ - lib/avm/sources/base/sub.rb
429
+ - lib/avm/sources/base/sub/remove.rb
421
430
  - lib/avm/sources/base/subs.rb
422
431
  - lib/avm/sources/base/subs_paths.rb
423
432
  - lib/avm/sources/base/testing.rb