avm 0.49.0 → 0.51.0

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: 45c9b97e84c6bc931f5c39f0b4504f2ff0bb54777eefec60a11ca75f0f78d7ac
4
- data.tar.gz: 8056ef32f78b0dd4e0dd3befb96b76215e427dee54439150bddc8ca55b6f79f9
3
+ metadata.gz: c7d526aa03c069d29d98545ce6d90ff1336592ad1c74a432c88430feb4cc71a6
4
+ data.tar.gz: f1b4f72746cd60c762df317eb415a91810de688bf58bc24d1ab261f085974b52
5
5
  SHA512:
6
- metadata.gz: 645d93964df7e611a16976cebaad4a49cffb661b0e44b3d499a3c09f92c3ddf2376de919ee864759e2cd0fb1d63b942a934ce47a1c524bcd62c6e10400858fa1
7
- data.tar.gz: 47dd65cb91878b663412a94e47da514d31b39bcb37f87d20796abaffe4877537885207ef2d291f78d511bbe9389333de66be73de053ae484aabfff314e566cde
6
+ metadata.gz: db1371c99c4d393a1b47cb09275a9fb6c9acb094706119b2db2a83131e87b75a85210b097e76dd053f35b892680713e493b2a2277767b66b0885e5c0434f713a
7
+ data.tar.gz: c2f242bddf30a01e4db4f4aaaffa7878863df455a04023d928ab611951cd2a73b4343cea0bcb312c44db96b98488a4337894f90cf23aba6972f28bf4ab571ee9
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_fs/file_info'
4
+ require 'ostruct'
5
+
6
+ module Avm
7
+ module FileFormats
8
+ class Base
9
+ enable_abstract_methods
10
+
11
+ def apply(files)
12
+ old_content = Hash[files.map { |f| [f, File.read(f)] }]
13
+ ::Avm::Files::Formatter::Utf8Assert.assert_files(files) { internal_apply(files) }
14
+ files.map { |f| build_file_result(f, old_content[f]) }
15
+ end
16
+
17
+ def name
18
+ self.class.name.demodulize
19
+ end
20
+
21
+ def match?(file)
22
+ match_by_filename?(file) || match_by_type?(file)
23
+ end
24
+
25
+ def valid_basenames
26
+ constant_or_array('VALID_BASENAMES')
27
+ end
28
+
29
+ def valid_types
30
+ constant_or_array('VALID_TYPES')
31
+ end
32
+
33
+ private
34
+
35
+ def constant_or_array(name)
36
+ return [] unless self.class.const_defined?(name)
37
+
38
+ self.class.const_get(name)
39
+ end
40
+
41
+ def build_file_result(file, old_content)
42
+ ::OpenStruct.new(file: file, format: self.class,
43
+ changed: (old_content != File.read(file)))
44
+ end
45
+
46
+ def match_by_filename?(file)
47
+ valid_basenames.any? do |valid_basename|
48
+ file.basename.fnmatch?(valid_basename)
49
+ end
50
+ end
51
+
52
+ def match_by_type?(file)
53
+ info = ::EacFs::FileInfo.new(file)
54
+ return unless info.content_type.type == 'text'
55
+
56
+ valid_types.include?(info.content_type.subtype)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module FileFormats
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -8,7 +8,6 @@ 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'
12
11
 
13
12
  module Avm
14
13
  module Launcher
@@ -43,6 +42,10 @@ module Avm
43
42
  @recache = false
44
43
  end
45
44
 
45
+ def fs_object_id
46
+ root.real.variableize
47
+ end
48
+
46
49
  def instance(name)
47
50
  instances.find { |i| i.name == name }
48
51
  end
@@ -66,7 +69,7 @@ module Avm
66
69
  end
67
70
 
68
71
  def default_cache_root
69
- ::Avm::Tools::Self.application.cache_dir.join('launcher')
72
+ fs_cache.path
70
73
  end
71
74
 
72
75
  def default_option(key)
@@ -78,7 +81,7 @@ module Avm
78
81
  end
79
82
 
80
83
  def default_settings_file
81
- ::Avm::Tools::Self.application.config_dir.join('launcher.yaml')
84
+ ::File.join(::EacFs::Contexts.config.current.path, 'launcher.yaml')
82
85
  end
83
86
 
84
87
  def projects_uncached
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/projects/stereotypes'
4
3
  require 'avm/launcher/paths/real'
5
4
  require 'avm/launcher/stereotype'
6
5
 
@@ -7,11 +7,7 @@ module Avm
7
7
  module Launcher
8
8
  module Stereotype
9
9
  class << self
10
- attr_reader :stereotypes
11
-
12
10
  def included(base)
13
- @stereotypes ||= []
14
- @stereotypes << base
15
11
  base.extend(ClassMethods)
16
12
  end
17
13
 
@@ -22,6 +18,10 @@ module Avm
22
18
  def nogit_stereotypes
23
19
  stereotypes - git_stereotypes
24
20
  end
21
+
22
+ def stereotypes
23
+ ::Avm::Registry.launcher_stereotypes.available
24
+ end
25
25
  end
26
26
 
27
27
  module ClassMethods
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry/from_gems'
4
+
5
+ module Avm
6
+ module Registry
7
+ class FileFormats < ::Avm::Registry::FromGems
8
+ end
9
+ end
10
+ end
data/lib/avm/registry.rb CHANGED
@@ -7,8 +7,8 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :application_stereotypes, :instances, :launcher_stereotypes,
11
- :runners, :scms, :source_generators, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :file_formats, :instances,
11
+ :launcher_stereotypes, :runners, :scms, :source_generators, :sources
12
12
 
13
13
  class << self
14
14
  enable_simple_cache
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'tmpdir'
5
+
6
+ module Avm
7
+ module Rspec
8
+ module Setup
9
+ module Launcher
10
+ def temp_launcher_context(settings_file = nil)
11
+ settings_file ||= temp_file
12
+ ::Avm::Launcher::Context.current = ::Avm::Launcher::Context.new(
13
+ projects_root: ::Dir.mktmpdir, settings_file: settings_file, cache_root: ::Dir.mktmpdir
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,10 +6,12 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Rspec
8
8
  module Setup
9
+ require_sub __FILE__
9
10
  EXAMPLES = %w[entries_values in_avm_registry not_in_avm_registry].freeze
10
11
 
11
12
  def self.extended(obj)
12
13
  obj.setup_examples
14
+ obj.rspec_config.include(::Avm::Rspec::Setup::Launcher)
13
15
  obj.rspec_config.include(::Avm::Rspec::SourceGenerator)
14
16
  end
15
17
 
@@ -6,9 +6,9 @@ module Avm
6
6
  module Rspec
7
7
  module SourceGenerator
8
8
  # @return [Avm::Sources::Base]
9
- def avm_source(stereotype_name, target_path = nil)
10
- target_path ||= temp_dir.join('generated_app')
11
- ::Avm::Registry.source_generators.detect(stereotype_name, target_path).perform
9
+ def avm_source(stereotype_name, options = {})
10
+ target_path ||= options.delete(:target_path) || temp_dir.join('generated_app')
11
+ ::Avm::Registry.source_generators.detect(stereotype_name, target_path, options).perform
12
12
  ::Avm::Registry.sources.detect(target_path)
13
13
  end
14
14
  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.49.0'
4
+ VERSION = '0.51.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.49.0
4
+ version: 0.51.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: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli
@@ -64,34 +64,28 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.12'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 0.12.3
67
+ version: '0.13'
71
68
  type: :runtime
72
69
  prerelease: false
73
70
  version_requirements: !ruby/object:Gem::Requirement
74
71
  requirements:
75
72
  - - "~>"
76
73
  - !ruby/object:Gem::Version
77
- version: '0.12'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 0.12.3
74
+ version: '0.13'
81
75
  - !ruby/object:Gem::Dependency
82
76
  name: eac_ruby_utils
83
77
  requirement: !ruby/object:Gem::Requirement
84
78
  requirements:
85
79
  - - "~>"
86
80
  - !ruby/object:Gem::Version
87
- version: '0.104'
81
+ version: '0.105'
88
82
  type: :runtime
89
83
  prerelease: false
90
84
  version_requirements: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - "~>"
93
87
  - !ruby/object:Gem::Version
94
- version: '0.104'
88
+ version: '0.105'
95
89
  - !ruby/object:Gem::Dependency
96
90
  name: eac_templates
97
91
  requirement: !ruby/object:Gem::Requirement
@@ -180,6 +174,34 @@ dependencies:
180
174
  - - "~>"
181
175
  - !ruby/object:Gem::Version
182
176
  version: 0.14.1
177
+ - !ruby/object:Gem::Dependency
178
+ name: avm-eac_ruby_base1
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - "~>"
182
+ - !ruby/object:Gem::Version
183
+ version: '0.24'
184
+ type: :development
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - "~>"
189
+ - !ruby/object:Gem::Version
190
+ version: '0.24'
191
+ - !ruby/object:Gem::Dependency
192
+ name: avm-git
193
+ requirement: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: '0.7'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: '0.7'
183
205
  - !ruby/object:Gem::Dependency
184
206
  name: eac_ruby_gem_support
185
207
  requirement: !ruby/object:Gem::Requirement
@@ -243,6 +265,8 @@ files:
243
265
  - lib/avm/entries/keys_constants_set.rb
244
266
  - lib/avm/entries/uri_builder.rb
245
267
  - lib/avm/executables.rb
268
+ - lib/avm/file_formats.rb
269
+ - lib/avm/file_formats/base.rb
246
270
  - lib/avm/instances.rb
247
271
  - lib/avm/instances/base.rb
248
272
  - lib/avm/instances/base/auto_values.rb
@@ -289,6 +313,7 @@ files:
289
313
  - lib/avm/registry/application_stereotypes.rb
290
314
  - lib/avm/registry/application_stereotypes/build_available.rb
291
315
  - lib/avm/registry/application_stereotypes/stereotype_builder.rb
316
+ - lib/avm/registry/file_formats.rb
292
317
  - lib/avm/registry/from_gems.rb
293
318
  - lib/avm/registry/instances.rb
294
319
  - lib/avm/registry/launcher_stereotypes.rb
@@ -301,6 +326,7 @@ files:
301
326
  - lib/avm/result.rb
302
327
  - lib/avm/rspec.rb
303
328
  - lib/avm/rspec/setup.rb
329
+ - lib/avm/rspec/setup/launcher.rb
304
330
  - lib/avm/rspec/shared_examples/entries_values.rb
305
331
  - lib/avm/rspec/shared_examples/in_avm_registry.rb
306
332
  - lib/avm/rspec/shared_examples/not_in_avm_registry.rb