avm-tools 0.91.0 → 0.94.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
  3. data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
  4. data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
  5. data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  6. data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
  7. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
  8. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  9. data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
  10. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  11. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  12. data/lib/avm/git/auto_commit/commit_info.rb +23 -0
  13. data/lib/avm/git/auto_commit/rules.rb +31 -0
  14. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  15. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  16. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  17. data/lib/avm/git/auto_commit/rules/new.rb +24 -0
  18. data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
  19. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  20. data/lib/avm/git/auto_commit_path.rb +0 -21
  21. data/lib/avm/git/file_auto_fixup.rb +26 -57
  22. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
  23. data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
  24. data/lib/avm/tools/runner/git/commit.rb +11 -20
  25. data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
  26. data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
  27. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +4 -8
  28. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +11 -14
  29. data/lib/avm/tools/runner/ruby.rb +6 -14
  30. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  31. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  32. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  33. data/lib/avm/tools/version.rb +1 -1
  34. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  35. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  36. data/vendor/avm-apps/Gemfile +5 -0
  37. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  38. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  39. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  40. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  41. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  42. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  43. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  44. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  45. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  46. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  47. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  48. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
  49. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  50. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  51. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  52. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  53. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
  54. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  55. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  56. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  57. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  58. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  59. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  60. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
  61. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  62. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  63. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  64. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  65. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  66. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  67. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  68. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  69. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
  70. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
  71. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  72. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  73. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  79. metadata +40 -5
  80. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  81. data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
  82. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
@@ -7,7 +7,7 @@ require 'eac_ruby_utils/core_ext'
7
7
  module Avm
8
8
  module Tools
9
9
  class Runner
10
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
10
+ class Ruby
11
11
  class Rubocop < ::EacRubyUtils::Console::DocoptRunner
12
12
  include ::EacRubyUtils::Console::Speaker
13
13
  include ::EacRubyUtils::SimpleCache
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.91.0'
5
+ VERSION = '0.94.2'
6
6
  end
7
7
  end
@@ -0,0 +1,5 @@
1
+ <Location "%%WEB.PATH%%">
2
+ PassengerBaseURI "%%WEB.PATH%%"
3
+ PassengerAppRoot "%%FS_PATH%%"
4
+ PassengerAppEnv production
5
+ </Location>
@@ -0,0 +1,9 @@
1
+ <IfModule mod_passenger.c>
2
+ Alias "%%WEB.PATH%%" "%%DOCUMENT_ROOT%%"
3
+ %%EXTRA_CONTENT%%
4
+ <Directory "%%DOCUMENT_ROOT%%">
5
+ Allow from all
6
+ Options -MultiViews
7
+ Require all granted
8
+ </Directory>
9
+ </IfModule>
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/apps/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-apps'
9
+ s.version = Avm::Apps::VERSION
10
+ s.authors = ['Eduardo H. Bogoni']
11
+ s.summary = 'AVM components for applications.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'eac_ruby_utils', '~> 0.58', '>= 0.58.1'
16
+
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Apps
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Apps
7
+ module Jobs
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/apps/jobs/variables_source'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Apps
8
+ module Jobs
9
+ module Base
10
+ common_concern do
11
+ include ::ActiveSupport::Callbacks
12
+
13
+ enable_console_speaker
14
+ enable_simple_cache
15
+ enable_listable
16
+ common_constructor :instance, :options, default: [{}] do
17
+ if option_list.present?
18
+ self.options = option_list.hash_keys_validate!(options.symbolize_keys)
19
+ end
20
+ end
21
+ define_callbacks(*jobs)
22
+ end
23
+
24
+ module ClassMethods
25
+ def jobs
26
+ const_get('JOBS').dup
27
+ end
28
+ end
29
+
30
+ module InstanceMethods
31
+ def option_list
32
+ nil
33
+ end
34
+
35
+ def run
36
+ start_banner if respond_to?(:start_banner)
37
+ run_jobs
38
+ ::Avm::Result.success('Done!')
39
+ rescue ::Avm::Result::Error => e
40
+ e.to_result
41
+ end
42
+
43
+ def variables_source
44
+ ::Avm::Apps::Jobs::VariablesSource.new(self, instance)
45
+ end
46
+
47
+ protected
48
+
49
+ def run_jobs
50
+ jobs.each do |job|
51
+ run_callbacks job do
52
+ send(job)
53
+ end
54
+ end
55
+ end
56
+
57
+ def jobs
58
+ self.class.jobs
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Apps
7
+ module Jobs
8
+ class VariablesSource
9
+ common_constructor :job, :instance
10
+
11
+ def read_entry(path, options = {})
12
+ entry_from_job(path) || instance.read_entry(path, options)
13
+ end
14
+
15
+ private
16
+
17
+ def entry_from_job(path)
18
+ method = path.gsub('.', '_').underscore
19
+ return job.send(method) if job.respond_to?(method, true)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Apps
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
+
5
+ RSpec.describe ::RuboCop, slow: true do
6
+ include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ # # This allows you to limit a spec run to individual examples or groups
52
+ # # you care about by tagging them with `:focus` metadata. When nothing
53
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
54
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
55
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
56
+ # config.filter_run_when_matching :focus
57
+ #
58
+ # # Allows RSpec to persist some state between runs in order to support
59
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
60
+ # # you configure your source control system to ignore this file.
61
+ # config.example_status_persistence_file_path = "spec/examples.txt"
62
+ #
63
+ # # Limits the available syntax to the non-monkey patched syntax that is
64
+ # # recommended. For more details, see:
65
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
66
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
68
+ # config.disable_monkey_patching!
69
+ #
70
+ # # This setting enables warnings. It's recommended, but in some cases may
71
+ # # be too noisy due to issues in dependencies.
72
+ # config.warnings = true
73
+ #
74
+ # # Many RSpec users commonly either run the entire suite or an individual
75
+ # # file, and it's useful to allow more verbose output when running an
76
+ # # individual spec file.
77
+ # if config.files_to_run.one?
78
+ # # Use the documentation formatter for detailed output,
79
+ # # unless a formatter has already been configured
80
+ # # (e.g. via a command-line flag).
81
+ # config.default_formatter = "doc"
82
+ # end
83
+ #
84
+ # # Print the 10 slowest examples and example groups at the
85
+ # # end of the spec run, to help surface which specs are running
86
+ # # particularly slow.
87
+ # config.profile_examples = 10
88
+ #
89
+ # # Run specs in random order to surface order dependencies. If you find an
90
+ # # order dependency and want to debug it, you can fix the order by providing
91
+ # # the seed, which is printed after each run.
92
+ # # --seed 1234
93
+ # config.order = :random
94
+ #
95
+ # # Seed global randomization in this process using the `--seed` CLI option.
96
+ # # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # # test failures related to randomization by passing the same `--seed` value
98
+ # # as the one that triggered the failure.
99
+ # Kernel.srand config.seed
100
+ end
@@ -2,3 +2,5 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_cli/patches'
5
+
6
+ ::EacCli::RunnerWithSet.default.add_namespace(::EacCli::RunnerWith)
@@ -10,15 +10,12 @@ module EacCli
10
10
  SUBCOMMAND_NAME_ARG = :subcommand
11
11
  SUBCOMMAND_ARGS_ARG = :subcommand_args
12
12
 
13
- def arg_opt(short, long, description, option_options = {})
14
- options_set << ::EacCli::Definition::ArgumentOption.new(
15
- short, long, description, option_options
16
- )
13
+ def arg_opt(*args)
14
+ options_set << ::EacCli::Definition::ArgumentOption.from_args(args)
17
15
  end
18
16
 
19
- def bool_opt(short, long, description, option_options = {})
20
- options_set << ::EacCli::Definition::BooleanOption.new(short, long, description,
21
- option_options)
17
+ def bool_opt(*args)
18
+ options_set << ::EacCli::Definition::BooleanOption.from_args(args)
22
19
  end
23
20
 
24
21
  def options
@@ -8,6 +8,14 @@ module EacCli
8
8
  def argument?
9
9
  true
10
10
  end
11
+
12
+ def build_value(new_value, previous_value)
13
+ repeat? ? previous_value + [new_value] : new_value
14
+ end
15
+
16
+ def default_value
17
+ repeat? ? [] : nil
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -5,24 +5,36 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  class Definition
7
7
  class BaseOption
8
+ require_sub __FILE__
9
+
10
+ class << self
11
+ def from_args(args)
12
+ p = ::EacCli::Definition::BaseOption::InitializeArgsParser.new(args)
13
+ new(p.short, p.long, p.description, p.options)
14
+ end
15
+ end
16
+
8
17
  DEFAULT_REQUIRED = false
9
18
 
10
19
  enable_listable
11
- lists.add_symbol :option, :optional, :usage, :required
12
- attr_reader :short, :long, :description, :options
13
-
14
- def initialize(short, long, description, options = {})
15
- @short = short
16
- @long = long
17
- @description = description
18
- @options = options.symbolize_keys
19
- @options.assert_valid_keys(::EacCli::Definition::BaseOption.lists.option.values)
20
+ enable_abstract_methods :build_value, :default_value
21
+ lists.add_symbol :option, :optional, :usage, :repeat, :required
22
+ common_constructor :short, :long, :description, :options, default: [{}] do
23
+ raise 'Nor short neither long selector was set' if short.blank? && long.blank?
24
+
25
+ self.options = ::EacCli::Definition::BaseOption.lists.option.hash_keys_validate!(
26
+ options.symbolize_keys
27
+ )
20
28
  end
21
29
 
22
30
  def identifier
23
31
  long.to_s.variableize.to_sym
24
32
  end
25
33
 
34
+ def repeat?
35
+ options[OPTION_REPEAT]
36
+ end
37
+
26
38
  def required?
27
39
  return true if options.key?(:required) && options.fetch(:required)
28
40
  return false if options.key?(:optional) && options.fetch(:optional)
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Definition
5
+ class BaseOption
6
+ class InitializeArgsParser
7
+ PROPERTIES = %i[short long description options].freeze
8
+ attr_reader(*PROPERTIES)
9
+
10
+ def initialize(args)
11
+ self.options = args.extract_options!.freeze
12
+ args.each { |arg| absorb_arg(arg) }
13
+ end
14
+
15
+ private
16
+
17
+ attr_writer(*PROPERTIES)
18
+
19
+ def absorb_arg(arg)
20
+ arg_ext = ArgumentParser.new(arg)
21
+ send("#{arg_ext.type}=", arg_ext.value)
22
+ end
23
+
24
+ class ArgumentParser
25
+ TYPES = %i[short long description].freeze
26
+ common_constructor :value
27
+
28
+ def type
29
+ TYPES.find { |type| send("#{type}?") } || raise("Unknown type for \"#{value}\"")
30
+ end
31
+
32
+ def short?
33
+ value.start_with?('-') && !long?
34
+ end
35
+
36
+ def long?
37
+ value.start_with?('--')
38
+ end
39
+
40
+ def description?
41
+ !short? || !long?
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -8,6 +8,14 @@ module EacCli
8
8
  def argument?
9
9
  false
10
10
  end
11
+
12
+ def build_value(_new_value, previous_value)
13
+ repeat? ? previous_value + 1 : true
14
+ end
15
+
16
+ def default_value
17
+ repeat? ? 0 : false
18
+ end
11
19
  end
12
20
  end
13
21
  end