atli 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 95863e37e95274081f2c343d9df00d0d97d19316
4
- data.tar.gz: eaf7d27b98f259c3a3b490b41ce57781a2bbe16d
3
+ metadata.gz: 49db1892c567c86738f2c77d5364f8e2ef3117f7
4
+ data.tar.gz: fafd83425c8fc655b45cec19513ffbdfa1158b1d
5
5
  SHA512:
6
- metadata.gz: b9acc28c198b5b72f3405d19c43e45a45222092193d012fe5c957cd2218f22261fc15adcb29f92ed90aa2b7f779ce5c4dd5c9635bf08a68956e8a87a354d4faf
7
- data.tar.gz: 7277fb5f16254c564194803f30a204afd1eeaae0474d569651ecbef3e05796a1ae6430c2820d34a19db750e2318bc25ceb2eea989a9bf75d9cf07d08f9fea0e6
6
+ metadata.gz: '088b411212e6745b57e4a5a7687ec3b15678c5a340a02ed21fc440a10b3690b19f91f477395a707eb4126c7164238182a5b3b53f7297889d8ea90c455852eaf0'
7
+ data.tar.gz: 1aaf96749935ecae1aedf2312fa0319afa5718293d80cd3d9e12a39491d54927e585a9b0df2cbc4fe07d33889918c593d809e7a77880017e84a1f1f9e9740d39
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  # ============================================================================
24
24
 
25
25
  # My guns
26
- spec.add_dependency "nrser", '>= 0.2.0.pre.2'
26
+ spec.add_dependency "nrser", '~> 0.3.1'
27
27
 
28
28
 
29
29
  # Development Dependencies
@@ -3,7 +3,6 @@ require 'nrser'
3
3
  require 'semantic_logger'
4
4
  require "thor/base"
5
5
 
6
- using NRSER
7
6
 
8
7
  class Thor
9
8
 
@@ -189,9 +188,7 @@ class Thor
189
188
  #
190
189
  # which, of course, doesn't work if +cmd+ is inside +subcmd+.
191
190
  #
192
- # @return [void]
193
- # *Atli* - as far as I can tell, this method just writes to STDOUT
194
- # and the return value is not / should not be used for anything.
191
+ # @return [nil]
195
192
  #
196
193
  def command_help(shell, command_name, subcommand = false)
197
194
  meth = normalize_command_name(command_name)
@@ -208,13 +205,15 @@ class Thor
208
205
  else
209
206
  shell.say command.description
210
207
  end
208
+
209
+ nil
211
210
  end
212
211
  alias_method :task_help, :command_help
213
212
 
214
213
  # Prints help information for this class.
215
214
  #
216
- # ==== Parameters
217
- # shell<Thor::Shell>
215
+ # @param [Thor::Shell] shell
216
+ # @return (see Thor::Base::ClassMethods#class_options_help)
218
217
  #
219
218
  def help(shell, subcommand = false)
220
219
  list = printable_commands(true, subcommand)
@@ -26,7 +26,7 @@ require 'thor/base/class_methods'
26
26
  # Refinements
27
27
  # =======================================================================
28
28
 
29
- using NRSER
29
+ require 'nrser/refinements/types'
30
30
  using NRSER::Types
31
31
 
32
32
 
@@ -178,6 +178,28 @@ class Thor
178
178
  raise error
179
179
  end
180
180
 
181
+
182
+ # Hook for processing values return by command methods. So you can
183
+ # format it or print it or whatever.
184
+ #
185
+ # This implementation just returns the result per the specs.
186
+ #
187
+ # @param [Object] result
188
+ # Whatever the command returned.
189
+ #
190
+ # @param [Thor::Command] command
191
+ # The command instance that was running when the error occurred.
192
+ #
193
+ # @param [Array<String>] args
194
+ # The arguments to the command that was running.
195
+ #
196
+ # @return [Object]
197
+ # The `result`.
198
+ #
199
+ def on_run_success result, command, args
200
+ result
201
+ end
202
+
181
203
  # end protected
182
204
 
183
205
 
@@ -13,7 +13,7 @@ require 'thor/base/common_class_options'
13
13
  # Refinements
14
14
  # =======================================================================
15
15
 
16
- using NRSER
16
+ require 'nrser/refinements/types'
17
17
  using NRSER::Types
18
18
 
19
19
 
@@ -533,7 +533,9 @@ module Thor::Base::ClassMethods
533
533
 
534
534
  # Prints the class options per group. If an option does not belong to
535
535
  # any group, it's printed as Class option.
536
- #
536
+ #
537
+ # @return [nil]
538
+ #
537
539
  def class_options_help(shell, groups = {}) #:nodoc:
538
540
  # Group options by group
539
541
  class_options.each do |_, value|
@@ -549,6 +551,8 @@ module Thor::Base::ClassMethods
549
551
  groups.each do |group_name, options|
550
552
  print_options(shell, options, group_name)
551
553
  end
554
+
555
+ nil
552
556
  end
553
557
 
554
558
 
@@ -12,7 +12,7 @@ require 'nrser'
12
12
  # Refinements
13
13
  # =======================================================================
14
14
 
15
- using NRSER
15
+ require 'nrser/refinements/types'
16
16
  using NRSER::Types
17
17
 
18
18
  # Declarations
@@ -63,7 +63,7 @@ class Thor
63
63
  # 1. Protect from calling private methods by error'ing out if {#name}
64
64
  # is the name of a private method of `instance`.
65
65
  #
66
- if private_method? instance
66
+ result = if private_method? instance
67
67
  instance.class.handle_no_command_error name
68
68
 
69
69
  # 2. The success case - if {#name} is a public method of `instance`
@@ -101,6 +101,8 @@ class Thor
101
101
 
102
102
  end # Method invocation switch
103
103
 
104
+ instance.__send__ :on_run_success, result, self, args
105
+
104
106
  rescue ArgumentError => error
105
107
  if handle_argument_error? instance, error, caller
106
108
  # NOTE I *believe* `arity` could still be `nil`, assuming that
@@ -1,97 +1,37 @@
1
1
  class Thor
2
- module CoreExt #:nodoc:
3
- # A hash with indifferent access and magic predicates.
2
+ module CoreExt
3
+ # A hash with indifferent access and magic predicates.
4
+ #
5
+ # hash = HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
6
+ #
7
+ # hash[:foo] #=> 'bar'
8
+ # hash['foo'] #=> 'bar'
9
+ # hash.foo? #=> true
10
+ #
11
+ class HashWithIndifferentAccess < ::HashWithIndifferentAccess #:nodoc:
12
+
13
+ protected
14
+ # ========================================================================
15
+
16
+ # Magic predicates. For instance:
4
17
  #
5
- # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
18
+ # options.force? # => !!options['force']
19
+ # options.shebang # => "/usr/lib/local/ruby"
20
+ # options.test_framework?(:rspec) # => options[:test_framework] == :rspec
6
21
  #
7
- # hash[:foo] #=> 'bar'
8
- # hash['foo'] #=> 'bar'
9
- # hash.foo? #=> true
10
- #
11
- class HashWithIndifferentAccess < ::Hash #:nodoc:
12
- def initialize(hash = {})
13
- super()
14
- hash.each do |key, value|
15
- self[convert_key(key)] = value
16
- end
17
- end
18
-
19
- def [](key)
20
- super(convert_key(key))
21
- end
22
-
23
- def []=(key, value)
24
- super(convert_key(key), value)
25
- end
26
-
27
- def delete(key)
28
- super(convert_key(key))
29
- end
30
-
31
- def fetch(key, *args)
32
- super(convert_key(key), *args)
33
- end
34
-
35
- def key?(key)
36
- super(convert_key(key))
37
- end
38
-
39
- def values_at(*indices)
40
- indices.map { |key| self[convert_key(key)] }
41
- end
42
-
43
- def merge(other)
44
- dup.merge!(other)
45
- end
46
-
47
- def merge!(other)
48
- other.each do |key, value|
49
- self[convert_key(key)] = value
50
- end
51
- self
52
- end
53
-
54
- def reverse_merge(other)
55
- self.class.new(other).merge(self)
56
- end
57
-
58
- def reverse_merge!(other_hash)
59
- replace(reverse_merge(other_hash))
60
- end
61
-
62
- def replace(other_hash)
63
- super(other_hash)
64
- end
65
-
66
- # Convert to a Hash with String keys.
67
- def to_hash
68
- Hash.new(default).merge!(self)
69
- end
70
-
71
- protected
72
-
73
- def convert_key(key)
74
- key.is_a?(Symbol) ? key.to_s : key
75
- end
76
-
77
- # Magic predicates. For instance:
78
- #
79
- # options.force? # => !!options['force']
80
- # options.shebang # => "/usr/lib/local/ruby"
81
- # options.test_framework?(:rspec) # => options[:test_framework] == :rspec
82
- #
83
- def method_missing(method, *args)
84
- method = method.to_s
85
- if method =~ /^(\w+)\?$/
86
- if args.empty?
87
- !!self[$1]
88
- else
89
- self[$1] == args.first
90
- end
22
+ def method_missing(method, *args)
23
+ method = method.to_s
24
+ if method =~ /^(\w+)\?$/
25
+ if args.empty?
26
+ !!self[$1]
91
27
  else
92
- self[method]
28
+ self[$1] == args.first
93
29
  end
30
+ else
31
+ self[method]
94
32
  end
95
33
  end
96
- end
97
- end
34
+
35
+ public # end protected ***************************************************
36
+
37
+ end; end; end
@@ -10,6 +10,8 @@
10
10
  # Deps
11
11
  # -----------------------------------------------------------------------
12
12
 
13
+ require 'nrser/core_ext/array'
14
+
13
15
  # Project / Package
14
16
  # -----------------------------------------------------------------------
15
17
 
@@ -17,7 +19,7 @@
17
19
  # Refinements
18
20
  # =======================================================================
19
21
 
20
- using NRSER
22
+ require 'nrser/refinements/types'
21
23
  using NRSER::Types
22
24
 
23
25
 
@@ -14,7 +14,7 @@ class Thor
14
14
  #
15
15
  # @return [String]
16
16
  #
17
- VERSION = '0.1.5'
17
+ VERSION = '0.1.6'
18
18
 
19
19
 
20
20
  # The version of Thor that Atli is up to date with.
@@ -27,5 +27,5 @@ class Thor
27
27
  #
28
28
  # @return [String]
29
29
  #
30
- THOR_VERSION = '0.1.5'
30
+ THOR_VERSION = '0.1.6'
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Souza (Atli)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-03-03 00:00:00.000000000 Z
13
+ date: 2018-05-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -30,16 +30,16 @@ dependencies:
30
30
  name: nrser
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ">="
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 0.2.0.pre.2
35
+ version: 0.3.1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 0.2.0.pre.2
42
+ version: 0.3.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: yard
45
45
  requirement: !ruby/object:Gem::Requirement