avm-tools 0.87.1 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b5ee493e22bb4e2eb77a9e62067e0de6dd23b3d3d4dd62ba2eeadedf183d22
4
- data.tar.gz: 0d528d18932807487721a84c32a6c4d1f2906a015840ac360921fcbca78b493c
3
+ metadata.gz: 39cd843842c1fc4981f71fe88945db68e140b1aa6a7bdddeddd8b344c4215501
4
+ data.tar.gz: 1fbe73dc1d4e2854e637fc6b697880e6ad192ecb62b4cad5d81612b1e8c22e88
5
5
  SHA512:
6
- metadata.gz: 4a7a88618b900c728d17a3ef9f492f1b0f42d74313190f8de7d532ebda8f89e27866eb9edbdee7043cfadfd075b71b44390d8c190191b11341120baef2489fea
7
- data.tar.gz: e209c17b18ab7d34483054cb5545da9e946212ca857ae52ec18fa87b00704c3a589697ab1e0dfa1ec8b093afe55a8f8ea5a1e61487bda8ca717196d4e0e47679
6
+ metadata.gz: eba623387eb4320e93facda684c544565c2a3b1b0abca7902793df59416506068df6a3b6e0359e4ded1c40897cccb80629f23802dbbe9cc101e637726bf55297
7
+ data.tar.gz: 4d9b78c8924c5879811517ba7089b74aa8aa5b60a35a99d00e57330431da9141a44123c68c62c191210d9df584cbb02bd881d3067302cc09f2ae3fcc893d3f32
@@ -0,0 +1,43 @@
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('fs_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,29 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_rails_base1/instance'
4
+ require 'avm/eac_rails_base1/runner_with/rails_environment'
4
5
  require 'eac_cli/runner'
5
6
 
6
7
  module Avm
7
8
  module EacRailsBase1
8
9
  module RunnerWith
9
10
  module Bundle
10
- DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'
11
-
12
11
  common_concern do
13
- include ::EacCli::Runner
14
-
15
- runner_definition do
16
- arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate' \
17
- ' (test/development/production). Default: "development".'
18
- end
19
- end
20
-
21
- module ClassMethods
22
- def default_rails_environment
23
- const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
24
- rescue ::NameError
25
- ::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
26
- end
12
+ include ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment
27
13
  end
28
14
 
29
15
  def bundle_command
@@ -35,22 +21,6 @@ module Avm
35
21
  infov 'Rails environment', rails_environment
36
22
  bundle_command.system!
37
23
  end
38
-
39
- def default_rails_environment
40
- self.class.default_rails_environment
41
- end
42
-
43
- def rails_instance
44
- if respond_to?(:runner_context)
45
- runner_context.call(:instance)
46
- else
47
- context(:instance)
48
- end
49
- end
50
-
51
- def rails_environment
52
- parsed.environment.presence || default_rails_environment
53
- end
54
24
  end
55
25
  end
56
26
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instance'
4
+ require 'eac_cli/runner'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module RunnerWith
9
+ module RailsEnvironment
10
+ DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'
11
+
12
+ common_concern do
13
+ include ::EacCli::Runner
14
+
15
+ runner_definition do
16
+ arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate' \
17
+ ' (test/development/production). Default: "development".'
18
+ end
19
+ end
20
+
21
+ module ClassMethods
22
+ def default_rails_environment
23
+ const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
24
+ rescue ::NameError
25
+ ::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
26
+ end
27
+ end
28
+
29
+ def default_rails_environment
30
+ self.class.default_rails_environment
31
+ end
32
+
33
+ def rails_environment
34
+ parsed.environment.presence || default_rails_environment
35
+ end
36
+
37
+ def rails_instance
38
+ if respond_to?(:runner_context)
39
+ runner_context.call(:instance)
40
+ else
41
+ context(:instance)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -31,7 +31,7 @@ module Avm
31
31
  private
32
32
 
33
33
  def instance_uncached
34
- self.class.instance_class.by_id(options.fetch('<instance-id>'))
34
+ self.class.instance_class.by_id(parsed.instance_id)
35
35
  end
36
36
  end
37
37
  end
@@ -2,16 +2,13 @@
2
2
 
3
3
  require 'avm/instances/base'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
- class Instance < ::EacRubyUtils::Console::DocoptRunner
9
+ class Instance
11
10
  require_sub __FILE__
12
- runner_with
13
-
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Utilities for generic instances.'
16
13
  pos_arg :instance_id
17
14
  subcommands
@@ -20,7 +17,7 @@ module Avm
20
17
  private
21
18
 
22
19
  def instance_uncached
23
- ::Avm::Instances::Base.by_id(options['<instance_id>'])
20
+ ::Avm::Instances::Base.by_id(parsed.instance_id)
24
21
  end
25
22
  end
26
23
  end
@@ -2,16 +2,13 @@
2
2
 
3
3
  require 'avm/instances/entry_keys'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
- class Instance < ::EacRubyUtils::Console::DocoptRunner
11
- class Info < ::EacRubyUtils::Console::DocoptRunner
12
- runner_with
13
-
14
- runner_definition do
9
+ class Instance
10
+ class Info
11
+ runner_with :help do
15
12
  desc 'Show info about a instance.'
16
13
  end
17
14
 
@@ -35,7 +32,7 @@ module Avm
35
32
  end
36
33
 
37
34
  def instance
38
- context(:instance)
35
+ runner_context.call(:instance)
39
36
  end
40
37
  end
41
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.87.1'
5
+ VERSION = '0.88.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.87.1
4
+ version: 0.88.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
@@ -301,8 +301,10 @@ files:
301
301
  - lib/avm/eac_rails_base1/runner.rb
302
302
  - lib/avm/eac_rails_base1/runner/bundle.rb
303
303
  - lib/avm/eac_rails_base1/runner/code_runner.rb
304
+ - lib/avm/eac_rails_base1/runner/log.rb
304
305
  - lib/avm/eac_rails_base1/runner/rails_server.rb
305
306
  - lib/avm/eac_rails_base1/runner_with/bundle.rb
307
+ - lib/avm/eac_rails_base1/runner_with/rails_environment.rb
306
308
  - lib/avm/eac_redmine_base0.rb
307
309
  - lib/avm/eac_redmine_base0/apache_host.rb
308
310
  - lib/avm/eac_redmine_base0/core_update.rb