avm-tools 0.115.0 → 0.116.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/launcher/instances/settings.rb +7 -3
  3. data/lib/avm/projects/stereotypes.rb +2 -2
  4. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +1 -1
  5. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +1 -1
  6. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +1 -1
  7. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +1 -1
  8. data/lib/avm/ruby/bundler/incompatible_parser.rb +1 -1
  9. data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb +1 -1
  10. data/lib/avm/tools/runner/app_src/test.rb +2 -2
  11. data/lib/avm/tools/runner/git/deploy.rb +5 -5
  12. data/lib/avm/tools/runner/git/dirty_files.rb +1 -1
  13. data/lib/avm/tools/runner/git/revisions_test.rb +1 -1
  14. data/lib/avm/tools/runner/ruby/rubocop.rb +2 -2
  15. data/lib/avm/tools/version.rb +1 -1
  16. data/sub/avm/avm.gemspec +2 -2
  17. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
  18. data/sub/avm/lib/avm/instances/entry_keys.rb +2 -0
  19. data/sub/avm/lib/avm/registry/base.rb +2 -2
  20. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
  21. data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
  22. data/sub/avm/lib/avm/version.rb +1 -1
  23. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +1 -1
  24. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +2 -2
  25. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +1 -1
  26. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +2 -2
  27. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  28. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +1 -1
  29. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  30. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +2 -2
  31. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +46 -0
  32. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler.rb +17 -0
  33. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +70 -0
  34. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +29 -0
  35. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +57 -0
  36. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  37. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler.service +12 -0
  38. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +6 -0
  39. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +2 -2
  40. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +3 -3
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +17 -2
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  43. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +2 -8
  44. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile_apache_setup +8 -0
  45. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +1 -1
  46. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
  47. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +1 -1
  48. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +31 -0
  49. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +17 -0
  50. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +41 -0
  51. data/{lib/avm/ruby → sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1}/rubocop.rb +2 -2
  52. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +1 -1
  53. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +1 -1
  54. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  55. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb +6 -0
  56. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +1 -1
  57. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +1 -1
  58. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +7 -0
  59. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  60. data/sub/avm-files/avm-files.gemspec +1 -1
  61. data/sub/avm-files/lib/avm/files/appendable.rb +1 -1
  62. data/sub/avm-files/lib/avm/files/formatter/formats/ruby.rb +2 -2
  63. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  64. data/sub/eac_cli/eac_cli.gemspec +1 -1
  65. data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +1 -1
  66. data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +1 -1
  67. data/sub/eac_cli/lib/eac_cli/parser.rb +2 -2
  68. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +1 -1
  69. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -5
  70. data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +2 -2
  71. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  72. data/sub/eac_config/eac_config.gemspec +1 -1
  73. data/sub/eac_config/lib/eac_config/entry.rb +1 -1
  74. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +1 -1
  75. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +1 -1
  76. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  77. data/sub/eac_fs/eac_fs.gemspec +1 -1
  78. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  79. data/sub/eac_git/eac_git.gemspec +1 -1
  80. data/sub/eac_git/lib/eac_git/local/remote.rb +2 -2
  81. data/sub/eac_git/lib/eac_git/local.rb +1 -1
  82. data/sub/eac_git/lib/eac_git/version.rb +1 -1
  83. data/sub/eac_rest/eac_rest.gemspec +1 -1
  84. data/sub/eac_rest/lib/eac_rest/api.rb +14 -3
  85. data/sub/eac_rest/lib/eac_rest/request.rb +22 -1
  86. data/sub/eac_rest/lib/eac_rest/response.rb +41 -1
  87. data/sub/eac_rest/lib/eac_rest/version.rb +1 -1
  88. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +1 -1
  89. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +2 -2
  90. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  91. data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  92. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +2 -2
  93. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  94. data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  95. data/sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb +1 -1
  96. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +1 -1
  97. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +1 -1
  98. data/sub/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +1 -1
  99. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +16 -4
  100. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +12 -2
  101. data/sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +1 -1
  102. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +6 -0
  103. data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +1 -1
  104. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  105. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/{temp_spec.rb → directory_spec.rb} +0 -0
  106. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb +4 -4
  107. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +169 -106
  108. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +52 -17
  109. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +5 -3
  110. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +5 -3
  111. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +3 -3
  112. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +21 -18
  113. data/sub/eac_ruby_utils/spec/locales/pt-BR.yml +3 -0
  114. data/sub/eac_templates/eac_templates.gemspec +1 -1
  115. data/sub/eac_templates/lib/eac_templates/directory.rb +1 -1
  116. data/sub/eac_templates/lib/eac_templates/version.rb +1 -1
  117. metadata +41 -21
  118. data/lib/avm/ruby/rubocop/_configured.rb +0 -29
  119. data/lib/avm/ruby/rubocop/_envvar.rb +0 -15
  120. data/lib/avm/ruby/rubocop/_gemfile.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf0d93631b14929c6e271ba0dd835f75a9633a961b3f870daa5c64eb467e0ef2
4
- data.tar.gz: '0281c164c78506d7fe5ac8f601ce4380661f835a3c4e0ebe7c48c60334419565'
3
+ metadata.gz: 9ade74f1c59b191c0af317c03f8acb00fffc0e2bcac3120b56a604ab72a31ac1
4
+ data.tar.gz: 9d9967c47a11500142f7843b53ac7430f40fb191e441ce177ce583a58f46fffc
5
5
  SHA512:
6
- metadata.gz: bcbb490835a6f843cb9179effd073b661e7d4c7d1006ae4a135744d692203425ab8c4f9dbd18d55af1b1744655ec216c3feaf23470c1df691788eb3d94030a9d
7
- data.tar.gz: 2e647b2157fe2c3bdf9ea51ebaac0809e4299af1bb13c96b73bae51c68e9876ba37347a9a85f3e15b8eede0c837546edf05079b116abf67081ecbe28062092b3
6
+ metadata.gz: dae95c3e50159a7cd7a9c77745a106d462c2d5c8445a43f92f35cadeb42545509d83b53f2085a339b9dac930610a6cc68cb4551a2dd35e0a2566a1d07f932ce1
7
+ data.tar.gz: 7dc23f20f7430e88fd0a75582a899df38a81eb6a102f948611c96d810d766032656c730395ef66f4a3f89a11ad4b84d429252dcbf8e58082777b632f5e2ad188
@@ -23,7 +23,7 @@ module Avm
23
23
  end
24
24
 
25
25
  def publishable?
26
- !!publishable_value
26
+ publishable_value ? true : false
27
27
  end
28
28
 
29
29
  def stereotype_publishable?(stereotype)
@@ -39,11 +39,15 @@ module Avm
39
39
  end
40
40
 
41
41
  def parse_publishable_value(value, hash_to_true)
42
- return value.with_indifferent_access if !hash_to_true && value.is_a?(::Hash)
42
+ return value.with_indifferent_access if parse_publishable_value_hash?(value, hash_to_true)
43
43
  return true if value.nil? || value == true
44
44
  return false if value == false
45
45
 
46
- !!value
46
+ value ? true : false
47
+ end
48
+
49
+ def parse_publishable_value_hash?(value, hash_to_true)
50
+ !hash_to_true && value.is_a?(::Hash)
47
51
  end
48
52
  end
49
53
  end
@@ -11,8 +11,8 @@ module Avm
11
11
  class << self
12
12
  def list
13
13
  @list ||= constants.map { |c| const_get(c) }
14
- .select { |c| c.included_modules.include?(Avm::Projects::Stereotype) }
15
- .freeze
14
+ .select { |c| c.included_modules.include?(Avm::Projects::Stereotype) }
15
+ .freeze
16
16
  end
17
17
  end
18
18
  end
@@ -9,7 +9,7 @@ module Avm
9
9
  class IncompatibleParser
10
10
  class DependsOn < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
11
  LINE_PARSER = /(.+) was resolved to (.+), which depends on/
12
- .to_parser { |m| new(m[1], m[2]) }
12
+ .to_parser { |m| new(m[1], m[2]) }
13
13
 
14
14
  common_constructor :gem_name, :version do
15
15
  self.version = ::Gem::Version.new(version)
@@ -9,7 +9,7 @@ module Avm
9
9
  class IncompatibleParser
10
10
  class GemConflict < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
11
  LINE_PARSER = /Bundler could not find compatible versions for gem "(.+)":/
12
- .to_parser { |m| new(m[1]) }
12
+ .to_parser { |m| new(m[1]) }
13
13
 
14
14
  enable_simple_cache
15
15
  common_constructor :gem_name
@@ -9,7 +9,7 @@ module Avm
9
9
  class IncompatibleParser
10
10
  class InGemfile < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
11
  LINE_PARSER = /In Gemfile:/
12
- .to_parser { |_m| new }
12
+ .to_parser { |_m| new }
13
13
 
14
14
  common_constructor
15
15
  end
@@ -9,7 +9,7 @@ module Avm
9
9
  class IncompatibleParser
10
10
  class VersionRequirement < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
11
  LINE_PARSER = /\A([a-z][a-z_0-9]*)(?: \((.+)\))?\z/
12
- .to_parser { |m| new(m[1], m[2]) }
12
+ .to_parser { |m| new(m[1], m[2]) }
13
13
 
14
14
  enable_simple_cache
15
15
  attr_accessor :stack
@@ -13,7 +13,7 @@ module Avm
13
13
 
14
14
  def initialize(path)
15
15
  @gems_in_conflict = ::Avm::Ruby::Bundler::IncompatibleParser::LineBuffer
16
- .from_file(path).gems_in_conflict.freeze
16
+ .from_file(path).gems_in_conflict.freeze
17
17
  end
18
18
 
19
19
  def data
@@ -29,7 +29,7 @@ module Avm
29
29
  def git_continue_run(command)
30
30
  infom "\"#{command}\" --continue..."
31
31
  cmd = instance.git_repo.command(command, '--continue')
32
- .envvar('GIT_EDITOR', 'true')
32
+ .envvar('GIT_EDITOR', 'true')
33
33
  return unless !cmd.system && !conflict?
34
34
 
35
35
  fatal_error "\"#{cmd}\" failed and there is no conflict"
@@ -71,8 +71,8 @@ module Avm
71
71
 
72
72
  def test_builder
73
73
  r = ::Avm::Sources::Tests::Builder.new(runner_context.call(:subject))
74
- .include_main(include_main?)
75
- .include_subs(include_subs?)
74
+ .include_main(include_main?)
75
+ .include_subs(include_subs?)
76
76
  parsed.source_id.inject(r) { |a, e| a.include_id(e) }
77
77
  end
78
78
 
@@ -78,15 +78,15 @@ module Avm
78
78
 
79
79
  def deploy
80
80
  ::Avm::Git::Commit.new(git, reference_sha1)
81
- .deploy_to_url(target_url)
82
- .append_templatized_directories(appended_directories)
83
- .variables_source_set(variables_source)
84
- .run
81
+ .deploy_to_url(target_url)
82
+ .append_templatized_directories(appended_directories)
83
+ .variables_source_set(variables_source)
84
+ .run
85
85
  end
86
86
 
87
87
  def target_url
88
88
  parsed.target_url.if_present { |v| return v }
89
- instance.if_present { |v| return v.read_entry('fs.url') }
89
+ instance.if_present { |v| return v.read_entry(::Avm::Instances::EntryKeys::FS_URL) }
90
90
  nil
91
91
  end
92
92
 
@@ -10,7 +10,7 @@ module Avm
10
10
  DEFAULT_FORMAT = '%p'
11
11
  FIELDS = {
12
12
  i: :index, w: :worktree, p: :path, a: :absolute_path
13
- }.map { |k, v| ["%#{k}", v] }.to_h
13
+ }.transform_keys { |k| "%#{k}" }
14
14
 
15
15
  runner_with :help do
16
16
  desc 'Lists dirty files in Git repository.'
@@ -51,7 +51,7 @@ module Avm
51
51
 
52
52
  def revisions_uncached
53
53
  runner_context.call(:git).execute!('log', '--pretty=format:%H', 'origin/master..HEAD')
54
- .each_line.map(&:strip).reverse.map do |sha1|
54
+ .each_line.map(&:strip).reverse.map do |sha1|
55
55
  ::Avm::Git::RevisionTest.new(runner_context.call(:git), sha1, test_revision_options)
56
56
  end
57
57
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/tools/core_ext'
4
- require 'avm/ruby/rubocop'
4
+ require 'avm/eac_ruby_base1/rubocop'
5
5
 
6
6
  module Avm
7
7
  module Tools
@@ -15,7 +15,7 @@ module Avm
15
15
  end
16
16
 
17
17
  def run
18
- ::Avm::Ruby::Rubocop.new(path, parsed.rubocop_args).run
18
+ ::Avm::EacRubyBase1::Rubocop.new(path, parsed.rubocop_args).run
19
19
  end
20
20
 
21
21
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.115.0'
5
+ VERSION = '0.116.2'
6
6
  end
7
7
  end
data/sub/avm/avm.gemspec CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'htmlbeautifier', '~> 1.3', '>= 1.3.1'
22
22
  s.add_dependency 'minitar', '~> 0.9'
23
23
 
24
- s.add_development_dependency 'aranha-parsers', '~> 0.7', '>= 0.7.2'
25
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
24
+ s.add_development_dependency 'aranha-parsers', '~> 0.14', '~> 0.14.1'
25
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
26
26
  end
@@ -9,8 +9,8 @@ module Avm
9
9
  module AutoValues
10
10
  module Mailer
11
11
  ::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
12
- .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
- .each do |mailer_key|
12
+ .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
+ .each do |mailer_key|
14
14
  define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
15
15
  mailer_auto_common(mailer_key)
16
16
  end
@@ -43,8 +43,10 @@ module Avm
43
43
 
44
44
  {
45
45
  '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
+ admin: %w[username password api_key],
46
47
  database: %w[id hostname limit name password port system timeout username extra],
47
48
  docker: %w[registry],
49
+ fs: %w[url],
48
50
  mailer: {
49
51
  '' => %w[id from reply_to],
50
52
  smtp: %w[address port domain username password authentication openssl_verify_mode
@@ -17,7 +17,7 @@ module Avm
17
17
 
18
18
  def detect_optional(*registered_initialize_args)
19
19
  registered_modules.reverse.lazy.map { |klass| klass.new(*registered_initialize_args) }
20
- .find(&:valid?)
20
+ .find(&:valid?)
21
21
  end
22
22
 
23
23
  def provider_module_suffix
@@ -40,7 +40,7 @@ module Avm
40
40
 
41
41
  def registered_modules_uncached
42
42
  registered_gems.flat_map { |registry| modules_from_registry(registry) }
43
- .select { |v| valid_registered_module?(v) }.uniq
43
+ .select { |v| valid_registered_module?(v) }.uniq
44
44
  end
45
45
 
46
46
  def modules_from_registry(registry)
@@ -4,7 +4,7 @@ require 'avm/registry'
4
4
 
5
5
  ::RSpec.shared_examples 'not_in_avm_registry' do |registry_method = nil|
6
6
  registry_method.if_present(::Avm::Registry.registries) { |v| [::Avm::Registry.send(v)] }
7
- .each do |registry|
7
+ .each do |registry|
8
8
  context "when registry is #{registry}" do
9
9
  it 'is not in the avm registry' do
10
10
  expect(registry.registered_modules).not_to include(described_class)
@@ -33,7 +33,7 @@ module Avm
33
33
  # @return [Array<Avm::Sources::Tests::Single>]
34
34
  def available_units
35
35
  @available_units ||= ([main_source] + main_source.subs)
36
- .map { |a_source| create_unit(a_source) }
36
+ .map { |a_source| create_unit(a_source) }
37
37
  end
38
38
 
39
39
  def available_units_from_main
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.17.0'
4
+ VERSION = '0.18.1'
5
5
  end
@@ -17,7 +17,7 @@ module Avm
17
17
  end
18
18
 
19
19
  def source_path
20
- build.project.root.join(subpath)
20
+ build.project.path.join(subpath)
21
21
  end
22
22
 
23
23
  def target_path
@@ -25,7 +25,7 @@ module Avm
25
25
  end
26
26
 
27
27
  def default_target_directory
28
- project.root.join('build')
28
+ project.path.join('build')
29
29
  end
30
30
 
31
31
  def target_directory
@@ -36,7 +36,7 @@ module Avm
36
36
 
37
37
  def source_files_uncached
38
38
  r = []
39
- project.root.children.each do |child|
39
+ project.path.children.each do |child|
40
40
  next unless SOURCE_EXTNAMES.include?(child.extname)
41
41
 
42
42
  r << ::Avm::EacAsciidoctorBase0::Sources::Build::File.new(self, child.basename)
@@ -29,7 +29,7 @@ module Avm
29
29
  end
30
30
 
31
31
  def default_target_directory
32
- runner_context.call(:project).root.join('build')
32
+ runner_context.call(:project).path.join('build')
33
33
  end
34
34
 
35
35
  def open
@@ -15,8 +15,8 @@ module Avm
15
15
  end
16
16
 
17
17
  def project_banner
18
- infov 'Project', project.name
19
- infov 'Path', project.root
18
+ infov 'Project', project.application.name
19
+ infov 'Path', project.path
20
20
  end
21
21
 
22
22
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.3.3'
5
+ VERSION = '0.3.4'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_rails_base1', '~> 0.1', '>= 0.1.3'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.2'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.80', '>= 0.80.2'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase0
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.2', '>= 0.2.1'
15
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
16
16
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.9'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.68'
18
18
 
19
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
20
20
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/systemd_unit'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ class Runner < ::Avm::EacWebappBase0::Runner
9
+ class TasksScheduler
10
+ class SystemdUnit
11
+ DEFAULT_RESTART = 'on-failure'
12
+
13
+ runner_with :help do
14
+ desc 'Configure Systemd unit for instace\'s tasks scheduler daemon (Reference: ' \
15
+ 'https://www.freedesktop.org/software/systemd/man/systemd.service.html).'
16
+ bool_opt '-e', '--exec-run', 'Run daemon with "run" instead of "start"/"stop".'
17
+ arg_opt '-r', '--restart', 'Value for systemd.service, Restart=.',
18
+ default: DEFAULT_RESTART
19
+ end
20
+
21
+ delegate :restart, to: :parsed
22
+
23
+ def run
24
+ if result.error?
25
+ fatal_error result.to_s
26
+ else
27
+ infov 'Result', result.label
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def systemd_unit_uncached
34
+ ::Avm::EacRailsBase1::SystemdUnit.new(runner_context.call(:instance),
35
+ restart: parsed.restart,
36
+ exec_run: parsed.exec_run?)
37
+ end
38
+
39
+ def result_uncached
40
+ systemd_unit.run
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class Runner < ::Avm::EacWebappBase0::Runner
8
+ class TasksScheduler
9
+ require_sub __FILE__
10
+
11
+ runner_with :help, :subcommands do
12
+ subcommands
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class SystemdUnit
8
+ module Service
9
+ def service_content
10
+ template.child('tasks_scheduler.service').apply(variables_source)
11
+ end
12
+
13
+ def service_exec_lines
14
+ service_exec_operations
15
+ .map { |k, v| "#{k}=#{tasks_scheduler_command_path} #{v}" }
16
+ .join("\n")
17
+ end
18
+
19
+ def service_path
20
+ ::Pathname.new('/etc/systemd/system').join(unit_name)
21
+ end
22
+
23
+ def service_link_path
24
+ ::Pathname.new('/etc/systemd/system/multi-user.target.wants').join(unit_name)
25
+ end
26
+
27
+ def verify_service
28
+ sudo_system!('systemd-analyze', 'verify', service_path)
29
+ end
30
+
31
+ private
32
+
33
+ def enable_service
34
+ systemctl('enable', unit_name)
35
+ end
36
+
37
+ def link_service
38
+ sudo_execute!('rm', '-f', service_link_path)
39
+ sudo_execute!('ln', '-s', service_path, service_link_path)
40
+ end
41
+
42
+ def reload_systemd
43
+ systemctl('daemon-reload')
44
+ end
45
+
46
+ # @return [Hash<String, String>]
47
+ def service_exec_operations
48
+ if exec_run?
49
+ { 'ExecStart' => 'run' }
50
+ else
51
+ { 'ExecStart' => 'start', 'ExecStop' => 'stop' }
52
+ end
53
+ end
54
+
55
+ def start_service
56
+ systemctl('start', unit_name)
57
+ end
58
+
59
+ def systemctl(*args)
60
+ sudo_system!('systemctl', *args)
61
+ end
62
+
63
+ def write_service
64
+ infom 'Writing service\'s unit file...'
65
+ platform_instance.file_sudo_write(service_path, service_content)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ class SystemdUnit
8
+ module TasksSchedulerCommand
9
+ def tasks_scheduler_command_content
10
+ template.child('tasks_scheduler_command.sh').apply(variables_source)
11
+ end
12
+
13
+ def tasks_scheduler_command_path
14
+ "/opt/aux/#{instance.id}/tasks_scheduler.sh"
15
+ end
16
+
17
+ private
18
+
19
+ def write_tasks_scheduler_command
20
+ infom 'Writing tasks scheduler\'s command...'
21
+ sudo_execute!('mkdir', '-p', ::File.dirname(tasks_scheduler_command_path))
22
+ platform_instance.file_sudo_write(tasks_scheduler_command_path,
23
+ tasks_scheduler_command_content)
24
+ sudo_execute!('chmod', '+x', tasks_scheduler_command_path)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ class SystemdUnit
10
+ JOBS = %w[write_tasks_scheduler_command write_service link_service verify_service
11
+ reload_systemd enable_service start_service].freeze
12
+
13
+ include ::Avm::Jobs::Base
14
+ require_sub __FILE__, include_modules: true
15
+ delegate :platform_instance, to: :instance
16
+
17
+ enable_listable
18
+ lists.add_symbol :option, :exec_run, :restart
19
+
20
+ def description
21
+ "#{instance.id} Tasks Scheduler"
22
+ end
23
+
24
+ def exec_run?
25
+ options[OPTION_EXEC_RUN]
26
+ end
27
+
28
+ def option_list
29
+ self.class.lists.option
30
+ end
31
+
32
+ def restart
33
+ options[OPTION_RESTART]
34
+ end
35
+
36
+ def unit_name
37
+ "#{instance.id}_tasks_scheduler.service"
38
+ end
39
+
40
+ def user
41
+ instance.ssh_username
42
+ end
43
+
44
+ private
45
+
46
+ def sudo_execute!(*args)
47
+ platform_instance.host_env.command(['sudo'] + args).execute!
48
+ end
49
+
50
+ def sudo_system!(*args)
51
+ command_args = ['sudo'] + args
52
+ infom "Running \"#{::Shellwords.join(command_args)}\"..."
53
+ platform_instance.host_env.command(command_args).system!
54
+ end
55
+ end
56
+ end
57
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.1.4'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -0,0 +1,12 @@
1
+ [Unit]
2
+ Description='%%description%%'
3
+ After=postgresql.service
4
+
5
+ [Service]
6
+ Type=forking
7
+ %%service_exec_lines%%
8
+ Restart=%%restart%%
9
+ User=%%user%%
10
+
11
+ [Install]
12
+ WantedBy=multi-user.target
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ source "$HOME/.rvm/scripts/rvm"
6
+ ( cd '%%fs_path%%'; RAILS_ENV=production bundle exec tasks_scheduler "$@" )
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_rails_base1', '~> 0.1'
15
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.2'
16
16
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.2'
17
17
  s.add_dependency 'curb', '~> 0.9.10'
18
18
  s.add_dependency 'eac_fs', '~> 0.4'
19
19
  s.add_dependency 'eac_rest', '~> 0.4'
20
20
  s.add_dependency 'eac_ruby_utils', '~> 0.68'
21
21
 
22
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
22
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
23
23
  end