avm-tools 0.79.0 → 0.83.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/data/unit.rb +8 -3
  3. data/lib/avm/eac_rails_base0/apache_host.rb +2 -9
  4. data/lib/avm/eac_rails_base1/apache_host.rb +17 -0
  5. data/lib/avm/eac_rails_base1/runner/code_runner.rb +1 -2
  6. data/lib/avm/eac_rails_base1/runner/rails_server.rb +33 -0
  7. data/lib/avm/eac_redmine_base0/apache_host.rb +10 -0
  8. data/lib/avm/eac_redmine_base0/data_unit.rb +29 -1
  9. data/lib/avm/eac_writings_base1.rb +9 -0
  10. data/lib/avm/eac_writings_base1/build.rb +45 -0
  11. data/lib/avm/eac_writings_base1/build/file.rb +28 -0
  12. data/lib/avm/eac_writings_base1/project.rb +13 -0
  13. data/lib/avm/executables.rb +1 -1
  14. data/lib/avm/tools/runner/git/subrepo/fix.rb +65 -0
  15. data/lib/avm/tools/runner/local_project/eac_writings_base1.rb +32 -0
  16. data/lib/avm/tools/runner/local_project/eac_writings_base1/build.rb +48 -0
  17. data/lib/avm/tools/version.rb +1 -1
  18. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  19. data/vendor/eac_cli/lib/eac_cli/parser.rb +6 -4
  20. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +4 -0
  21. data/vendor/eac_cli/lib/eac_cli/runner.rb +10 -2
  22. data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
  23. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +17 -0
  24. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -1
  25. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  26. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -3
  27. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
  28. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
  29. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
  30. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
  31. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +31 -0
  32. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
  33. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
  34. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
  35. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
  36. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
  37. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
  38. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  39. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +30 -17
  40. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
  41. metadata +18 -4
  42. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +0 -36
  43. data/lib/avm/tools/runner/eac_rails_base0/runner.rb +0 -14
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/struct'
4
+
5
+ module EacRubyUtils
6
+ module Envs
7
+ class Command
8
+ module Concat
9
+ def concat(operator, other_command)
10
+ duplicate_by_extra_options(concat: ::EacRubyUtils::Struct.new(
11
+ operator: operator, command: other_command
12
+ ))
13
+ end
14
+
15
+ def or(other_command)
16
+ concat('||', other_command)
17
+ end
18
+
19
+ def pipe(other_command)
20
+ concat('|', other_command)
21
+ end
22
+
23
+ private
24
+
25
+ def append_concat(command)
26
+ extra_options[:concat].if_present(command) do |v|
27
+ "#{command} #{v.operator} #{v.command.command}"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ module Envs
5
+ class Command
6
+ module Envvars
7
+ def envvar(name, value)
8
+ duplicate_by_extra_options(envvars: envvars.merge(name => value))
9
+ end
10
+
11
+ private
12
+
13
+ def append_envvars(command)
14
+ e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
15
+ e.present? ? "#{e} #{command}" : command
16
+ end
17
+
18
+ def envvars
19
+ extra_options[:envvars] ||= {}.with_indifferent_access
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -12,39 +12,18 @@ module EacRubyUtils
12
12
  duplicate_by_extra_options(chdir: dir)
13
13
  end
14
14
 
15
- def envvar(name, value)
16
- duplicate_by_extra_options(envvars: envvars.merge(name => value))
17
- end
18
-
19
15
  def status_result(status_code, result)
20
16
  duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
21
17
  end
22
18
 
23
- def pipe(other_command)
24
- duplicate_by_extra_options(pipe: other_command)
25
- end
26
-
27
19
  private
28
20
 
29
21
  attr_reader :extra_options
30
22
 
31
- def envvars
32
- extra_options[:envvars] ||= {}.with_indifferent_access
33
- end
34
-
35
23
  def status_results
36
24
  extra_options[:status_results] ||= {}.with_indifferent_access
37
25
  end
38
26
 
39
- def append_envvars(command)
40
- e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
41
- e.present? ? "#{e} #{command}" : command
42
- end
43
-
44
- def append_pipe(command)
45
- extra_options[:pipe].present? ? "#{command} | #{extra_options[:pipe].command}" : command
46
- end
47
-
48
27
  def append_chdir(command)
49
28
  extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
50
29
  end
@@ -3,7 +3,7 @@
3
3
  require 'pathname'
4
4
 
5
5
  class Pathname
6
- def basename_sub
7
- parent.join(yield(basename))
6
+ def basename_sub(suffix = '')
7
+ parent.join(yield(basename(suffix)))
8
8
  end
9
9
  end
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/hash_with_indifferent_access'
4
+ require 'active_support/core_ext/module/delegation'
4
5
  require 'active_support/core_ext/object/blank'
5
6
 
6
7
  module EacRubyUtils
7
8
  class Struct
8
9
  def initialize(initial_data = {})
9
- self.data = ::ActiveSupport::HashWithIndifferentAccess.new(initial_data)
10
+ self.data = initial_data.symbolize_keys
10
11
  end
11
12
 
12
13
  def [](key)
@@ -19,6 +20,11 @@ module EacRubyUtils
19
20
  bool ? fetch(key).present? : data.fetch(key)
20
21
  end
21
22
 
23
+ def merge(other)
24
+ other = self.class.new(other) unless other.is_a?(self.class)
25
+ self.class.new(to_h.merge(other.to_h))
26
+ end
27
+
22
28
  def method_missing(method_name, *arguments, &block)
23
29
  property_method?(method_name) ? fetch(method_name) : super
24
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.54.0'
4
+ VERSION = '0.56.0'
5
5
  end
@@ -9,34 +9,47 @@ RSpec.describe ::EacRubyUtils::CommonConcern do
9
9
  end
10
10
  end
11
11
 
12
- module MyModule
13
- module ClassMethods
14
- def my_class_method
15
- 'class'
12
+ let(:stub_module) do
13
+ ::Module.new do
14
+ module ClassMethods # rubocop:disable RSpec/LeakyConstantDeclaration
15
+ def my_class_method
16
+ 'class'
17
+ end
16
18
  end
17
- end
18
19
 
19
- module InstanceMethods
20
- def my_instance_method
21
- 'instance'
20
+ module InstanceMethods # rubocop:disable RSpec/LeakyConstantDeclaration
21
+ def my_instance_method
22
+ 'instance'
23
+ end
22
24
  end
23
25
  end
24
26
  end
25
27
 
26
- class MyClass
27
- class << self
28
- attr_accessor :valor
28
+ let(:stub_class) do
29
+ ::Class.new do
30
+ class << self
31
+ attr_accessor :valor
32
+ end
33
+
34
+ def method1
35
+ 'from_stub_module'
36
+ end
29
37
  end
30
38
  end
31
39
 
32
- let(:subject) { MyClass.new }
40
+ let(:stub_class_instance) { stub_class.new }
33
41
 
34
42
  before do
35
- instance.setup(MyModule)
36
- MyClass.include MyModule
43
+ instance.setup(stub_module)
37
44
  end
38
45
 
39
- it { expect(subject.my_instance_method).to eq('instance') }
40
- it { expect(subject.class.my_class_method).to eq('class') }
41
- it { expect(subject.class.valor).to eq('changed') }
46
+ context 'when included' do
47
+ before do
48
+ stub_class.include stub_module
49
+ end
50
+
51
+ it { expect(stub_class_instance.my_instance_method).to eq('instance') }
52
+ it { expect(stub_class_instance.class.my_class_method).to eq('class') }
53
+ it { expect(stub_class_instance.class.valor).to eq('changed') }
54
+ end
42
55
  end
@@ -3,7 +3,8 @@
3
3
  require 'eac_ruby_utils/struct'
4
4
 
5
5
  RSpec.describe ::EacRubyUtils::Struct do
6
- let(:instance) { described_class.new(a: 1, b: '') }
6
+ let(:instance) { described_class.new('a' => 1, b: '') }
7
+ let(:other) { described_class.new('a' => 'm1', c: 'm2') }
7
8
 
8
9
  describe '#[]' do
9
10
  it { expect(instance[:a]).to eq(1) }
@@ -35,6 +36,12 @@ RSpec.describe ::EacRubyUtils::Struct do
35
36
  it { expect { instance.fetch('c?') }.to raise_error(::KeyError) }
36
37
  end
37
38
 
39
+ describe '#merge' do
40
+ let(:merged) { instance.merge(other) }
41
+
42
+ it { expect(merged.to_h).to eq(a: 'm1', b: '', c: 'm2') }
43
+ end
44
+
38
45
  describe '#property_method' do
39
46
  it { expect(instance.a).to eq(1) }
40
47
  it { expect(instance.a?).to eq(true) }
@@ -43,4 +50,8 @@ RSpec.describe ::EacRubyUtils::Struct do
43
50
  it { expect { instance.c }.to raise_error(::NoMethodError) }
44
51
  it { expect { instance.c? }.to raise_error(::NoMethodError) }
45
52
  end
53
+
54
+ describe '#to_h' do
55
+ it { expect(instance.to_h).to eq(a: 1, b: '') }
56
+ end
46
57
  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.79.0
4
+ version: 0.83.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: 2020-12-12 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -296,12 +296,15 @@ files:
296
296
  - lib/avm/eac_rails_base0/deploy.rb
297
297
  - lib/avm/eac_rails_base0/instance.rb
298
298
  - lib/avm/eac_rails_base1.rb
299
+ - lib/avm/eac_rails_base1/apache_host.rb
299
300
  - lib/avm/eac_rails_base1/instance.rb
300
301
  - lib/avm/eac_rails_base1/runner.rb
301
302
  - lib/avm/eac_rails_base1/runner/bundle.rb
302
303
  - lib/avm/eac_rails_base1/runner/code_runner.rb
304
+ - lib/avm/eac_rails_base1/runner/rails_server.rb
303
305
  - lib/avm/eac_rails_base1/runner_with/bundle.rb
304
306
  - lib/avm/eac_redmine_base0.rb
307
+ - lib/avm/eac_redmine_base0/apache_host.rb
305
308
  - lib/avm/eac_redmine_base0/core_update.rb
306
309
  - lib/avm/eac_redmine_base0/data_unit.rb
307
310
  - lib/avm/eac_redmine_base0/deploy.rb
@@ -343,6 +346,10 @@ files:
343
346
  - lib/avm/eac_writings_base0/project_build.rb
344
347
  - lib/avm/eac_writings_base0/project_build/chapters_content.rb
345
348
  - lib/avm/eac_writings_base0/project_build/copy_files.rb
349
+ - lib/avm/eac_writings_base1.rb
350
+ - lib/avm/eac_writings_base1/build.rb
351
+ - lib/avm/eac_writings_base1/build/file.rb
352
+ - lib/avm/eac_writings_base1/project.rb
346
353
  - lib/avm/executables.rb
347
354
  - lib/avm/files.rb
348
355
  - lib/avm/files/appendable.rb
@@ -486,8 +493,6 @@ files:
486
493
  - lib/avm/tools/runner.rb
487
494
  - lib/avm/tools/runner/eac_rails_base0.rb
488
495
  - lib/avm/tools/runner/eac_rails_base0/apache_path.rb
489
- - lib/avm/tools/runner/eac_rails_base0/rails_server.rb
490
- - lib/avm/tools/runner/eac_rails_base0/runner.rb
491
496
  - lib/avm/tools/runner/eac_redmine_base0.rb
492
497
  - lib/avm/tools/runner/eac_redmine_base0/core_update.rb
493
498
  - lib/avm/tools/runner/eac_redmine_base0/docker.rb
@@ -509,6 +514,7 @@ files:
509
514
  - lib/avm/tools/runner/git/subrepo.rb
510
515
  - lib/avm/tools/runner/git/subrepo/check.rb
511
516
  - lib/avm/tools/runner/git/subrepo/clone.rb
517
+ - lib/avm/tools/runner/git/subrepo/fix.rb
512
518
  - lib/avm/tools/runner/instance.rb
513
519
  - lib/avm/tools/runner/instance/info.rb
514
520
  - lib/avm/tools/runner/launcher.rb
@@ -520,6 +526,8 @@ files:
520
526
  - lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb
521
527
  - lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb
522
528
  - lib/avm/tools/runner/local_project/eac_writings_base0/info.rb
529
+ - lib/avm/tools/runner/local_project/eac_writings_base1.rb
530
+ - lib/avm/tools/runner/local_project/eac_writings_base1/build.rb
523
531
  - lib/avm/tools/runner/local_project/info.rb
524
532
  - lib/avm/tools/runner/local_project/ruby.rb
525
533
  - lib/avm/tools/runner/local_project/ruby/bundler.rb
@@ -622,6 +630,7 @@ files:
622
630
  - vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
623
631
  - vendor/eac_cli/lib/eac_cli/runner.rb
624
632
  - vendor/eac_cli/lib/eac_cli/runner/context.rb
633
+ - vendor/eac_cli/lib/eac_cli/runner/exit.rb
625
634
  - vendor/eac_cli/lib/eac_cli/runner_with.rb
626
635
  - vendor/eac_cli/lib/eac_cli/runner_with/help.rb
627
636
  - vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb
@@ -631,6 +640,7 @@ files:
631
640
  - vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
632
641
  - vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb
633
642
  - vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb
643
+ - vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
634
644
  - vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb
635
645
  - vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
636
646
  - vendor/eac_cli/spec/rubocop_spec.rb
@@ -903,6 +913,8 @@ files:
903
913
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb
904
914
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/by_reference.rb
905
915
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb
916
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb
917
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb
906
918
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb
907
919
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb
908
920
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb
@@ -929,6 +941,8 @@ files:
929
941
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
930
942
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
931
943
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
944
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
945
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
932
946
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
933
947
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
934
948
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/bundle'
4
- require 'avm/instances/entry_keys'
5
- require 'eac_cli/core_ext'
6
- require 'eac_ruby_utils/console/docopt_runner'
7
- require 'shellwords'
8
-
9
- module Avm
10
- module Tools
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class EacRailsBase0 < ::Avm::EacRailsBase1::Runner
13
- class RailsServer
14
- DEFAULT_RAILS_ENVIRONMENT = 'development'
15
- runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle
16
- runner_definition do
17
- desc 'Run the embbeded Rails web server.'
18
- end
19
-
20
- def run
21
- infov 'Environment', rails_environment
22
- infov 'Bundle args', ::Shellwords.join(bundle_args)
23
- infov 'Result', bundle_command.system
24
- end
25
-
26
- protected
27
-
28
- def bundle_args
29
- ['exec', 'rails', 'server', '--port',
30
- runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)]
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner/code_runner'
4
-
5
- module Avm
6
- module Tools
7
- class Runner < ::EacRubyUtils::Console::DocoptRunner
8
- class EacRailsBase0 < ::Avm::EacRailsBase1::Runner
9
- class Runner < ::Avm::EacRailsBase1::Runner::CodeRunner
10
- end
11
- end
12
- end
13
- end
14
- end