eac_tools 0.16.1 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/registry/source_generators.rb +3 -2
  5. data/sub/avm/lib/avm/source_generators/base.rb +16 -1
  6. data/sub/avm/lib/avm/source_generators/option.rb +11 -0
  7. data/sub/avm/lib/avm/source_generators/option_list.rb +32 -0
  8. data/sub/avm/lib/avm/source_generators/runner.rb +52 -0
  9. data/sub/avm/lib/avm/sources/runner.rb +38 -0
  10. data/sub/avm/lib/avm/version.rb +1 -1
  11. data/sub/avm/spec/lib/avm/sources/runner_spec.rb +9 -0
  12. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  13. data/sub/{avm-tools/lib/avm/ruby/gems/generator.rb → avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb} +27 -16
  14. data/sub/{avm-tools/lib/avm/ruby/bundler.rb → avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb} +2 -2
  15. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  16. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec.rb → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb} +8 -6
  17. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/Gemfile +0 -0
  18. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/dashed-mygem.gemspec +0 -0
  19. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/lib/dashed/mygem/version.rb +0 -0
  20. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/lib/dashed/mygem.rb +0 -0
  21. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/spec/rubocop_spec.rb +0 -0
  22. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/spec/spec_helper.rb +0 -0
  23. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/Gemfile +0 -0
  24. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/lib/mygem/version.rb +0 -0
  25. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/lib/mygem.rb +0 -0
  26. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/mygem.gemspec +0 -0
  27. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/spec/rubocop_spec.rb +0 -0
  28. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/spec/spec_helper.rb +0 -0
  29. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/gemspec.template +0 -0
  30. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/root_lib.template +0 -0
  31. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/static/Gemfile +0 -0
  32. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/static/spec/rubocop_spec.rb +0 -0
  33. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/static/spec/spec_helper.rb +0 -0
  34. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/version.template +0 -0
  35. data/sub/avm-tools/avm-tools.gemspec +1 -1
  36. data/sub/avm-tools/lib/avm/tools/runner/app_src.rb +4 -14
  37. data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +2 -35
  38. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  39. metadata +32 -40
  40. data/sub/avm-tools/lib/avm/rails.rb +0 -9
  41. data/sub/avm-tools/lib/avm/ruby/gems.rb +0 -11
  42. data/sub/avm-tools/lib/avm/ruby.rb +0 -9
  43. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
  44. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems.rb +0 -19
  45. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile.lock +0 -1
  46. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile.lock +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 513a7b1831ba2dd5e165031fc1f689131b075ec62f7e2c78183930d58c7ed5de
4
- data.tar.gz: 96f079c0f2d9959141fd525d85c0ed635a1995875a46f2b8f41c9dac9635287b
3
+ metadata.gz: 331f73c00105798972e35c3eb8049f412eceecf7ce6805f2b96be3d97999c3c9
4
+ data.tar.gz: ebe8e2dc8c9245bfa657a9ff036620280e4e81c808e85f98bc543758bac64738
5
5
  SHA512:
6
- metadata.gz: ae94b169daea661a21523243641efb35835496fd7d359e78ef7b97028a75930ad4b10af288163d54c3c72249de64695d6c7036ee39ee3aa45fdb06d7f13f2456
7
- data.tar.gz: 465d94225c6ac9016e4943dce37019ca37aa1b5a738d81df766dfb3512f24eeaab2cdac9e320b2858f38a60c0e6664b3bc3fbcb9b0866a879ac7458fb200db94
6
+ metadata.gz: 2cb086332be7545caf2bd3d288f35c11ab444b7dc826a7798f8b45c65e6e33a10e7209c19e72acb2a7c5ae5940cd55881c9c94fe9f4786c0093d2fe87cf7ada3
7
+ data.tar.gz: c4376b3c09a9c577c2c97e6434edbd13d268d21d09d1a6d5ec4e2808ca56d2c3cb3f094cdcda91e964eef70b6480407b693a8913af4b0b6427221580250ef8b4
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.16.1)
4
+ eac_tools (0.17.0)
5
5
  avm-eac_asciidoctor_base0 (~> 0.4)
6
6
  avm-eac_generic_base0 (~> 0.4)
7
7
  avm-eac_rails_base0 (~> 0.6, >= 0.6.1)
8
8
  avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
9
9
  avm-eac_redmine_base0 (~> 0.11)
10
10
  avm-eac_redmine_plugin_base0 (~> 0.3)
11
- avm-eac_ruby_base1 (~> 0.12)
11
+ avm-eac_ruby_base1 (~> 0.13)
12
12
  avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
13
13
  avm-eac_wordpress_base0 (~> 0.1)
14
- avm-tools (~> 0.129, >= 0.129.1)
14
+ avm-tools (~> 0.130)
15
15
  eac_ruby_utils (~> 0.97)
16
16
 
17
17
  PATH
@@ -70,8 +70,8 @@ PATH
70
70
  PATH
71
71
  remote: sub/avm-eac_ruby_base1
72
72
  specs:
73
- avm-eac_ruby_base1 (0.12.0)
74
- avm (~> 0.26)
73
+ avm-eac_ruby_base1 (0.13.0)
74
+ avm (~> 0.34)
75
75
  avm-eac_generic_base0 (~> 0.2)
76
76
  eac_ruby_utils (~> 0.95, >= 0.95.1)
77
77
 
@@ -95,9 +95,9 @@ PATH
95
95
  PATH
96
96
  remote: sub/avm-tools
97
97
  specs:
98
- avm-tools (0.129.1)
98
+ avm-tools (0.130.0)
99
99
  aranha-parsers (~> 0.4)
100
- avm (~> 0.30)
100
+ avm (~> 0.34)
101
101
  avm-eac_ruby_base1 (~> 0.8)
102
102
  avm-eac_ubuntu_base0 (~> 0.3)
103
103
  avm-files (~> 0.1)
@@ -113,7 +113,7 @@ PATH
113
113
  PATH
114
114
  remote: sub/avm
115
115
  specs:
116
- avm (0.33.0)
116
+ avm (0.34.0)
117
117
  eac_cli (~> 0.27, >= 0.27.6)
118
118
  eac_config (~> 0.10)
119
119
  eac_docker (~> 0.3)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.16.1'
4
+ VERSION = '0.17.0'
5
5
  end
@@ -8,8 +8,9 @@ module Avm
8
8
  class SourceGenerators < ::Avm::Registry::FromGems
9
9
  # @return [Avm::Instances::Base, nil]
10
10
  def class_detect(klass, detect_args)
11
- stereotype_name, target_path = detect_args
12
- klass.application_stereotype.name == stereotype_name ? klass.new(target_path) : nil
11
+ detect_args = detect_args.dup
12
+ stereotype_name = detect_args.shift
13
+ klass.application_stereotype.name == stereotype_name ? klass.new(*detect_args) : nil
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/source_generators/option_list'
3
4
  require 'avm/with/application_stereotype'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -7,8 +8,22 @@ module Avm
7
8
  module SourceGenerators
8
9
  class Base
9
10
  include ::Avm::With::ApplicationStereotype
10
- common_constructor :target_path do
11
+
12
+ class << self
13
+ # @return [Avm::SourceGenerators::OptionList]
14
+ def option_list
15
+ Avm::SourceGenerators::OptionList.new
16
+ end
17
+ end
18
+
19
+ common_constructor :target_path, :options, default: [{}] do
11
20
  self.target_path = target_path.to_pathname
21
+ self.options = option_list.validate(options)
22
+ end
23
+
24
+ # @return [Avm::SourceGenerators::OptionList]
25
+ def option_list
26
+ self.class.option_list
12
27
  end
13
28
 
14
29
  def perform
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module SourceGenerators
5
+ class Option
6
+ common_constructor :name, :description, default: [nil] do
7
+ self.name = name.to_sym
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/source_generators/option'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class OptionList
9
+ enable_immutable
10
+ immutable_accessor :option, type: :array
11
+
12
+ alias immutable_option option
13
+
14
+ def option(*args)
15
+ immutable_option(::Avm::SourceGenerators::Option.new(*args))
16
+ end
17
+
18
+ # @return [Hash<Symbol, String>]
19
+ def validate(options_hash)
20
+ options_hash.transform_keys { |k| validate_option(k) }
21
+ end
22
+
23
+ def validate_option(option_name)
24
+ option_name = option_name.to_sym
25
+
26
+ return option_name if options.any? { |option| option.name == option_name }
27
+
28
+ raise "No option found with name \"#{option_name}\""
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class Runner
9
+ OPTION_NAME_VALUE_SEPARATOR = ':'
10
+
11
+ runner_with :help do
12
+ arg_opt '-o', '--option', 'Option for generator.', repeat: true, optional: true
13
+ pos_arg :stereotype_name
14
+ pos_arg :target_path
15
+ end
16
+
17
+ def run
18
+ start_banner
19
+ generate
20
+ end
21
+
22
+ def generate
23
+ infom 'Generating...'
24
+ generator.perform
25
+ success "Source generated in \"#{generator.target_path}\""
26
+ end
27
+
28
+ def start_banner
29
+ infov 'Stereotype', stereotype_name
30
+ infov 'Target path', target_path
31
+ infov 'Generator', generator.class
32
+ end
33
+
34
+ def generator_uncached
35
+ ::Avm::Registry.source_generators
36
+ .detect_optional(stereotype_name, target_path, options) ||
37
+ fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
38
+ end
39
+
40
+ delegate :stereotype_name, to: :parsed
41
+
42
+ # @return [Hash<String, String>]
43
+ def options
44
+ parsed.option.map { |v| v.split(OPTION_NAME_VALUE_SEPARATOR) }.to_h
45
+ end
46
+
47
+ def target_path
48
+ parsed.target_path.to_pathname
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module Sources
7
+ class Runner
8
+ runner_with :help, :subcommands do
9
+ desc 'Root command for sources.'
10
+ arg_opt '-C', '--path', 'Path to the source.', default: '.'
11
+ subcommands
12
+ end
13
+
14
+ def extra_available_subcommands
15
+ optional_source.if_present({}, &:extra_available_subcommands)
16
+ end
17
+
18
+ def source_banner
19
+ infov 'Source', source
20
+ end
21
+
22
+ # @return [Pathname]
23
+ def source_path
24
+ parsed.path.to_pathname
25
+ end
26
+
27
+ private
28
+
29
+ def source_uncached
30
+ ::Avm::Registry.sources.detect(source_path)
31
+ end
32
+
33
+ def optional_source_uncached
34
+ ::Avm::Registry.sources.detect_optional(source_path)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.33.0'
4
+ VERSION = '0.34.0'
5
5
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/runner'
4
+
5
+ ::RSpec.describe ::Avm::Sources::Runner do
6
+ it do
7
+ expect { described_class.run(argv: %w[--help]) }.not_to raise_error
8
+ end
9
+ end
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Put here the authors']
11
11
  s.summary = 'Put here de description.'
12
12
 
13
- s.files = Dir['{lib,locale}/**/*']
13
+ s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.26'
15
+ s.add_dependency 'avm', '~> 0.34'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.2'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.1'
18
18
 
@@ -1,22 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_ruby_base1/sources/base'
4
+ require 'avm/source_generators/base'
4
5
  require 'eac_templates/core_ext'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
7
8
  module Avm
8
- module Ruby
9
- module Gems
10
- class Generator
9
+ module EacRubyBase1
10
+ module SourceGenerators
11
+ class Base < ::Avm::SourceGenerators::Base
11
12
  IDENT = ' '
12
13
  JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
13
14
  TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
15
+ OPTIONS = {
16
+ 'eac-ruby-utils-version'.to_sym => 'Version for "eac_ruby_utils" gem.',
17
+ 'eac-ruby-gem-support-version'.to_sym => 'Version for "eac_ruby_gem_support" gem.'
18
+ }.freeze
14
19
 
15
20
  enable_speaker
16
21
  enable_simple_cache
17
- common_constructor :root_directory, :options, default: [{}] do
18
- self.root_directory = root_directory.to_pathname
19
- run
22
+
23
+ class << self
24
+ def option_list
25
+ OPTIONS.inject(super) { |a, e| a.option(*e) }
26
+ end
27
+ end
28
+
29
+ def root_directory
30
+ target_path
20
31
  end
21
32
 
22
33
  def eac_ruby_gem_support_version
@@ -35,6 +46,15 @@ module Avm
35
46
  name.split('-').join('/')
36
47
  end
37
48
 
49
+ def perform
50
+ infov 'Root directory', root_directory
51
+ infov 'Gem name', name
52
+ JOBS.each do |job|
53
+ infom "Generating #{job.humanize}..."
54
+ send("generate_#{job}")
55
+ end
56
+ end
57
+
38
58
  def root_module
39
59
  lib_path.camelize
40
60
  end
@@ -101,15 +121,6 @@ module Avm
101
121
  template_apply('version', "lib/#{lib_path}/version.rb")
102
122
  end
103
123
 
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
124
  def self_gem_uncached
114
125
  ::Avm::EacRubyBase1::Sources::Base.new(root_directory)
115
126
  end
@@ -154,7 +165,7 @@ module Avm
154
165
  end
155
166
 
156
167
  def options_version
157
- options["#{gem_name}_version".to_sym].if_present do |v|
168
+ options["#{gem_name}_version".dasherize.to_sym].if_present do |v|
158
169
  ::Gem::Version.new(v)
159
170
  end
160
171
  end
@@ -3,8 +3,8 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module Ruby
7
- module Bundler
6
+ module EacRubyBase1
7
+ module SourceGenerators
8
8
  require_sub __FILE__
9
9
  end
10
10
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.12.0'
5
+ VERSION = '0.13.0'
6
6
  end
7
7
  end
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/tools/runner'
3
+ require 'avm/eac_ruby_base1/source_generators/base'
4
+ require 'avm/source_generators/runner'
4
5
 
5
- RSpec.describe ::Avm::Tools::Runner::Ruby::Gems::Generate do
6
- let(:targets_root) { ::Pathname.new('generate_spec_files').expand_path(__dir__) }
6
+ RSpec.describe ::Avm::EacRubyBase1::SourceGenerators::Base do
7
+ let(:targets_root) { ::Pathname.new('base_spec_files').expand_path(__dir__) }
7
8
 
8
9
  %w[mygem dashed-mygem].each do |gem_name|
9
10
  context "when runner is executed for #{gem_name}" do
11
+ let(:stereotype) { 'EacRubyBase1' }
10
12
  let(:target_dir) { targets_root.join(gem_name) }
11
13
  let(:temp_dir) { ::EacRubyUtils::Fs::Temp.directory }
12
14
  let(:gem_path) { temp_dir.join(gem_name) }
13
15
  let(:argv) do
14
- %w[ruby gems generate --eac-ruby-utils-version=0.35.0
15
- --eac-ruby-gem-support-version=0.2.0] + [gem_path.to_path]
16
+ %w[--option eac-ruby-utils-version:0.35.0 --option eac-ruby-gem-support-version:0.2.0] +
17
+ [stereotype, gem_path.to_path]
16
18
  end
17
19
 
18
20
  before do
19
- ::Avm::Tools::Runner.run(argv: argv)
21
+ ::Avm::SourceGenerators::Runner.run(argv: argv)
20
22
  end
21
23
 
22
24
  after do
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.4'
18
- s.add_dependency 'avm', '~> 0.30'
18
+ s.add_dependency 'avm', '~> 0.34'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.8'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
21
21
  s.add_dependency 'avm-files', '~> 0.1'
@@ -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: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
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: avm-eac_asciidoctor_base0
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: '0.12'
115
+ version: '0.13'
116
116
  type: :runtime
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '0.12'
122
+ version: '0.13'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: avm-eac_webapp_base0
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -160,20 +160,14 @@ dependencies:
160
160
  requirements:
161
161
  - - "~>"
162
162
  - !ruby/object:Gem::Version
163
- version: '0.129'
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: 0.129.1
163
+ version: '0.130'
167
164
  type: :runtime
168
165
  prerelease: false
169
166
  version_requirements: !ruby/object:Gem::Requirement
170
167
  requirements:
171
168
  - - "~>"
172
169
  - !ruby/object:Gem::Version
173
- version: '0.129'
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- version: 0.129.1
170
+ version: '0.130'
177
171
  - !ruby/object:Gem::Dependency
178
172
  name: eac_ruby_utils
179
173
  requirement: !ruby/object:Gem::Requirement
@@ -383,6 +377,8 @@ files:
383
377
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb
384
378
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/dependency.rb
385
379
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/version_file.rb
380
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb
381
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb
386
382
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources.rb
387
383
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb
388
384
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundle_command.rb
@@ -412,6 +408,19 @@ files:
412
408
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.target.yaml
413
409
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/rubygems/version_file_spec.rb
414
410
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/rubygems/version_file_spec_files/a_version_file.rb
411
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb
412
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile
413
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/dashed-mygem.gemspec
414
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/lib/dashed/mygem.rb
415
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/lib/dashed/mygem/version.rb
416
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/spec/rubocop_spec.rb
417
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/spec/spec_helper.rb
418
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile
419
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/lib/mygem.rb
420
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/lib/mygem/version.rb
421
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/mygem.gemspec
422
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/spec/rubocop_spec.rb
423
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/spec/spec_helper.rb
415
424
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec.rb
416
425
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Gemfile
417
426
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Rakefile
@@ -422,6 +431,12 @@ files:
422
431
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base_spec.rb
423
432
  - sub/avm-eac_ruby_base1/spec/rubocop_spec.rb
424
433
  - sub/avm-eac_ruby_base1/spec/spec_helper.rb
434
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/gemspec.template
435
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/root_lib.template
436
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile
437
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/rubocop_spec.rb
438
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/spec_helper.rb
439
+ - sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/version.template
425
440
  - sub/avm-eac_webapp_base0/Gemfile
426
441
  - sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec
427
442
  - sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0.rb
@@ -543,11 +558,6 @@ files:
543
558
  - sub/avm-tools/lib/avm/projects/stereotypes/ruby_gem.rb
544
559
  - sub/avm-tools/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
545
560
  - sub/avm-tools/lib/avm/projects/stereotypes/ruby_gem/publish.rb
546
- - sub/avm-tools/lib/avm/rails.rb
547
- - sub/avm-tools/lib/avm/ruby.rb
548
- - sub/avm-tools/lib/avm/ruby/bundler.rb
549
- - sub/avm-tools/lib/avm/ruby/gems.rb
550
- - sub/avm-tools/lib/avm/ruby/gems/generator.rb
551
561
  - sub/avm-tools/lib/avm/stereotypes.rb
552
562
  - sub/avm-tools/lib/avm/tools.rb
553
563
  - sub/avm-tools/lib/avm/tools/app_src.rb
@@ -597,8 +607,6 @@ files:
597
607
  - sub/avm-tools/lib/avm/tools/runner/launcher/projects.rb
598
608
  - sub/avm-tools/lib/avm/tools/runner/launcher/publish.rb
599
609
  - sub/avm-tools/lib/avm/tools/runner/ruby.rb
600
- - sub/avm-tools/lib/avm/tools/runner/ruby/gems.rb
601
- - sub/avm-tools/lib/avm/tools/runner/ruby/gems/generate.rb
602
610
  - sub/avm-tools/lib/avm/tools/runner/ruby/rubocop.rb
603
611
  - sub/avm-tools/lib/avm/tools/runner/self.rb
604
612
  - sub/avm-tools/lib/avm/tools/runner/self/docker.rb
@@ -659,21 +667,6 @@ files:
659
667
  - sub/avm-tools/spec/lib/avm/tools/runner/git/deploy_spec.rb
660
668
  - sub/avm-tools/spec/lib/avm/tools/runner/git/deploy_spec_files/append1/stub3.txt.template
661
669
  - sub/avm-tools/spec/lib/avm/tools/runner/git/deploy_spec_files/append2/stub4.txt
662
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec.rb
663
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile
664
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile.lock
665
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/dashed-mygem.gemspec
666
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/lib/dashed/mygem.rb
667
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/lib/dashed/mygem/version.rb
668
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/spec/rubocop_spec.rb
669
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/spec/spec_helper.rb
670
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile
671
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile.lock
672
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/lib/mygem.rb
673
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/lib/mygem/version.rb
674
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/mygem.gemspec
675
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/spec/rubocop_spec.rb
676
- - sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/spec/spec_helper.rb
677
670
  - sub/avm-tools/spec/lib/avm/tools/runner/ruby/rubocop_spec.rb
678
671
  - sub/avm-tools/spec/lib/avm/tools/runner/ruby/rubocop_spec_files/dir1/dir3/Gemfile
679
672
  - sub/avm-tools/spec/lib/avm/tools/runner/ruby/rubocop_spec_files/dir1/dir3/Gemfile.lock
@@ -699,12 +692,6 @@ files:
699
692
  - sub/avm-tools/template/avm/eac_writings_base0/commons/source_code/java.tex
700
693
  - sub/avm-tools/template/avm/eac_writings_base0/commons/utils.tex
701
694
  - sub/avm-tools/template/avm/eac_writings_base0/deploy/index.html.template
702
- - sub/avm-tools/template/avm/ruby/gems/generator/gemspec.template
703
- - sub/avm-tools/template/avm/ruby/gems/generator/root_lib.template
704
- - sub/avm-tools/template/avm/ruby/gems/generator/static/Gemfile
705
- - sub/avm-tools/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb
706
- - sub/avm-tools/template/avm/ruby/gems/generator/static/spec/spec_helper.rb
707
- - sub/avm-tools/template/avm/ruby/gems/generator/version.template
708
695
  - sub/avm-tools/template/avm/self/docker_image/Dockerfile
709
696
  - sub/avm-tools/template/avm/self/docker_image/entrypoint.sh
710
697
  - sub/avm/Gemfile
@@ -787,6 +774,9 @@ files:
787
774
  - sub/avm/lib/avm/self/instance/entry_keys.rb
788
775
  - sub/avm/lib/avm/source_generators.rb
789
776
  - sub/avm/lib/avm/source_generators/base.rb
777
+ - sub/avm/lib/avm/source_generators/option.rb
778
+ - sub/avm/lib/avm/source_generators/option_list.rb
779
+ - sub/avm/lib/avm/source_generators/runner.rb
790
780
  - sub/avm/lib/avm/sources.rb
791
781
  - sub/avm/lib/avm/sources/base.rb
792
782
  - sub/avm/lib/avm/sources/base/configuration.rb
@@ -798,6 +788,7 @@ files:
798
788
  - sub/avm/lib/avm/sources/base/testing.rb
799
789
  - sub/avm/lib/avm/sources/configuration.rb
800
790
  - sub/avm/lib/avm/sources/configuration/rubocop.rb
791
+ - sub/avm/lib/avm/sources/runner.rb
801
792
  - sub/avm/lib/avm/sources/tests.rb
802
793
  - sub/avm/lib/avm/sources/tests/builder.rb
803
794
  - sub/avm/lib/avm/sources/tests/performer.rb
@@ -814,6 +805,7 @@ files:
814
805
  - sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml
815
806
  - sub/avm/spec/lib/avm/scms/base_spec.rb
816
807
  - sub/avm/spec/lib/avm/sources/base_spec.rb
808
+ - sub/avm/spec/lib/avm/sources/runner_spec.rb
817
809
  - sub/avm/spec/rubocop_spec.rb
818
810
  - sub/avm/spec/spec_helper.rb
819
811
  - sub/eac_cli/Gemfile
@@ -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 Gems
8
- require_sub __FILE__
9
- end
10
- end
11
- end
@@ -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