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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9acbf7ad72627c97018d603c65da21c1875efea79caa7569059d5fd1aeb083e2
4
- data.tar.gz: 8d0bb06826ece8223ed806348cf91f36c8117ebba3ceb05247b6947b54da44f0
3
+ metadata.gz: d5c0c0b3a077d30739e756476f997c1d74acc2f6cbf52ba89ca55efecc87879a
4
+ data.tar.gz: e26b9535c059c92e9a401db8552d33ca16f8ee38bf9743100cb61cbcf2d27c39
5
5
  SHA512:
6
- metadata.gz: f249739403ccc5346e161f6481acd020d369a02b00b01da1b6c80addc6bcce58d2dc7724cf923929e146e3cac1b8e5e557e82f66cb9f501da8e44f30f358b5c8
7
- data.tar.gz: a47f7c215bedfe5f870ba8a6bbbaf2e579c0c31b017546894c43e0421d75362b366dace3cfcd2bb9f72df7a3037866385b9c928e9389d558d0c39c1939928ea1
6
+ metadata.gz: ce8b71b8307d328e7a8ecb64d6c860eea72a47c22a769de30c101686b7089b9e6ee1d05a932c311139e3ba554bff03fae9d091cd9c1eb97ae2cb6d8135e8ee6b
7
+ data.tar.gz: eb891b911edc41e6989ab28f59f79b47e9d49ad18454cb8178a49f3e87f79f3b36206057476aa524d7a197d333228f551dfcce43553ae4aac2369382e62b94bf
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -3,7 +3,7 @@
3
3
  require 'avm/eac_webapp_base0/apache_host'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
8
  def document_root
9
9
  instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/apache_path'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ class ApachePath < ::Avm::EacWebappBase0::ApachePath
8
+ end
9
+ end
10
+ end
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_utils/fs/clearable_directory'
5
5
 
6
6
  module Avm
7
- module EacWritingsBase1
7
+ module EacAsciidoctorBase0
8
8
  class Build
9
9
  require_sub __FILE__
10
10
  enable_console_speaker
@@ -15,6 +15,8 @@ module Avm
15
15
  self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
16
16
  end
17
17
 
18
+ SOURCE_EXTNAMES = %w[.adoc .asc].freeze
19
+
18
20
  def run
19
21
  infov 'Files to build', source_files.count
20
22
  target_directory.clear
@@ -34,9 +36,9 @@ module Avm
34
36
  def source_files_uncached
35
37
  r = []
36
38
  project.root.children.each do |child|
37
- next unless child.extname == '.asc'
39
+ next unless SOURCE_EXTNAMES.include?(child.extname)
38
40
 
39
- r << ::Avm::EacWritingsBase1::Build::File.new(self, child.basename)
41
+ r << ::Avm::EacAsciidoctorBase0::Build::File.new(self, child.basename)
40
42
  end
41
43
  r
42
44
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/executables'
3
+ require 'asciidoctor'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Build
8
8
  class File
9
9
  enable_console_speaker
@@ -11,8 +11,8 @@ module Avm
11
11
 
12
12
  def run
13
13
  infov 'Building', subpath
14
- target_path.parent.mkpath
15
- ::Avm::Executables.asciidoc.command('--out-file', target_path, source_path).system!
14
+ ::Asciidoctor.convert_file source_path.to_path,
15
+ to_file: target_path.to_path, safe: :unsafe, mkdirs: true
16
16
  end
17
17
 
18
18
  def source_path
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/deploy'
4
- require 'avm/eac_writings_base1/project'
5
- require 'avm/eac_writings_base1/build'
4
+ require 'avm/eac_asciidoctor_base0/project'
5
+ require 'avm/eac_asciidoctor_base0/build'
6
6
 
7
7
  module Avm
8
- module EacWritingsBase1
8
+ module EacAsciidoctorBase0
9
9
  class Deploy < ::Avm::EacWebappBase0::Deploy
10
10
  def build_content
11
- ::Avm::EacWritingsBase1::Build.new(
11
+ ::Avm::EacAsciidoctorBase0::Build.new(
12
12
  project,
13
- ::Avm::EacWritingsBase1::Build::OPTION_TARGET_DIRECTORY => build_dir
13
+ ::Avm::EacAsciidoctorBase0::Build::OPTION_TARGET_DIRECTORY => build_dir
14
14
  ).run
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def project_uncached
20
- ::Avm::EacWritingsBase1::Project.new(
20
+ ::Avm::EacAsciidoctorBase0::Project.new(
21
21
  instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
22
22
  )
23
23
  end
@@ -3,7 +3,7 @@
3
3
  require 'avm/eac_webapp_base0/instance'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Instance < ::Avm::EacWebappBase0::Instance
8
8
  FILES_UNITS = {}.freeze
9
9
  end
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Project
8
8
  common_constructor :root do
9
9
  self.root = root.to_pathname
@@ -1,49 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_ubuntu_base0/apache'
3
+ require 'avm/eac_webapp_base0/apache_path'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacRailsBase0
8
- class ApachePath
9
- enable_console_speaker
10
- enable_simple_cache
11
- common_constructor :instance, :options, default: [{}]
12
-
13
- def run
14
- write_available_conf
15
- enable_conf
16
- reload_apache
17
- ::Avm::Result.success('Done')
18
- end
19
-
20
- def content
21
- template.child('default.conf').apply(instance)
22
- end
23
-
24
- private
25
-
26
- def apache_uncached
27
- ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
28
- end
29
-
30
- def enable_conf
31
- infom 'Enabling configuration...'
32
- conf.enable
33
- end
34
-
35
- def reload_apache
36
- infom 'Reloading Apache...'
37
- apache.service('reload')
38
- end
39
-
40
- def conf_uncached
41
- apache.conf(instance.id)
8
+ class ApachePath < ::Avm::EacWebappBase0::ApachePath
9
+ def document_root
10
+ ::File.join(super, 'public')
42
11
  end
43
12
 
44
- def write_available_conf
45
- infom 'Writing available configuration...'
46
- conf.write(content)
13
+ def extra_content
14
+ template.child('extra_content.conf').apply(instance)
47
15
  end
48
16
  end
49
17
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'avm/apps/jobs/base'
4
5
  require 'avm/patches/object/template'
5
6
  require 'avm/eac_ubuntu_base0/apache'
6
7
  require 'avm/patches/object/template'
@@ -8,24 +9,14 @@ require 'avm/patches/object/template'
8
9
  module Avm
9
10
  module EacWebappBase0
10
11
  class ApacheHost
11
- enable_console_speaker
12
- enable_simple_cache
13
- common_constructor :instance, :options, default: [{}]
14
-
15
- def run
16
- write_available_no_ssl_site
17
- enable_no_ssl_site
18
- remove_ssl_site
19
- reload_apache
20
- run_certbot
21
- enable_ssl_site
22
- reload_apache
23
- ::Avm::Result.success('Done')
24
- end
12
+ JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
13
+ run_certbot enable_ssl_site reload_apache].freeze
14
+ include ::Avm::Apps::Jobs::Base
25
15
 
26
16
  def no_ssl_site_content
27
- ::Avm::EacWebappBase0::ApacheHost.template.child('no_ssl.conf')
28
- .apply(EntriesReader.new(self, instance))
17
+ ::Avm::EacWebappBase0::ApacheHost
18
+ .template.child('no_ssl.conf')
19
+ .apply(variables_source)
29
20
  end
30
21
 
31
22
  def ssl?
@@ -83,21 +74,6 @@ module Avm
83
74
  infom 'Writing no SSL site conf...'
84
75
  no_ssl_site.write(no_ssl_site_content)
85
76
  end
86
-
87
- class EntriesReader
88
- common_constructor :job, :instance
89
-
90
- def read_entry(path, options = {})
91
- entry_from_job(path) || instance.read_entry(path, options)
92
- end
93
-
94
- private
95
-
96
- def entry_from_job(path)
97
- method = path.gsub('.', '_').underscore
98
- return job.send(method) if job.respond_to?(method, true)
99
- end
100
- end
101
77
  end
102
78
  end
103
79
  end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/apps/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class ApachePath
10
+ JOBS = %w[write_available_conf enable_conf reload_apache].freeze
11
+ include ::Avm::Apps::Jobs::Base
12
+
13
+ def content
14
+ ::Avm::EacWebappBase0::ApachePath.template.child('default.conf').apply(variables_source)
15
+ end
16
+
17
+ def document_root
18
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
19
+ end
20
+
21
+ def extra_content
22
+ ''
23
+ end
24
+
25
+ private
26
+
27
+ def apache_uncached
28
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
29
+ end
30
+
31
+ def enable_conf
32
+ infom 'Enabling configuration...'
33
+ conf.enable
34
+ end
35
+
36
+ def reload_apache
37
+ infom 'Reloading Apache...'
38
+ apache.service('reload')
39
+ end
40
+
41
+ def conf_uncached
42
+ apache.conf(instance.id)
43
+ end
44
+
45
+ def write_available_conf
46
+ infom 'Writing available configuration...'
47
+ conf.write(content)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/callbacks'
4
+ require 'avm/apps/jobs/base'
4
5
  require 'avm/git'
5
6
  require 'avm/patches/object/template'
6
7
  require 'eac_ruby_utils/core_ext'
@@ -11,30 +12,23 @@ module Avm
11
12
  module EacWebappBase0
12
13
  class Deploy
13
14
  require_sub __FILE__, include_modules: true
14
- include ::ActiveSupport::Callbacks
15
15
 
16
16
  DEFAULT_REFERENCE = 'HEAD'
17
17
 
18
- enable_console_speaker
19
- enable_simple_cache
20
- enable_listable
21
- lists.add_symbol :option, :appended_directories, :no_request_test, :reference
22
- common_constructor :instance, :options, default: [{}] do
23
- self.options = ::Avm::EacWebappBase0::Deploy.lists.option
24
- .hash_keys_validate!(options.symbolize_keys)
25
- end
26
-
27
18
  REQUEST_TEST_JOB = 'request_test'
28
19
  JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
29
20
  setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
30
- define_callbacks(*JOBS)
21
+
22
+ include ::Avm::Apps::Jobs::Base
23
+
24
+ lists.add_symbol :option, :appended_directories, :no_request_test, :reference
25
+
26
+ def option_list
27
+ ::Avm::EacWebappBase0::Deploy.lists.option
28
+ end
31
29
 
32
30
  def run
33
- start_banner
34
- run_jobs
35
- ::Avm::Result.success('Deployed')
36
- rescue ::Avm::Result::Error => e
37
- e.to_result
31
+ super
38
32
  ensure
39
33
  remove_build_dir
40
34
  end
@@ -67,25 +61,13 @@ module Avm
67
61
  fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
68
62
  end
69
63
 
70
- def variables_source
71
- instance
72
- end
73
-
74
- private
64
+ protected
75
65
 
76
66
  def jobs
77
- r = JOBS.dup
67
+ r = super
78
68
  r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
79
69
  r
80
70
  end
81
-
82
- def run_jobs
83
- jobs.each do |job|
84
- run_callbacks job do
85
- send(job)
86
- end
87
- end
88
- end
89
71
  end
90
72
  end
91
73
  end
@@ -1,22 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'avm/instances/runner'
4
+ require 'eac_cli/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacWebappBase0
8
8
  class Runner < ::Avm::Instances::Runner
9
- class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
10
- include ::EacCli::DefaultRunner
11
-
12
- runner_definition do
9
+ class ApacheHost
10
+ runner_with :help do
13
11
  desc 'Configure Apache virtual host for instance.'
14
12
  bool_opt '-c', '--certbot', 'Install certbot.'
15
13
  end
16
14
 
17
15
  def run
18
- options
19
- result = stereotype_apache_host_class.new(context(:instance),
16
+ result = stereotype_apache_host_class.new(runner_context.call(:instance),
20
17
  stereotype_apache_host_options).run
21
18
  if result.error?
22
19
  fatal_error result.to_s
@@ -26,11 +23,11 @@ module Avm
26
23
  end
27
24
 
28
25
  def stereotype_apache_host_class
29
- "#{context(:instance).class.name.deconstantize}::ApacheHost".constantize
26
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApacheHost".constantize
30
27
  end
31
28
 
32
29
  def stereotype_apache_host_options
33
- { certbot: options.fetch('--certbot') }
30
+ { certbot: parsed.certbot? }
34
31
  end
35
32
  end
36
33
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'avm/instances/runner'
5
+ require 'avm/eac_webapp_base0/runner/apache_host'
6
+ require 'avm/eac_rails_base0/apache_path'
7
+
8
+ module Avm
9
+ module EacWebappBase0
10
+ class Runner < ::Avm::Instances::Runner
11
+ class ApachePath
12
+ runner_with :help do
13
+ desc 'Configure Apache path configuration for instance.'
14
+ end
15
+
16
+ def run
17
+ if result.error?
18
+ fatal_error result.to_s
19
+ else
20
+ infov 'Result', result.label
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def apache_path_uncached
27
+ stereotype_apache_path_class.new(runner_context.call(:instance))
28
+ end
29
+
30
+ def result_uncached
31
+ apache_path.run
32
+ end
33
+
34
+ def stereotype_apache_path_class
35
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApachePath".constantize
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end