avm-tools 0.90.0 → 0.94.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
- data/lib/avm/eac_asciidoctor_base0/build.rb +3 -1
- data/lib/avm/eac_asciidoctor_base0/build/file.rb +3 -3
- data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
- data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
- data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
- data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/git/auto_commit/commit_info.rb +23 -0
- data/lib/avm/git/auto_commit/rules.rb +31 -0
- data/lib/avm/git/auto_commit/rules/base.rb +39 -0
- data/lib/avm/git/auto_commit/rules/last.rb +19 -0
- data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
- data/lib/avm/git/auto_commit/rules/new.rb +24 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
- data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
- data/lib/avm/git/auto_commit_path.rb +0 -21
- data/lib/avm/git/file_auto_fixup.rb +26 -57
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
- data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
- data/lib/avm/tools/runner/git/commit.rb +11 -20
- data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +1 -1
- data/lib/avm/tools/runner/ruby.rb +6 -14
- data/lib/avm/tools/runner/ruby/gems.rb +4 -7
- data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
- data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
- data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
- data/vendor/avm-apps/Gemfile +5 -0
- data/vendor/avm-apps/avm-apps.gemspec +18 -0
- data/vendor/avm-apps/lib/avm/apps.rb +9 -0
- data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
- data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
- data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
- data/vendor/avm-apps/spec/spec_helper.rb +100 -0
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
- data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
- data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +60 -5
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
- data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
- data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
@@ -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,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
|
@@ -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(
|
14
|
-
options_set << ::EacCli::Definition::ArgumentOption.
|
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(
|
20
|
-
options_set << ::EacCli::Definition::BooleanOption.
|
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
|
@@ -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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
@@ -13,6 +13,18 @@ module EacCli
|
|
13
13
|
options.assert_valid_keys(self.class.lists.option.values)
|
14
14
|
end
|
15
15
|
|
16
|
+
def build_value(new_value, previous_value)
|
17
|
+
if previous_value.is_a?(::Array)
|
18
|
+
previous_value + [new_value]
|
19
|
+
else
|
20
|
+
new_value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_value
|
25
|
+
repeat? ? [] : nil
|
26
|
+
end
|
27
|
+
|
16
28
|
def identifier
|
17
29
|
name.to_s.variableize.to_sym
|
18
30
|
end
|
@@ -19,10 +19,24 @@ module EacCli
|
|
19
19
|
b += '=<value>' if option.argument?
|
20
20
|
b
|
21
21
|
end
|
22
|
+
|
23
|
+
def option_short(option)
|
24
|
+
b = option.short
|
25
|
+
b += '=<value>' if option.argument?
|
26
|
+
b
|
27
|
+
end
|
28
|
+
|
29
|
+
def option_usage_full(option)
|
30
|
+
if option.long.present?
|
31
|
+
[option.short, option_long(option)].reject(&:blank?).join(SEP)
|
32
|
+
else
|
33
|
+
option_short(option)
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
def option_definition(option)
|
25
|
-
|
39
|
+
self.class.option_usage_full(option) + OPTION_DESC_SEP + option.description
|
26
40
|
end
|
27
41
|
|
28
42
|
def section(header, include_header = true)
|
@@ -14,7 +14,9 @@ module EacCli
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_short_option(char)
|
17
|
-
alternative.options.find
|
17
|
+
alternative.options.find do |option|
|
18
|
+
short_without_prefix(option.short).if_present(false) { |v| v == char }
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def short_option_collect_argv_value
|
@@ -37,7 +39,7 @@ module EacCli
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def short_without_prefix(short)
|
40
|
-
short.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
42
|
+
short.to_s.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|