eac_cli 0.12.5 → 0.12.6

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: 06fa078cca37a8d02eeb2d32702888fc6bc7c6150320d16cdf3ad83ef2fab28b
4
- data.tar.gz: e3a6678873bee5cd310d76e71eb0f9e8b50cab39cc4f95a8e4b30fd88e6d78da
3
+ metadata.gz: e9465f0f0d648395bb6616a208f830034405eaed91e6d186f8235cd2b0ea28a6
4
+ data.tar.gz: efd2ab2ad3737f7f12577908cc3c0bda2fbead8ddaa99ae671c72162a3f63bb3
5
5
  SHA512:
6
- metadata.gz: 3f357f8ecc24cecd4aec3eafd9e8a521e6a0029001a8bd4c24bc85771645da6dce944f2dd8018b70493a2b2b8570b498db3f1e310949e4063e18c1b71b1549b8
7
- data.tar.gz: 452cba742e5fa4ce208502526b855c6e480fe34059da86112dbbcc5056a01b62ac716d61c3a44cd7f958d977421110cd79740595fe84462cb99aa010fed6a008
6
+ metadata.gz: 88e58527420ebd47d4de3684bdd6d2c18eb6b5b1be87c33043b0d3951d924265d44b9108feed7f3c0cd236ef11546ecf188c2a1c0de0ab73e0b4740c2df63287
7
+ data.tar.gz: 45fb719847efcade7e5c56b015ebd8aefce718d109f11aebb97f7645a681ec5ed53358a3a7beebc63019b77e3847b2be69421e1b9b8bcaacbf7682ecaafdec20
@@ -47,53 +47,5 @@ module EacCli
47
47
  include ActiveSupport::Callbacks
48
48
  define_callbacks :run
49
49
  end
50
-
51
- module AfterClassMethods
52
- def create(*runner_context_args)
53
- r = new
54
- r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
55
- r
56
- end
57
-
58
- def run(*runner_context_args)
59
- r = create(*runner_context_args)
60
- r.run_run
61
- r
62
- end
63
-
64
- def runner_definition(&block)
65
- @runner_definition ||= super_runner_definition
66
- @runner_definition.instance_eval(&block) if block
67
- @runner_definition
68
- end
69
-
70
- def super_runner_definition
71
- superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
72
- end
73
- end
74
-
75
- module InstanceMethods
76
- def run_run
77
- parsed
78
- run_callbacks(:run) { run }
79
- rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
80
- # Do nothing
81
- end
82
-
83
- def runner_context
84
- return @runner_context if @runner_context
85
-
86
- raise 'Context was required, but was not set yet'
87
- end
88
-
89
- def runner_context=(new_runner_context)
90
- @runner_context = new_runner_context
91
- @parsed = nil
92
- end
93
-
94
- def parsed
95
- @parsed ||= ::EacCli::Parser.new(self.class.runner_definition, runner_context.argv).parsed
96
- end
97
- end
98
50
  end
99
51
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ module Runner
5
+ module AfterClassMethods
6
+ def create(*runner_context_args)
7
+ r = new
8
+ r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
9
+ r
10
+ end
11
+
12
+ def run(*runner_context_args)
13
+ r = create(*runner_context_args)
14
+ r.run_run
15
+ r
16
+ end
17
+
18
+ def runner_definition(&block)
19
+ @runner_definition ||= super_runner_definition
20
+ @runner_definition.instance_eval(&block) if block
21
+ @runner_definition
22
+ end
23
+
24
+ def super_runner_definition
25
+ superclass.try(:runner_definition).if_present(&:dup) || ::EacCli::Definition.new
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ module Runner
5
+ module InstanceMethods
6
+ def run_run
7
+ parsed
8
+ run_callbacks(:run) { run }
9
+ rescue ::EacCli::Parser::Error => e
10
+ $stderr.write("#{e}\n")
11
+ rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
12
+ # Do nothing
13
+ end
14
+
15
+ def runner_context
16
+ return @runner_context if @runner_context
17
+
18
+ raise 'Context was required, but was not set yet'
19
+ end
20
+
21
+ def runner_context=(new_runner_context)
22
+ @runner_context = new_runner_context
23
+ @parsed = nil
24
+ end
25
+
26
+ def parsed
27
+ @parsed ||= ::EacCli::Parser.new(self.class.runner_definition, runner_context.argv).parsed
28
+ end
29
+ end
30
+ end
31
+ end
@@ -40,7 +40,7 @@ module EacCli
40
40
  end
41
41
 
42
42
  def help_extra_text
43
- (['Subcommands:'] + available_subcommands.keys.map { |s| " #{s}" })
43
+ (['Subcommands:'] + available_subcommands.keys.sort.map { |s| " #{s}" })
44
44
  .map { |v| "#{v}\n" }.join
45
45
  end
46
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.12.5'
4
+ VERSION = '0.12.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.5
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-10 00:00:00.000000000 Z
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -80,8 +80,10 @@ files:
80
80
  - lib/eac_cli/patches/object.rb
81
81
  - lib/eac_cli/patches/object/runner_with.rb
82
82
  - lib/eac_cli/runner.rb
83
+ - lib/eac_cli/runner/after_class_methods.rb
83
84
  - lib/eac_cli/runner/context.rb
84
85
  - lib/eac_cli/runner/exit.rb
86
+ - lib/eac_cli/runner/instance_methods.rb
85
87
  - lib/eac_cli/runner_with.rb
86
88
  - lib/eac_cli/runner_with/help.rb
87
89
  - lib/eac_cli/runner_with/output_file.rb