avm-tools 0.129.1 → 0.130.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: 4f5d19e88ae6cbf388d46a45edc8e119da03cf22830eb9ce545e5231b9a3386b
4
- data.tar.gz: e2e7507a7d8ea822d034d8a39a91450393858f49d0f5c62edd0519b3baa24d41
3
+ metadata.gz: '0698967568303e0d5288e864b9173c0916ac2a81b9a770a5f8e53a9e81f94616'
4
+ data.tar.gz: 6e6d462145da7deeba4b7f65a785eb9842595fdf0ec2513b1e0a7fda4342b318
5
5
  SHA512:
6
- metadata.gz: c9d1004d678667bd5df8fe9ec275f62bcebc21fd308b6640a504c15ac8093cfe603f907bb6cd7e47a654acbfcb01fbca25d103b168d6cf13b92dd32814d77a61
7
- data.tar.gz: 46ef40a420bd173412be7736a14d0294de7e570db8d00a9a2d24e75d43a83f524c732a76b110518ae13048366284464cc94a45e14d92b802f304714a4b8428ad
6
+ metadata.gz: edc70de430e385b918b3e58a22482a94298ab11ac4c1e5f32d460f22795ee75d5abe45ab23f02c4bec272cfb2cee7b2087e3a6f09ac4c2c58fd13ad7ca8ead09
7
+ data.tar.gz: c76af0a8732429866926f23c60c9f71fc563140cd4b5fc2b9903a35d98d8f62a6d5062ec52051b75220c0fcf29fe919fb51b93ca59fa73c07a23a53f920355d4
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/sources/runner'
3
4
  require 'avm/tools/app_src'
4
5
  require 'eac_cli/core_ext'
5
6
 
6
7
  module Avm
7
8
  module Tools
8
9
  class Runner
9
- class AppSrc
10
+ class AppSrc < ::Avm::Sources::Runner
10
11
  require_sub __FILE__
11
- runner_with :help, :subcommands do
12
- desc 'Utilities for local projects.'
13
- arg_opt '-C', '--path', 'Path to local project instance.'
14
- subcommands
15
- end
16
12
 
17
13
  def instance_banner
18
14
  infov 'Instance', instance
@@ -20,19 +16,13 @@ module Avm
20
16
  end
21
17
 
22
18
  def subject
23
- instance.avm_instance
19
+ source
24
20
  end
25
21
 
26
- delegate :extra_available_subcommands, to: :subject
27
-
28
22
  private
29
23
 
30
24
  def instance_uncached
31
- ::Avm::Tools::AppSrc.new(instance_path)
32
- end
33
-
34
- def instance_path_uncached
35
- (parsed.path || '.').to_pathname.expand_path
25
+ ::Avm::Tools::AppSrc.new(source_path)
36
26
  end
37
27
  end
38
28
  end
@@ -1,44 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/runners/base'
4
- require 'eac_cli/core_ext'
3
+ require 'avm/source_generators/runner'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class SourceGenerate
10
- runner_with :help do
11
- pos_arg :stereotype_name
12
- pos_arg :target_path
13
- end
14
-
15
- def run
16
- start_banner
17
- generate
18
- end
19
-
20
- def generate
21
- infom 'Generating...'
22
- generator.perform
23
- success "Source generated in \"#{generator.target_path}\""
24
- end
25
-
26
- def start_banner
27
- infov 'Stereotype', stereotype_name
28
- infov 'Target path', target_path
29
- infov 'Generator', generator.class
30
- end
31
-
32
- def generator_uncached
33
- ::Avm::Registry.source_generators.detect_optional(stereotype_name, target_path) ||
34
- fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
35
- end
36
-
37
- delegate :stereotype_name, to: :parsed
38
-
39
- def target_path
40
- parsed.target_path.to_pathname
41
- end
8
+ class SourceGenerate < ::Avm::SourceGenerators::Runner
42
9
  end
43
10
  end
44
11
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.129.1'
5
+ VERSION = '0.130.0'
6
6
  end
7
7
  end
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.129.1
4
+ version: 0.130.0
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: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.30'
33
+ version: '0.34'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.30'
40
+ version: '0.34'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_ruby_base1
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -324,11 +324,6 @@ files:
324
324
  - lib/avm/projects/stereotypes/ruby_gem.rb
325
325
  - lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
326
326
  - lib/avm/projects/stereotypes/ruby_gem/publish.rb
327
- - lib/avm/rails.rb
328
- - lib/avm/ruby.rb
329
- - lib/avm/ruby/bundler.rb
330
- - lib/avm/ruby/gems.rb
331
- - lib/avm/ruby/gems/generator.rb
332
327
  - lib/avm/stereotypes.rb
333
328
  - lib/avm/tools.rb
334
329
  - lib/avm/tools/app_src.rb
@@ -378,8 +373,6 @@ files:
378
373
  - lib/avm/tools/runner/launcher/projects.rb
379
374
  - lib/avm/tools/runner/launcher/publish.rb
380
375
  - lib/avm/tools/runner/ruby.rb
381
- - lib/avm/tools/runner/ruby/gems.rb
382
- - lib/avm/tools/runner/ruby/gems/generate.rb
383
376
  - lib/avm/tools/runner/ruby/rubocop.rb
384
377
  - lib/avm/tools/runner/self.rb
385
378
  - lib/avm/tools/runner/self/docker.rb
@@ -398,12 +391,6 @@ files:
398
391
  - template/avm/eac_writings_base0/commons/source_code/java.tex
399
392
  - template/avm/eac_writings_base0/commons/utils.tex
400
393
  - template/avm/eac_writings_base0/deploy/index.html.template
401
- - template/avm/ruby/gems/generator/gemspec.template
402
- - template/avm/ruby/gems/generator/root_lib.template
403
- - template/avm/ruby/gems/generator/static/Gemfile
404
- - template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb
405
- - template/avm/ruby/gems/generator/static/spec/spec_helper.rb
406
- - template/avm/ruby/gems/generator/version.template
407
394
  - template/avm/self/docker_image/Dockerfile
408
395
  - template/avm/self/docker_image/entrypoint.sh
409
396
  homepage:
data/lib/avm/rails.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Rails
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- module Bundler
8
- require_sub __FILE__
9
- end
10
- end
11
- end
@@ -1,165 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_ruby_base1/sources/base'
4
- require 'eac_templates/core_ext'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
- module Avm
8
- module Ruby
9
- module Gems
10
- class Generator
11
- IDENT = ' '
12
- JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
13
- TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
14
-
15
- enable_speaker
16
- enable_simple_cache
17
- common_constructor :root_directory, :options, default: [{}] do
18
- self.root_directory = root_directory.to_pathname
19
- run
20
- end
21
-
22
- def eac_ruby_gem_support_version
23
- dependency_version('eac_ruby_gem_support')
24
- end
25
-
26
- def eac_ruby_utils_version
27
- dependency_version('eac_ruby_utils')
28
- end
29
-
30
- def name
31
- root_directory.basename.to_s
32
- end
33
-
34
- def lib_path
35
- name.split('-').join('/')
36
- end
37
-
38
- def root_module
39
- lib_path.camelize
40
- end
41
-
42
- def root_module_close
43
- root_module_components.count.times.map do |index|
44
- (IDENT * index) + 'end'
45
- end.reverse.join("\n")
46
- end
47
-
48
- def root_module_inner_identation
49
- IDENT * root_module_components.count
50
- end
51
-
52
- def root_module_open
53
- root_module_components.each_with_index.map do |component, index|
54
- (IDENT * index) + 'module ' + component
55
- end.join("\n")
56
- end
57
-
58
- def root_module_components
59
- root_module.split('::')
60
- end
61
-
62
- protected
63
-
64
- def apply_to_root_directory(template, subpath)
65
- if template.is_a?(::EacTemplates::Directory)
66
- template.children.each do |child|
67
- apply_to_root_directory(child, subpath.join(child.basename))
68
- end
69
- elsif template.is_a?(::EacTemplates::File)
70
- template.apply_to_file(template_variables, root_directory.join(subpath))
71
- else
72
- raise "Unknown template object: #{template}"
73
- end
74
- end
75
-
76
- def dependency_version(gem_name)
77
- VersionBuilder.new(gem_name, options).to_s
78
- end
79
-
80
- def generate_gemspec
81
- template_apply('gemspec', "#{name}.gemspec")
82
- end
83
-
84
- def generate_gemfile_lock
85
- self_gem.bundle('install').chdir_root.execute!
86
- end
87
-
88
- def generate_root_directory
89
- root_directory.mkpath
90
- end
91
-
92
- def generate_root_lib
93
- template_apply('root_lib', "lib/#{lib_path}.rb")
94
- end
95
-
96
- def generate_static
97
- template.child('static').apply(self, root_directory)
98
- end
99
-
100
- def generate_version_lib
101
- template_apply('version', "lib/#{lib_path}/version.rb")
102
- end
103
-
104
- def run
105
- infov 'Root directory', root_directory
106
- infov 'Gem name', name
107
- JOBS.each do |job|
108
- infom "Generating #{job.humanize}..."
109
- send("generate_#{job}")
110
- end
111
- end
112
-
113
- def self_gem_uncached
114
- ::Avm::EacRubyBase1::Sources::Base.new(root_directory)
115
- end
116
-
117
- def template_apply(from, to)
118
- target = root_directory.join(to)
119
- target.dirname.mkpath
120
- template.child("#{from}.template").apply_to_file(self, target.to_path)
121
- end
122
-
123
- class VersionBuilder
124
- enable_simple_cache
125
- common_constructor :gem_name, :options
126
-
127
- def to_s
128
- r = "'~> #{two_segments}'"
129
- r += ", '>= #{three_segments}'" if segments.count >= 3 && segments[2].positive?
130
- r
131
- end
132
-
133
- # @return [Gem::Version]
134
- def version
135
- (options_version || default_version)
136
- end
137
-
138
- def two_segments
139
- segments.first(2).join('.')
140
- end
141
-
142
- def three_segments
143
- segments.first(3).join('.')
144
- end
145
-
146
- private
147
-
148
- def segments_uncached
149
- version.release.to_s.split('.').map(&:to_i)
150
- end
151
-
152
- def default_version
153
- ::Gem.loaded_specs[gem_name].version
154
- end
155
-
156
- def options_version
157
- options["#{gem_name}_version".to_sym].if_present do |v|
158
- ::Gem::Version.new(v)
159
- end
160
- end
161
- end
162
- end
163
- end
164
- end
165
- end
data/lib/avm/ruby/gems.rb DELETED
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- module Gems
8
- require_sub __FILE__
9
- end
10
- end
11
- end
data/lib/avm/ruby.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Ruby
7
- require_sub __FILE__
8
- end
9
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/ruby/gems/generator'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Tools
8
- class Runner
9
- class Ruby
10
- class Gems
11
- class Generate
12
- runner_with :help do
13
- desc 'Create a gem.'
14
- arg_opt '--eac-ruby-utils-version', 'Version for "eac_ruby_utils" gem.'
15
- arg_opt '--eac-ruby-gem-support-version', 'Version for "eac_ruby_gem_support" gem.'
16
- pos_arg :path
17
- end
18
-
19
- def run
20
- success "Gem \"#{generator.name}\" created in \"#{generator.root_directory}\""
21
- end
22
-
23
- private
24
-
25
- def generator_uncached
26
- ::Avm::Ruby::Gems::Generator.new(parsed.path, generator_options)
27
- end
28
-
29
- def generator_options
30
- %w[eac_ruby_utils eac_ruby_gem_support].map do |gem_name|
31
- ["#{gem_name}_version".to_sym, parsed.fetch("#{gem_name.variableize}_version")]
32
- end.to_h
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/core_ext'
4
-
5
- module Avm
6
- module Tools
7
- class Runner
8
- class Ruby
9
- class Gems
10
- require_sub __FILE__
11
- runner_with :help, :subcommands do
12
- desc 'Rubygems utilities for AVM.'
13
- subcommands
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
-
5
- require '%%LIB_PATH%%/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = '%%NAME%%'
9
- s.version = %%ROOT_MODULE%%::VERSION
10
- s.authors = ['Put here the authors']
11
- s.summary = 'Put here de description.'
12
-
13
- s.files = Dir['{lib}/**/*']
14
-
15
- s.add_dependency 'eac_ruby_utils', %%EAC_RUBY_UTILS_VERSION%%
16
-
17
- s.add_development_dependency 'eac_ruby_gem_support', %%EAC_RUBY_GEM_SUPPORT_VERSION%%
18
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- %%ROOT_MODULE_OPEN%%
6
- %%ROOT_MODULE_INNER_IDENTATION%%require_sub __FILE__
7
- %%ROOT_MODULE_CLOSE%%
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- %%ROOT_MODULE_OPEN%%
4
- %%ROOT_MODULE_INNER_IDENTATION%%VERSION = '0.0.0'
5
- %%ROOT_MODULE_CLOSE%%