avm-eac_rails_base1 0.7.1 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84854e10d4ae4915469b65a563b5579d086d935a989423a373e58a3d49173adb
4
- data.tar.gz: a58c7ab22468e0f964594443f35136fd71c5096f93071cd3b361b9ec13a4396f
3
+ metadata.gz: 5f623545c81c6f7e0df051e737c3306898c3d451e8460a338cc9664a139c287a
4
+ data.tar.gz: d6dc3362a5ca42420e589d40e23b9fdbad359d4c69a4bb462885d7e279c32278
5
5
  SHA512:
6
- metadata.gz: 6b84460b7913ee8a90af0a279b550e5e8118fbd16d0af80e1c238b31aac5f8c6431269316948ef7ebe81c834b27b5bf4457fe47d332494d1610b68259eb00322
7
- data.tar.gz: 412f16d894b91b4de55744313abe50a3114af5965334fe31e4791003d8b8e49121fa0b8e20b30ff976a3a71e84ad5f2a1e5aaf17092edfd7e394021205d23394
6
+ metadata.gz: 58cc5738bb3ea021e3933f1ffde3ad35fd167d66d25989c147d24fd3d8297d32378347277d194f036a31232a7d12fc74d3b0a5b33376abc9faff542fb6e22d63
7
+ data.tar.gz: c647a1b8efc2e8d51f46e2b724e0d107b20f01ea6cd5fcdf5f36616fc98d156bdd720d5654c7c5355c4d07e1b773ab621c2ff95fa94d6eb168309364545df944
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/eac_rails_base1/instances/runners'
4
+ require 'avm/eac_ruby_base1/instances/mixin'
3
5
  require 'avm/eac_ruby_base1/sources/base'
4
6
  require 'avm/eac_webapp_base0/instances/base'
5
7
 
@@ -7,6 +9,8 @@ module Avm
7
9
  module EacRailsBase1
8
10
  module Instances
9
11
  class Base < ::Avm::EacWebappBase0::Instances::Base
12
+ include ::Avm::EacRubyBase1::Instances::Mixin
13
+
10
14
  DEFAULT_RAILS_ENVIRONMENT = 'production'
11
15
 
12
16
  def bundle(*args)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'eac_cli/core_ext'
5
+ require 'shellwords'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ module Instances
10
+ module Runners
11
+ class Bundle
12
+ runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle, :help do
13
+ desc 'Runs "bundle ...".'
14
+ pos_arg :'bundle-args', repeat: true, optional: true
15
+ end
16
+
17
+ def run
18
+ bundle_run
19
+ end
20
+
21
+ def bundle_args
22
+ parsed.bundle_args.reject { |arg| arg == '--' }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Runners
10
+ class CodeRunner
11
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
12
+ desc 'Runs a Ruby code with "rails runner".'
13
+ pos_arg :code
14
+ end
15
+
16
+ def run
17
+ infov 'Environment', runner_context.call(:instance).host_env
18
+ bundle_run
19
+ end
20
+
21
+ def bundle_args
22
+ %w[exec rails runner] + [parsed.code]
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/rails_environment'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Log
10
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment do
11
+ desc 'Read application\'s log.'
12
+ bool_opt '-f', '--follow', 'Output appended data as the log grows.'
13
+ end
14
+
15
+ def run
16
+ start_banner
17
+ tail_command.system
18
+ end
19
+
20
+ private
21
+
22
+ def log_path
23
+ ::File.join(rails_instance.read_entry('install.path'), 'log',
24
+ "#{rails_environment}.log")
25
+ end
26
+
27
+ def start_banner
28
+ infov 'Environment', rails_environment
29
+ infov 'Log path', log_path
30
+ end
31
+
32
+ def tail_command
33
+ rails_instance.host_env.command(*tail_command_args)
34
+ end
35
+
36
+ def tail_command_args
37
+ r = %w[tail]
38
+ r << '--follow' if parsed.follow?
39
+ r + [log_path]
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/rails_environment'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Logs
10
+ class Clear
11
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
12
+ desc 'Clear logs.'
13
+ end
14
+
15
+ def run
16
+ bundle_run
17
+ end
18
+
19
+ def bundle_args
20
+ %w[exec rake log:clear]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Logs
10
+ require_sub __FILE__
11
+ runner_with :help, :subcommands do
12
+ desc 'Manipule multiple application\'s logs.'
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'avm/instances/entry_keys'
5
+ require 'eac_cli/core_ext'
6
+ require 'shellwords'
7
+
8
+ module Avm
9
+ module EacRailsBase1
10
+ module Instances
11
+ module Runners
12
+ class RailsServer
13
+ DEFAULT_RAILS_ENVIRONMENT = 'development'
14
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
15
+ desc 'Run the embbeded Rails web server.'
16
+ end
17
+
18
+ def run
19
+ infov 'Environment', rails_environment
20
+ infov 'Bundle args', ::Shellwords.join(bundle_args)
21
+ infov 'Result', bundle_command.system
22
+ end
23
+
24
+ protected
25
+
26
+ def bundle_args
27
+ ['exec', 'rails', 'server', '--port',
28
+ runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)]
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/systemd_unit'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Runners
10
+ class TasksScheduler
11
+ class SystemdUnit
12
+ DEFAULT_RESTART = 'on-failure'
13
+
14
+ runner_with :help do
15
+ desc 'Configure Systemd unit for instace\'s tasks scheduler daemon (Reference: ' \
16
+ 'https://www.freedesktop.org/software/systemd/man/systemd.service.html).'
17
+ bool_opt '-e', '--exec-run', 'Run daemon with "run" instead of "start"/"stop".'
18
+ arg_opt '-r', '--restart', 'Value for systemd.service, Restart=.',
19
+ default: DEFAULT_RESTART
20
+ end
21
+
22
+ delegate :restart, to: :parsed
23
+
24
+ def run
25
+ if result.error?
26
+ fatal_error result.to_s
27
+ else
28
+ infov 'Result', result.label
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def systemd_unit_uncached
35
+ ::Avm::EacRailsBase1::Instances::SystemdUnit.new(runner_context.call(:instance),
36
+ restart: parsed.restart,
37
+ exec_run: parsed.exec_run?)
38
+ end
39
+
40
+ def result_uncached
41
+ systemd_unit.run
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class TasksScheduler
10
+ require_sub __FILE__
11
+
12
+ runner_with :help, :subcommands do
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/runner'
4
3
  require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
7
6
  module EacRailsBase1
8
- class Runner < ::Avm::EacWebappBase0::Runner
9
- require_sub __FILE__
7
+ module Instances
8
+ module Runners
9
+ require_sub __FILE__
10
+ end
10
11
  end
11
12
  end
12
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.7.1'
5
+ VERSION = '0.8.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_rails_base1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,74 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.57'
19
+ version: '0.65'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.57'
26
+ version: '0.65'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_ruby_base1
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.27'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.27.1
33
+ version: '0.30'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '0.27'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.27.1
40
+ version: '0.30'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: avm-eac_webapp_base0
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0.12'
47
+ version: '0.13'
54
48
  - - ">="
55
49
  - !ruby/object:Gem::Version
56
- version: 0.12.3
50
+ version: 0.13.1
57
51
  type: :runtime
58
52
  prerelease: false
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
54
  requirements:
61
55
  - - "~>"
62
56
  - !ruby/object:Gem::Version
63
- version: '0.12'
57
+ version: '0.13'
64
58
  - - ">="
65
59
  - !ruby/object:Gem::Version
66
- version: 0.12.3
60
+ version: 0.13.1
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: eac_ruby_utils
69
63
  requirement: !ruby/object:Gem::Requirement
70
64
  requirements:
71
65
  - - "~>"
72
66
  - !ruby/object:Gem::Version
73
- version: '0.107'
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 0.107.1
67
+ version: '0.112'
77
68
  type: :runtime
78
69
  prerelease: false
79
70
  version_requirements: !ruby/object:Gem::Requirement
80
71
  requirements:
81
72
  - - "~>"
82
73
  - !ruby/object:Gem::Version
83
- version: '0.107'
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.107.1
74
+ version: '0.112'
87
75
  - !ruby/object:Gem::Dependency
88
76
  name: eac_ruby_gem_support
89
77
  requirement: !ruby/object:Gem::Requirement
@@ -108,18 +96,18 @@ files:
108
96
  - lib/avm/eac_rails_base1/instances.rb
109
97
  - lib/avm/eac_rails_base1/instances/apache_host.rb
110
98
  - lib/avm/eac_rails_base1/instances/base.rb
99
+ - lib/avm/eac_rails_base1/instances/runners.rb
100
+ - lib/avm/eac_rails_base1/instances/runners/bundle.rb
101
+ - lib/avm/eac_rails_base1/instances/runners/code_runner.rb
102
+ - lib/avm/eac_rails_base1/instances/runners/log.rb
103
+ - lib/avm/eac_rails_base1/instances/runners/logs.rb
104
+ - lib/avm/eac_rails_base1/instances/runners/logs/clear.rb
105
+ - lib/avm/eac_rails_base1/instances/runners/rails_server.rb
106
+ - lib/avm/eac_rails_base1/instances/runners/tasks_scheduler.rb
107
+ - lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb
111
108
  - lib/avm/eac_rails_base1/instances/systemd_unit.rb
112
109
  - lib/avm/eac_rails_base1/instances/systemd_unit/service.rb
113
110
  - lib/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler_command.rb
114
- - lib/avm/eac_rails_base1/runner.rb
115
- - lib/avm/eac_rails_base1/runner/bundle.rb
116
- - lib/avm/eac_rails_base1/runner/code_runner.rb
117
- - lib/avm/eac_rails_base1/runner/log.rb
118
- - lib/avm/eac_rails_base1/runner/logs.rb
119
- - lib/avm/eac_rails_base1/runner/logs/clear.rb
120
- - lib/avm/eac_rails_base1/runner/rails_server.rb
121
- - lib/avm/eac_rails_base1/runner/tasks_scheduler.rb
122
- - lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb
123
111
  - lib/avm/eac_rails_base1/runner_with/bundle.rb
124
112
  - lib/avm/eac_rails_base1/runner_with/rails_environment.rb
125
113
  - lib/avm/eac_rails_base1/sources/base.rb
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/bundle'
4
- require 'eac_cli/core_ext'
5
- require 'shellwords'
6
-
7
- module Avm
8
- module EacRailsBase1
9
- class Runner < ::Avm::EacWebappBase0::Runner
10
- class Bundle
11
- runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle, :help do
12
- desc 'Runs "bundle ...".'
13
- pos_arg :'bundle-args', repeat: true, optional: true
14
- end
15
-
16
- def run
17
- bundle_run
18
- end
19
-
20
- def bundle_args
21
- parsed.bundle_args.reject { |arg| arg == '--' }
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/bundle'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module EacRailsBase1
8
- class Runner < ::Avm::EacWebappBase0::Runner
9
- class CodeRunner
10
- runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
11
- desc 'Runs a Ruby code with "rails runner".'
12
- pos_arg :code
13
- end
14
-
15
- def run
16
- infov 'Environment', runner_context.call(:instance).host_env
17
- bundle_run
18
- end
19
-
20
- def bundle_args
21
- %w[exec rails runner] + [parsed.code]
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/rails_environment'
4
- require 'avm/eac_webapp_base0/runner'
5
-
6
- module Avm
7
- module EacRailsBase1
8
- class Runner < ::Avm::EacWebappBase0::Runner
9
- class Log
10
- runner_with :help, ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment do
11
- desc 'Read application\'s log.'
12
- bool_opt '-f', '--follow', 'Output appended data as the log grows.'
13
- end
14
-
15
- def run
16
- start_banner
17
- tail_command.system
18
- end
19
-
20
- private
21
-
22
- def log_path
23
- ::File.join(rails_instance.read_entry('install.path'), 'log', "#{rails_environment}.log")
24
- end
25
-
26
- def start_banner
27
- infov 'Environment', rails_environment
28
- infov 'Log path', log_path
29
- end
30
-
31
- def tail_command
32
- rails_instance.host_env.command(*tail_command_args)
33
- end
34
-
35
- def tail_command_args
36
- r = %w[tail]
37
- r << '--follow' if parsed.follow?
38
- r + [log_path]
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/rails_environment'
4
- require 'avm/eac_webapp_base0/runner'
5
-
6
- module Avm
7
- module EacRailsBase1
8
- class Runner < ::Avm::EacWebappBase0::Runner
9
- class Logs
10
- class Clear
11
- runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
12
- desc 'Clear logs.'
13
- end
14
-
15
- def run
16
- bundle_run
17
- end
18
-
19
- def bundle_args
20
- %w[exec rake log:clear]
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/runner'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module EacRailsBase1
8
- class Runner < ::Avm::EacWebappBase0::Runner
9
- class Logs
10
- require_sub __FILE__
11
- runner_with :help, :subcommands do
12
- desc 'Manipule multiple application\'s logs.'
13
- subcommands
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/runner_with/bundle'
4
- require 'avm/instances/entry_keys'
5
- require 'eac_cli/core_ext'
6
- require 'shellwords'
7
-
8
- module Avm
9
- module EacRailsBase1
10
- class Runner < ::Avm::EacWebappBase0::Runner
11
- class RailsServer
12
- DEFAULT_RAILS_ENVIRONMENT = 'development'
13
- runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
14
- desc 'Run the embbeded Rails web server.'
15
- end
16
-
17
- def run
18
- infov 'Environment', rails_environment
19
- infov 'Bundle args', ::Shellwords.join(bundle_args)
20
- infov 'Result', bundle_command.system
21
- end
22
-
23
- protected
24
-
25
- def bundle_args
26
- ['exec', 'rails', 'server', '--port',
27
- runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)]
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_rails_base1/instances/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::Instances::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
@@ -1,17 +0,0 @@
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