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.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -15
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +24 -0
- data/sub/avm/lib/avm/entries/uri_builder.rb +85 -0
- data/sub/avm/lib/avm/instances/base/auto_values/install.rb +6 -9
- data/sub/avm/lib/avm/instances/base/auto_values.rb +2 -8
- data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
- data/sub/avm/lib/avm/registry/source_generators.rb +3 -2
- data/sub/avm/lib/avm/source_generators/base.rb +16 -1
- data/sub/avm/lib/avm/source_generators/option.rb +11 -0
- data/sub/avm/lib/avm/source_generators/option_list.rb +32 -0
- data/sub/avm/lib/avm/source_generators/runner.rb +52 -0
- data/sub/avm/lib/avm/sources/runner.rb +38 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +18 -1
- data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
- data/sub/avm/spec/lib/avm/sources/runner_spec.rb +9 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb +12 -0
- data/sub/{avm-tools/lib/avm/rails.rb → avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb} +4 -2
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
- data/sub/avm-eac_latex_base0/Gemfile +8 -0
- data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +20 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +19 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +13 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +38 -0
- data/sub/{avm-tools/lib/avm/ruby/bundler.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/instances.rb} +2 -2
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/base.rb +44 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb +49 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/commons.rb +16 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/copy_files.rb +45 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/base_stereotype.rb +23 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/chapter_index.rb +27 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/tex_source.rb +37 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file.rb +49 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +119 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb +43 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_single.rb +33 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/info.rb +32 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners.rb +13 -0
- data/sub/{avm-tools/lib/avm/ruby/gems.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/sources.rb} +2 -2
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +7 -0
- data/sub/{avm-tools/lib/avm/ruby.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0.rb} +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
- 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
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb +11 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb +84 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- 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
- data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile +8 -0
- 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
- 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
- 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
- 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
- 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
- data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile +8 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile +8 -0
- data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/spec_helper.rb +4 -0
- 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
- data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +1 -0
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
- data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +4 -3
- data/sub/avm-tools/avm-tools.gemspec +1 -1
- data/sub/avm-tools/lib/avm/tools/runner/app_src.rb +4 -14
- data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +2 -35
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
- metadata +111 -71
- data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
- data/sub/avm-tools/lib/avm/eac_writings_base0/apache_host.rb +0 -17
- data/sub/avm-tools/lib/avm/eac_writings_base0/commons.rb +0 -12
- data/sub/avm-tools/lib/avm/eac_writings_base0/deploy.rb +0 -36
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build.rb +0 -45
- data/sub/avm-tools/lib/avm/eac_writings_base0/instance.rb +0 -11
- data/sub/avm-tools/lib/avm/eac_writings_base0/project.rb +0 -33
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build.rb +0 -117
- data/sub/avm-tools/lib/avm/eac_writings_base0.rb +0 -9
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
- data/sub/avm-tools/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
- data/sub/avm-tools/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
- data/sub/avm-tools/lib/avm/tools/runner/ruby/gems.rb +0 -19
- data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile +0 -5
- data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile.lock +0 -1
- data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile +0 -5
- data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile.lock +0 -1
- 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
|
9
|
-
module
|
10
|
-
class
|
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
|
-
|
18
|
-
|
19
|
-
|
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,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
|
@@ -1,22 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/eac_ruby_base1/source_generators/base'
|
4
|
+
require 'avm/source_generators/runner'
|
4
5
|
|
5
|
-
RSpec.describe ::Avm::
|
6
|
-
let(:targets_root) { ::Pathname.new('
|
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[
|
15
|
-
|
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::
|
21
|
+
::Avm::SourceGenerators::Runner.run(argv: argv)
|
20
22
|
end
|
21
23
|
|
22
24
|
after do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb
CHANGED
@@ -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(
|
16
|
-
instance.entry(
|
17
|
-
instance.entry(
|
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.
|
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
|
-
|
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(
|
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/
|
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
|
@@ -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,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
|