eac_tools 0.16.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -15
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +24 -0
  5. data/sub/avm/lib/avm/entries/uri_builder.rb +85 -0
  6. data/sub/avm/lib/avm/instances/base/auto_values/install.rb +6 -9
  7. data/sub/avm/lib/avm/instances/base/auto_values.rb +2 -8
  8. data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
  9. data/sub/avm/lib/avm/registry/source_generators.rb +3 -2
  10. data/sub/avm/lib/avm/source_generators/base.rb +16 -1
  11. data/sub/avm/lib/avm/source_generators/option.rb +11 -0
  12. data/sub/avm/lib/avm/source_generators/option_list.rb +32 -0
  13. data/sub/avm/lib/avm/source_generators/runner.rb +52 -0
  14. data/sub/avm/lib/avm/sources/runner.rb +38 -0
  15. data/sub/avm/lib/avm/version.rb +1 -1
  16. data/sub/avm/spec/lib/avm/instances/base_spec.rb +18 -1
  17. data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
  18. data/sub/avm/spec/lib/avm/sources/runner_spec.rb +9 -0
  19. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb +12 -0
  20. data/sub/{avm-tools/lib/avm/rails.rb → avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb} +4 -2
  21. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
  22. data/sub/avm-eac_latex_base0/Gemfile +8 -0
  23. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +20 -0
  24. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +19 -0
  25. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +13 -0
  26. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +38 -0
  27. data/sub/{avm-tools/lib/avm/ruby/bundler.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/instances.rb} +2 -2
  28. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/base.rb +44 -0
  29. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb +49 -0
  30. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/commons.rb +16 -0
  31. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/copy_files.rb +45 -0
  32. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/base_stereotype.rb +23 -0
  33. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/chapter_index.rb +27 -0
  34. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/tex_source.rb +37 -0
  35. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file.rb +49 -0
  36. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +119 -0
  37. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb +43 -0
  38. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_single.rb +33 -0
  39. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/info.rb +32 -0
  40. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners.rb +13 -0
  41. data/sub/{avm-tools/lib/avm/ruby/gems.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/sources.rb} +2 -2
  42. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +7 -0
  43. data/sub/{avm-tools/lib/avm/ruby.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0.rb} +1 -1
  44. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem → avm-eac_latex_base0}/spec/rubocop_spec.rb +0 -0
  45. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem → avm-eac_latex_base0}/spec/spec_helper.rb +0 -0
  46. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/all.tex +0 -0
  47. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/ebook.tex +0 -0
  48. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/images.tex +0 -0
  49. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/links.tex +0 -0
  50. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/portuguese.tex +0 -0
  51. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/source_code/java.tex +0 -0
  52. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/source_code.tex +0 -0
  53. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/utils.tex +0 -0
  54. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  55. 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
  56. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb +11 -0
  57. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb +84 -0
  58. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  59. 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
  60. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile +8 -0
  61. 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
  62. 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
  63. 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
  64. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem}/spec/rubocop_spec.rb +0 -0
  65. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem}/spec/spec_helper.rb +0 -0
  66. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile +8 -0
  67. 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
  68. 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
  69. 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
  70. data/sub/{avm-tools/template/avm/ruby/gems/generator/static → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem}/spec/rubocop_spec.rb +0 -0
  71. data/sub/{avm-tools/template/avm/ruby/gems/generator/static → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem}/spec/spec_helper.rb +0 -0
  72. 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
  73. 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
  74. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile +8 -0
  75. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/rubocop_spec.rb +3 -0
  76. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/spec_helper.rb +4 -0
  77. 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
  78. data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +1 -0
  79. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
  80. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
  81. data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +4 -3
  82. data/sub/avm-tools/avm-tools.gemspec +1 -1
  83. data/sub/avm-tools/lib/avm/tools/runner/app_src.rb +4 -14
  84. data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +2 -35
  85. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  86. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
  87. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
  88. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
  89. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  90. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
  91. metadata +111 -71
  92. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
  93. data/sub/avm-tools/lib/avm/eac_writings_base0/apache_host.rb +0 -17
  94. data/sub/avm-tools/lib/avm/eac_writings_base0/commons.rb +0 -12
  95. data/sub/avm-tools/lib/avm/eac_writings_base0/deploy.rb +0 -36
  96. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
  97. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
  98. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
  99. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build.rb +0 -45
  100. data/sub/avm-tools/lib/avm/eac_writings_base0/instance.rb +0 -11
  101. data/sub/avm-tools/lib/avm/eac_writings_base0/project.rb +0 -33
  102. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
  103. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
  104. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build.rb +0 -117
  105. data/sub/avm-tools/lib/avm/eac_writings_base0.rb +0 -9
  106. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
  107. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
  108. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
  109. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
  110. data/sub/avm-tools/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
  111. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
  112. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems.rb +0 -19
  113. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile +0 -5
  114. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile.lock +0 -1
  115. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile +0 -5
  116. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile.lock +0 -1
  117. data/sub/avm-tools/template/avm/ruby/gems/generator/static/Gemfile +0 -5
@@ -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
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module SourceGenerators
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module Sources
8
+ module Runners
9
+ class Bundler
10
+ class GemfileLocal
11
+ runner_with :help do
12
+ bool_opt '-w', '--write', 'Write the Gemfile.local file.'
13
+ end
14
+
15
+ def run
16
+ start_banner
17
+ run_bundle
18
+ siblings_banner
19
+ write_gemfile_local
20
+ end
21
+
22
+ private
23
+
24
+ def gemfile_local_path
25
+ the_source.path.join('Gemfile.local')
26
+ end
27
+
28
+ def gemfile_local_content
29
+ siblings.map { |s| sibling_gemfile_local_line(s) }.join
30
+ end
31
+
32
+ def run_bundle
33
+ the_source.bundle.execute!
34
+ rescue ::RuntimeError
35
+ the_source.bundle('update').execute!
36
+ end
37
+
38
+ def sibling_gemfile_local_line(sibling)
39
+ ["gem '#{sibling.gem_name}'",
40
+ "path: ::File.expand_path('" +
41
+ sibling.path.relative_path_from(the_source.path).to_path +
42
+ "', __dir__)"].join(', ') + "\n"
43
+ end
44
+
45
+ def start_banner
46
+ runner_context.call(:source_banner)
47
+ infov 'Parent', the_source.parent
48
+ end
49
+
50
+ def siblings_banner
51
+ infov 'Siblings', siblings.count
52
+ siblings.each do |sibling|
53
+ infov ' * ', sibling.relative_path
54
+ end
55
+ end
56
+
57
+ def write_gemfile_local
58
+ return unless parsed.write?
59
+
60
+ infom "Writing #{gemfile_local_path}..."
61
+ gemfile_local_path.write(gemfile_local_content)
62
+ end
63
+
64
+ def siblings_uncached
65
+ the_source.parent.if_present([]) do |v|
66
+ v.subs.select { |sub| dependency_sub?(sub) }
67
+ end
68
+ end
69
+
70
+ def the_source
71
+ runner_context.call(:source)
72
+ end
73
+
74
+ def dependency_sub?(sub)
75
+ sub.is_a?(::Avm::EacRubyBase1::Sources::Base) &&
76
+ sub.gem_name != the_source.gem_name &&
77
+ the_source.gemfile_lock_gem_version(sub.gem_name).present?
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.12.0'
5
+ VERSION = '0.16.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
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
+ s.add_dependency 'avm', '~> 0.35'
15
16
  s.add_dependency 'avm-eac_webapp_base0', '~> 0.3', '>= 0.3.1'
16
17
  s.add_dependency 'eac_ruby_utils', '~> 0.97'
17
18
 
@@ -15,11 +15,11 @@ module Avm
15
15
  end
16
16
 
17
17
  def system_user
18
- instance.read_entry('system.username')
18
+ instance.install_username
19
19
  end
20
20
 
21
21
  def system_group
22
- instance.read_entry('system.groupname')
22
+ instance.install_groupname
23
23
  end
24
24
  end
25
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWordpressBase0
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
3
4
  require 'avm/eac_wordpress_base0/instances/apache_host'
4
5
  require 'avm/eac_wordpress_base0/instances/base'
5
6
 
@@ -12,9 +13,9 @@ RSpec.describe ::Avm::EacWordpressBase0::Instances::ApacheHost do
12
13
  end
13
14
 
14
15
  before do
15
- instance.entry('fs_path').write('/path/to/stub-app_0')
16
- instance.entry('web.url').write('http://stubapp.net')
17
- instance.entry('system.username').write('myuser')
16
+ instance.entry(::Avm::Instances::EntryKeys::FS_PATH).write('/path/to/stub-app_0')
17
+ instance.entry(::Avm::Instances::EntryKeys::WEB_URL).write('http://stubapp.net')
18
+ instance.entry(::Avm::Instances::EntryKeys::INSTALL_USERNAME).write('myuser')
18
19
  end
19
20
 
20
21
  it 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.131.0'
6
6
  end
7
7
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+
5
+ module Addressable
6
+ class URI
7
+ # @return [ActiveSupport:HashWithIndifferentAccess]
8
+ def hash_query_values
9
+ (query_values || {}).with_indifferent_access
10
+ end
11
+
12
+ def query_value(*args)
13
+ if args.count == 1
14
+ query_value_get(*args)
15
+ elsif args.count == 2
16
+ query_value_set(*args)
17
+ else
18
+ raise ::ArgumentError, "#{object.class}.#{__method__}: wrong number of arguments" \
19
+ " (given #{args.count}, expected 1..2)"
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def query_value_get(name)
26
+ hash_query_values[name]
27
+ end
28
+
29
+ def query_value_set(name, value)
30
+ new_query_values = hash_query_values
31
+ new_query_values[name] = value
32
+ self.query_values = new_query_values
33
+
34
+ self
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.97.0'
4
+ VERSION = '0.98.0'
5
5
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patches/addressable/uri/query_value'
4
+
5
+ RSpec.describe ::Addressable::URI do
6
+ subject(:instance) { described_class.parse('http://example.net') }
7
+
8
+ it { expect(instance.query_values).to be_nil }
9
+ it { expect(instance.hash_query_values).to eq({}) }
10
+
11
+ it { expect(instance.query_value('param1')).to be_nil }
12
+ it { expect(instance.query_value(:param1)).to be_nil }
13
+
14
+ context 'when param is set' do
15
+ let(:set_result) { instance.query_value(:param1, :value1) }
16
+
17
+ before { set_result }
18
+
19
+ it { expect(set_result).to eq(instance) }
20
+ it { expect(instance.query_values).to eq({ 'param1' => 'value1' }) }
21
+ it { expect(instance.hash_query_values).to eq({ 'param1' => 'value1' }) }
22
+ it { expect(instance.query_value('param1')).to eq('value1') }
23
+ it { expect(instance.query_value(:param1)).to eq('value1') }
24
+ end
25
+ end