avm-tools 0.89.0 → 0.94.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_asciidoctor_base0.rb +9 -0
  3. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
  4. data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
  5. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -3
  6. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build/file.rb +4 -4
  7. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/deploy.rb +6 -6
  8. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/instance.rb +1 -1
  9. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/project.rb +1 -1
  10. data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
  11. data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
  12. data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  13. data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
  14. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
  15. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  16. data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
  17. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  18. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  19. data/lib/avm/executables.rb +1 -1
  20. data/lib/avm/git/auto_commit/commit_info.rb +23 -0
  21. data/lib/avm/git/auto_commit/rules.rb +31 -0
  22. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  23. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  24. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  25. data/lib/avm/git/auto_commit/rules/new.rb +24 -0
  26. data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
  27. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  28. data/lib/avm/git/auto_commit_path.rb +0 -21
  29. data/lib/avm/git/file_auto_fixup.rb +20 -61
  30. data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  31. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
  32. data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
  33. data/lib/avm/tools/runner/git/commit.rb +11 -20
  34. data/lib/avm/tools/runner/local_project/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  35. data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -9
  36. data/lib/avm/tools/runner/local_project/ruby.rb +1 -1
  37. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +1 -1
  38. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +1 -1
  39. data/lib/avm/tools/runner/ruby.rb +6 -14
  40. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  41. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  42. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  43. data/lib/avm/tools/version.rb +1 -1
  44. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  45. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  46. data/vendor/avm-apps/Gemfile +5 -0
  47. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  48. data/{lib/avm/eac_writings_base1.rb → vendor/avm-apps/lib/avm/apps.rb} +1 -1
  49. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  50. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  51. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  52. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  53. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  54. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  55. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  56. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  57. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
  58. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  59. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  60. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  61. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  62. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  63. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  64. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  65. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  66. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +4 -0
  67. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  68. metadata +55 -16
  69. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  70. data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
  71. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
  72. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_cli/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
10
- class Gems < ::EacRubyUtils::Console::DocoptRunner
8
+ class Ruby
9
+ class Gems
11
10
  require_sub __FILE__
12
- include ::EacCli::DefaultRunner
13
-
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Rubygems utilities for AVM.'
16
13
  subcommands
17
14
  end
@@ -1,31 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/ruby/gems/generator'
4
- require 'eac_ruby_utils/console/docopt_runner'
5
- require 'eac_ruby_utils/core_ext'
6
- require 'eac_cli/default_runner'
4
+ require 'eac_cli/core_ext'
7
5
 
8
6
  module Avm
9
7
  module Tools
10
8
  class Runner
11
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
12
- class Gems < ::EacRubyUtils::Console::DocoptRunner
13
- class Generate < ::EacRubyUtils::Console::DocoptRunner
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCUMENT
18
- Create a gem.
19
-
20
- Usage:
21
- __PROGRAM__ [options] <path>
22
- __PROGRAM__ -h --help
23
-
24
- Options:
25
- -h --help Show this help.
26
- --eac-ruby-utils-version=<version> Version for "eac_ruby_utils" gem.
27
- --eac-ruby-gem-support-version=<version> Version for "eac_ruby_gem_support" gem.
28
- DOCUMENT
9
+ class Ruby
10
+ class Gems
11
+ class Generate
12
+ runner_with :help do
13
+ desc 'Create a gem.'
14
+ arg_opt '--eac-ruby-utils-version', 'Version for "eac_ruby_utils" gem.'
15
+ arg_opt '--eac-ruby-gem-support-version', 'Version for "eac_ruby_gem_support" gem.'
16
+ pos_arg :path
17
+ end
29
18
 
30
19
  def run
31
20
  success "Gem \"#{generator.name}\" created in \"#{generator.root_directory}\""
@@ -34,12 +23,12 @@ module Avm
34
23
  private
35
24
 
36
25
  def generator_uncached
37
- ::Avm::Ruby::Gems::Generator.new(options.fetch('<path>'), generator_options)
26
+ ::Avm::Ruby::Gems::Generator.new(parsed.path, generator_options)
38
27
  end
39
28
 
40
29
  def generator_options
41
30
  %w[eac_ruby_utils eac_ruby_gem_support].map do |gem_name|
42
- ["#{gem_name}_version".to_sym, options.fetch("--#{gem_name.dasherize}-version")]
31
+ ["#{gem_name}_version".to_sym, parsed.fetch("#{gem_name.variableize}_version")]
43
32
  end.to_h
44
33
  end
45
34
  end
@@ -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.89.0'
5
+ VERSION = '0.94.0'
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
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module Apps
7
7
  require_sub __FILE__
8
8
  end
9
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
@@ -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)