avm 0.5.0 → 0.6.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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/registry/base.rb +65 -0
  3. data/lib/avm/registry.rb +29 -0
  4. data/lib/avm/rspec/setup.rb +22 -0
  5. data/lib/avm/rspec/shared_examples/in_avm_registry.rb +11 -0
  6. data/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +14 -0
  7. data/lib/avm/{git/organize.rb → rspec.rb} +2 -4
  8. data/lib/avm/scms/base.rb +28 -0
  9. data/lib/avm/scms/commit.rb +43 -0
  10. data/lib/avm/source_stereotypes/base.rb +21 -0
  11. data/lib/avm/sources/base.rb +22 -0
  12. data/lib/avm/version.rb +1 -1
  13. metadata +13 -67
  14. data/lib/avm/files/appendable/file_content.rb +0 -24
  15. data/lib/avm/files/appendable/plain_directory.rb +0 -25
  16. data/lib/avm/files/appendable/resource_base.rb +0 -13
  17. data/lib/avm/files/appendable/tar_output_command.rb +0 -26
  18. data/lib/avm/files/appendable/templatized_directory.rb +0 -29
  19. data/lib/avm/files/appendable.rb +0 -55
  20. data/lib/avm/files/appender.rb +0 -11
  21. data/lib/avm/files/deploy.rb +0 -71
  22. data/lib/avm/files/formatter/formats/base.rb +0 -62
  23. data/lib/avm/files/formatter/formats/generic_plain.rb +0 -34
  24. data/lib/avm/files/formatter/formats/html.rb +0 -45
  25. data/lib/avm/files/formatter/formats/javascript.rb +0 -24
  26. data/lib/avm/files/formatter/formats/json.rb +0 -27
  27. data/lib/avm/files/formatter/formats/php.rb +0 -22
  28. data/lib/avm/files/formatter/formats/python.rb +0 -22
  29. data/lib/avm/files/formatter/formats/ruby.rb +0 -22
  30. data/lib/avm/files/formatter/formats/xml.rb +0 -28
  31. data/lib/avm/files/formatter/formats.rb +0 -13
  32. data/lib/avm/files/formatter/utf8_assert.rb +0 -74
  33. data/lib/avm/files/formatter.rb +0 -90
  34. data/lib/avm/files/rotate.rb +0 -107
  35. data/lib/avm/files.rb +0 -9
  36. data/lib/avm/git/auto_commit/commit_info.rb +0 -23
  37. data/lib/avm/git/auto_commit/rules/base.rb +0 -39
  38. data/lib/avm/git/auto_commit/rules/last.rb +0 -19
  39. data/lib/avm/git/auto_commit/rules/manual.rb +0 -45
  40. data/lib/avm/git/auto_commit/rules/new.rb +0 -24
  41. data/lib/avm/git/auto_commit/rules/nth.rb +0 -31
  42. data/lib/avm/git/auto_commit/rules/unique.rb +0 -21
  43. data/lib/avm/git/auto_commit/rules.rb +0 -31
  44. data/lib/avm/git/auto_commit_path/ruby.rb +0 -20
  45. data/lib/avm/git/auto_commit_path.rb +0 -28
  46. data/lib/avm/git/commit/class_methods.rb +0 -31
  47. data/lib/avm/git/commit/deploy.rb +0 -38
  48. data/lib/avm/git/commit/deploy_methods.rb +0 -19
  49. data/lib/avm/git/commit/diff_tree_line.rb +0 -32
  50. data/lib/avm/git/commit/file.rb +0 -46
  51. data/lib/avm/git/commit.rb +0 -59
  52. data/lib/avm/git/file_auto_fixup.rb +0 -83
  53. data/lib/avm/git/issue/complete/commits.rb +0 -42
  54. data/lib/avm/git/issue/complete/git_subrepos.rb +0 -23
  55. data/lib/avm/git/issue/complete/local_branch.rb +0 -54
  56. data/lib/avm/git/issue/complete/local_tag.rb +0 -39
  57. data/lib/avm/git/issue/complete/push.rb +0 -54
  58. data/lib/avm/git/issue/complete/remote.rb +0 -33
  59. data/lib/avm/git/issue/complete/test.rb +0 -45
  60. data/lib/avm/git/issue/complete/tracker.rb +0 -28
  61. data/lib/avm/git/issue/complete/validation.rb +0 -31
  62. data/lib/avm/git/issue/complete/validations.rb +0 -53
  63. data/lib/avm/git/issue/complete/working_tree.rb +0 -19
  64. data/lib/avm/git/issue/complete.rb +0 -51
  65. data/lib/avm/git/issue/deliver.rb +0 -56
  66. data/lib/avm/git/issue.rb +0 -11
  67. data/lib/avm/git/organize/reference_update.rb +0 -34
  68. data/lib/avm/git/organize/repository.rb +0 -76
  69. data/lib/avm/git/revision_test.rb +0 -105
  70. data/lib/avm/git/subrepo_check/parent.rb +0 -51
  71. data/lib/avm/git/subrepo_check/remote.rb +0 -89
  72. data/lib/avm/git/subrepo_check/show_result.rb +0 -32
  73. data/lib/avm/git/subrepo_check.rb +0 -38
  74. data/lib/avm/git/subrepo_checks.rb +0 -59
  75. data/lib/avm/git.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c21e54d17440b61336b3345c8c6f2db32b0d2d31f6f9d56f78894d4f01bbb3c7
4
- data.tar.gz: 29604235a823f781751eaf5031b967a1cf01c5d6c14e194c09e7bfaaba8c2043
3
+ metadata.gz: 47ace344eec41bb800789fa179273a83a4c0e321436c2535aa5e2fe21ed88ef2
4
+ data.tar.gz: 79a810126ba2b8fcd0596ec87c6094bd6d2f26b0f26d508a1d8dd5c75a0e5a2e
5
5
  SHA512:
6
- metadata.gz: a3240b4fafbfedcd68581fec71de2099906e599df3adb4f64d4bd66b4ced66582a02ced5db16d47c91ed78eb580daea910c44554d9abfef10ab3b308ff160ab2
7
- data.tar.gz: 1104ec38c87bc15499ad0cd3d37ddd9c6ad0075d1c286ecb514a142d62f329e9c83035f23223788a5d5acb41a769e13f394180d84b80591a5035e347107de153
6
+ metadata.gz: 859a74c8cd03ae21dcdf5bf77d8da05ee00ed41b0562ee4c080c5eab7cd17a234cf96aaeb66848496a1139c0d2a1618c4eeca40b6332440bceacae0a160f4c3e
7
+ data.tar.gz: f042f3e2be9b952d2d088407431b41514628bb4caa66381330393310bf13d96ad4a19e78682e41cabffd0347b54dd6f7750c5ba4c541932c882efaa33a8491b7
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/gems_registry'
5
+
6
+ module Avm
7
+ module Registry
8
+ class Base
9
+ enable_simple_cache
10
+ common_constructor :module_suffix
11
+
12
+ def detect(*registered_initialize_args)
13
+ detect_optional(*registered_initialize_args) ||
14
+ raise("No registered module valid for #{registered_initialize_args}" \
15
+ " (Module suffix: #{module_suffix})")
16
+ end
17
+
18
+ def detect_optional(*registered_initialize_args)
19
+ registered_modules.lazy.map { |klass| klass.new(*registered_initialize_args) }
20
+ .find(&:valid?)
21
+ end
22
+
23
+ def provider_module_suffix
24
+ "#{module_suffix}::Provider"
25
+ end
26
+
27
+ def single_module_suffix
28
+ "#{module_suffix}::Base"
29
+ end
30
+
31
+ def to_s
32
+ "#{self.class}[#{module_suffix}]"
33
+ end
34
+
35
+ def valid_registered_module?(a_module)
36
+ a_module.is_a?(::Class) && !a_module.abstract?
37
+ end
38
+
39
+ private
40
+
41
+ def registered_modules_uncached
42
+ (single_registered_modules + provider_registered_modules)
43
+ .select { |v| valid_registered_module?(v) }.uniq.sort_by { |s| [s.name] }
44
+ end
45
+
46
+ def single_registered_modules
47
+ single_instance_registry.registered.map(&:registered_module)
48
+ end
49
+
50
+ def provider_registered_modules
51
+ provider_registry.registered.map(&:registered_module).flat_map do |provider_class|
52
+ provider_class.new.all
53
+ end
54
+ end
55
+
56
+ def single_instance_registry_uncached
57
+ ::EacRubyUtils::GemsRegistry.new(single_module_suffix)
58
+ end
59
+
60
+ def provider_registry_uncached
61
+ ::EacRubyUtils::GemsRegistry.new(provider_module_suffix)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/gems_registry'
5
+
6
+ module Avm
7
+ module Registry
8
+ require_sub __FILE__
9
+ enable_listable
10
+ lists.add_symbol :category, :instance_stereotypes, :scms, :source_stereotypes
11
+
12
+ class << self
13
+ enable_simple_cache
14
+
15
+ # @return [Array<Avm::Registry::Base>]
16
+ def registries
17
+ lists.category.values.map { |c| send(c) }
18
+ end
19
+
20
+ private
21
+
22
+ ::Avm::Registry.lists.category.each_value do |category|
23
+ define_method "#{category}_uncached" do
24
+ ::Avm::Registry::Base.new(category.to_s.camelize)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Rspec
7
+ module Setup
8
+ def self.extended(obj)
9
+ obj.setup_in_avm_registry_example
10
+ obj.setup_not_in_avm_registry_example
11
+ end
12
+
13
+ def setup_in_avm_registry_example
14
+ require 'avm/rspec/shared_examples/in_avm_registry'
15
+ end
16
+
17
+ def setup_not_in_avm_registry_example
18
+ require 'avm/rspec/shared_examples/not_in_avm_registry'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+
5
+ ::RSpec.shared_examples 'in_avm_registry' do |registry_method|
6
+ let(:avm_registry) { ::Avm::Registry.send(registry_method) }
7
+
8
+ it 'is in the avm registry' do
9
+ expect(avm_registry.registered_modules).to include(described_class)
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+
5
+ ::RSpec.shared_examples 'not_in_avm_registry' do |registry_method = nil|
6
+ registry_method.if_present(::Avm::Registry.registries) { |v| [::Avm::Registry.send(v)] }
7
+ .each do |registry|
8
+ context "when registry is #{registry}" do
9
+ it 'is not in the avm registry' do
10
+ expect(registry.registered_modules).not_to include(described_class)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -3,9 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module Git
7
- module Organize
8
- require_sub __FILE__
9
- end
6
+ module Rspec
7
+ require_sub __FILE__
10
8
  end
11
9
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ class Base
8
+ enable_abstract_methods
9
+ abstract_methods :update, :valid?
10
+ common_constructor :path do
11
+ self.path = path.to_pathname
12
+ end
13
+
14
+ # @return [Avm::Scms::Commit,NilClass]
15
+ def commit_if_change(_message = nil)
16
+ raise_abstract_method __method__
17
+ end
18
+
19
+ def name
20
+ self.class.name.demodulize
21
+ end
22
+
23
+ def to_s
24
+ name
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ class Commit
8
+ enable_abstract_methods
9
+
10
+ # @return [Array<Pathname>]
11
+ def changed_files
12
+ raise_abstract_method __method__
13
+ end
14
+
15
+ # @param other [Avm::Scms::Commit]
16
+ # @return [Avm::Scms::Commit]
17
+ def merge_with(_other)
18
+ raise_abstract_method __method__
19
+ end
20
+
21
+ # @return [Array<Pathname>]
22
+ def no_scm_changed_files
23
+ changed_files.reject { |path| scm_file?(path) }
24
+ end
25
+
26
+ # @param new_message [String]
27
+ def reword(_new_message)
28
+ raise_abstract_method __method__
29
+ end
30
+
31
+ # @return [Array<Pathname>]
32
+ def scm_changed_files
33
+ changed_files.select { |path| scm_file?(path) }
34
+ end
35
+
36
+ # @param path [Pathname]
37
+ # @return [TrueClass,FalseClass]
38
+ def scm_file?(_path)
39
+ raise_abstract_method __method__
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module SourceStereotypes
7
+ class Base
8
+ enable_abstract_methods
9
+ abstract_methods :valid?
10
+ common_constructor :source
11
+
12
+ def name
13
+ self.class.name
14
+ end
15
+
16
+ def to_s
17
+ name
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/registry'
3
4
  require 'eac_git'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
7
8
  module Sources
8
9
  class Base
10
+ require_sub __FILE__
9
11
  enable_simple_cache
10
12
  enable_listable
11
13
  lists.add_symbol :option, :parent
@@ -14,6 +16,7 @@ module Avm
14
16
  self.options = self.class.lists.option.hash_keys_validate!(options)
15
17
  end
16
18
 
19
+ delegate :locale, to: :configuration
17
20
  delegate :to_s, to: :path
18
21
 
19
22
  # @return [Avm::Sources::Base]
@@ -34,12 +37,31 @@ module Avm
34
37
  .map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) }
35
38
  end
36
39
 
40
+ def update
41
+ stereotype.update_source(self)
42
+ end
43
+
37
44
  private
38
45
 
46
+ # @return [Avm::Sources::Configuration]
47
+ def configuration_uncached
48
+ ::Avm::Sources::Configuration.find_in_path(path) || ::Avm::Sources::Configuration.new
49
+ end
50
+
39
51
  # @return [EacGit::Local]
40
52
  def git_repo_uncached
41
53
  ::EacGit::Local.new(path)
42
54
  end
55
+
56
+ # @return [Avm::Scms::Base]
57
+ def scm_uncached
58
+ ::Avm::Registry.scms.detect(path)
59
+ end
60
+
61
+ # @return [Avm::SourceStereotypes::Base]
62
+ def stereotype_uncached
63
+ ::Avm::Registry.source_stereotypes.detect(self)
64
+ end
43
65
  end
44
66
  end
45
67
  end
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.5.0'
4
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.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: 2021-10-02 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_docker
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.68'
47
+ version: '0.77'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.68'
54
+ version: '0.77'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: eac_templates
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -174,75 +174,21 @@ files:
174
174
  - lib/avm/docker/image.rb
175
175
  - lib/avm/docker/runner.rb
176
176
  - lib/avm/executables.rb
177
- - lib/avm/files.rb
178
- - lib/avm/files/appendable.rb
179
- - lib/avm/files/appendable/file_content.rb
180
- - lib/avm/files/appendable/plain_directory.rb
181
- - lib/avm/files/appendable/resource_base.rb
182
- - lib/avm/files/appendable/tar_output_command.rb
183
- - lib/avm/files/appendable/templatized_directory.rb
184
- - lib/avm/files/appender.rb
185
- - lib/avm/files/deploy.rb
186
- - lib/avm/files/formatter.rb
187
- - lib/avm/files/formatter/formats.rb
188
- - lib/avm/files/formatter/formats/base.rb
189
- - lib/avm/files/formatter/formats/generic_plain.rb
190
- - lib/avm/files/formatter/formats/html.rb
191
- - lib/avm/files/formatter/formats/javascript.rb
192
- - lib/avm/files/formatter/formats/json.rb
193
- - lib/avm/files/formatter/formats/php.rb
194
- - lib/avm/files/formatter/formats/python.rb
195
- - lib/avm/files/formatter/formats/ruby.rb
196
- - lib/avm/files/formatter/formats/xml.rb
197
- - lib/avm/files/formatter/utf8_assert.rb
198
- - lib/avm/files/rotate.rb
199
- - lib/avm/git.rb
200
- - lib/avm/git/auto_commit/commit_info.rb
201
- - lib/avm/git/auto_commit/rules.rb
202
- - lib/avm/git/auto_commit/rules/base.rb
203
- - lib/avm/git/auto_commit/rules/last.rb
204
- - lib/avm/git/auto_commit/rules/manual.rb
205
- - lib/avm/git/auto_commit/rules/new.rb
206
- - lib/avm/git/auto_commit/rules/nth.rb
207
- - lib/avm/git/auto_commit/rules/unique.rb
208
- - lib/avm/git/auto_commit_path.rb
209
- - lib/avm/git/auto_commit_path/ruby.rb
210
- - lib/avm/git/commit.rb
211
- - lib/avm/git/commit/class_methods.rb
212
- - lib/avm/git/commit/deploy.rb
213
- - lib/avm/git/commit/deploy_methods.rb
214
- - lib/avm/git/commit/diff_tree_line.rb
215
- - lib/avm/git/commit/file.rb
216
- - lib/avm/git/file_auto_fixup.rb
217
- - lib/avm/git/issue.rb
218
- - lib/avm/git/issue/complete.rb
219
- - lib/avm/git/issue/complete/commits.rb
220
- - lib/avm/git/issue/complete/git_subrepos.rb
221
- - lib/avm/git/issue/complete/local_branch.rb
222
- - lib/avm/git/issue/complete/local_tag.rb
223
- - lib/avm/git/issue/complete/push.rb
224
- - lib/avm/git/issue/complete/remote.rb
225
- - lib/avm/git/issue/complete/test.rb
226
- - lib/avm/git/issue/complete/tracker.rb
227
- - lib/avm/git/issue/complete/validation.rb
228
- - lib/avm/git/issue/complete/validations.rb
229
- - lib/avm/git/issue/complete/working_tree.rb
230
- - lib/avm/git/issue/deliver.rb
231
- - lib/avm/git/organize.rb
232
- - lib/avm/git/organize/reference_update.rb
233
- - lib/avm/git/organize/repository.rb
234
- - lib/avm/git/revision_test.rb
235
- - lib/avm/git/subrepo_check.rb
236
- - lib/avm/git/subrepo_check/parent.rb
237
- - lib/avm/git/subrepo_check/remote.rb
238
- - lib/avm/git/subrepo_check/show_result.rb
239
- - lib/avm/git/subrepo_checks.rb
240
177
  - lib/avm/instances/docker_image.rb
241
178
  - lib/avm/jobs.rb
242
179
  - lib/avm/jobs/base.rb
243
180
  - lib/avm/jobs/variables_source.rb
244
181
  - lib/avm/path_string.rb
182
+ - lib/avm/registry.rb
183
+ - lib/avm/registry/base.rb
245
184
  - lib/avm/result.rb
185
+ - lib/avm/rspec.rb
186
+ - lib/avm/rspec/setup.rb
187
+ - lib/avm/rspec/shared_examples/in_avm_registry.rb
188
+ - lib/avm/rspec/shared_examples/not_in_avm_registry.rb
189
+ - lib/avm/scms/base.rb
190
+ - lib/avm/scms/commit.rb
191
+ - lib/avm/source_stereotypes/base.rb
246
192
  - lib/avm/sources.rb
247
193
  - lib/avm/sources/base.rb
248
194
  - lib/avm/sources/configuration.rb
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'avm/files/appendable/resource_base'
5
-
6
- module Avm
7
- module Files
8
- module Appendable
9
- class FileContent < ::Avm::Files::Appendable::ResourceBase
10
- attr_reader :target_path, :content
11
-
12
- def initialize(deploy, target_path, content)
13
- super(deploy)
14
- @target_path = target_path
15
- @content = content
16
- end
17
-
18
- def write_on(target_dir)
19
- target_dir.join(target_path).write(content)
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'avm/files/appendable/resource_base'
5
-
6
- module Avm
7
- module Files
8
- module Appendable
9
- class PlainDirectory < ::Avm::Files::Appendable::ResourceBase
10
- attr_reader :source_path
11
-
12
- def initialize(appender, source_path)
13
- super(appender)
14
- @source_path = source_path.to_pathname
15
- end
16
-
17
- def write_on(target_dir)
18
- raise "\"#{source_path}\" is not a directory" unless source_path.directory?
19
-
20
- ::FileUtils.cp_r("#{source_path}/.", target_dir.to_path)
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Files
7
- module Appendable
8
- class ResourceBase
9
- common_constructor :appender
10
- end
11
- end
12
- end
13
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/envs'
5
- require 'avm/files/appendable/resource_base'
6
-
7
- module Avm
8
- module Files
9
- module Appendable
10
- class TarOutputCommand < ::Avm::Files::Appendable::ResourceBase
11
- attr_reader :command
12
-
13
- def initialize(appender, command)
14
- super(appender)
15
- @command = command
16
- end
17
-
18
- def write_on(target_dir)
19
- command.pipe(
20
- ::EacRubyUtils::Envs.local.command('tar', '-xf', '-', '-C', target_dir)
21
- ).execute!
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'avm/files/appendable/resource_base'
5
- require 'eac_templates/directory'
6
-
7
- module Avm
8
- module Files
9
- module Appendable
10
- class TemplatizedDirectory < ::Avm::Files::Appendable::ResourceBase
11
- attr_reader :source_path
12
-
13
- def initialize(appender, source_path)
14
- super(appender)
15
- @source_path = source_path
16
- end
17
-
18
- def write_on(target_dir)
19
- raise 'Variables source not set' if appender.variables_source.blank?
20
-
21
- ::EacTemplates::Directory.new(source_path).apply(
22
- appender.variables_source,
23
- target_dir
24
- )
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Files
7
- module Appendable
8
- require_sub __FILE__
9
-
10
- attr_reader :variables_source
11
-
12
- def appended
13
- @appended ||= []
14
- end
15
-
16
- def append_templatized_directories(directories)
17
- directories.each { |directory| append_templatized_directory(directory) }
18
- self
19
- end
20
-
21
- def append_plain_directory(directory)
22
- appended << ::Avm::Files::Appendable::PlainDirectory.new(self, directory)
23
- self
24
- end
25
-
26
- def append_tar_output_command(tar_command)
27
- appended << ::Avm::Files::Appendable::TarOutputCommand.new(self, tar_command)
28
- self
29
- end
30
-
31
- def append_templatized_directory(directory)
32
- appended << ::Avm::Files::Appendable::TemplatizedDirectory.new(self, directory)
33
- self
34
- end
35
-
36
- def append_file_content(target_path, content)
37
- appended << ::Avm::Files::Appendable::FileContent
38
- .new(self, target_path, content)
39
- self
40
- end
41
-
42
- def variables_source_set(source)
43
- @variables_source = source
44
- self
45
- end
46
-
47
- def write_appended_on(target_dir)
48
- target_dir = target_dir.to_pathname
49
- raise "\"#{target_dir}\" is not a directory" unless target_dir.directory?
50
-
51
- appended.each { |append| append.write_on(target_dir) }
52
- end
53
- end
54
- end
55
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/files/appendable'
4
-
5
- module Avm
6
- module Files
7
- class Appender
8
- include ::Avm::Files::Appendable
9
- end
10
- end
11
- end