bogo-cli 0.1.10 → 0.1.12

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: 6496e4592603ec28d442abc2f66c5d39a4c51469
4
- data.tar.gz: fd61579ed6f641e2d7e66fb2984d1ac1865c8a5f
3
+ metadata.gz: 98827607bd4aad29fc80e2c84836b34c307e3430
4
+ data.tar.gz: 7f024466ba3b5ff1b03748f60013f3230d0a4a95
5
5
  SHA512:
6
- metadata.gz: 407792bce6252ae2c5dca9670f49c366e58881e7a8e05331546ae05a8a45292ebdcf3b2d0a5b319ca3973f34a6f835c81abfd3d44d50e24273d91b6428f94d64
7
- data.tar.gz: f7883b46ead57227688a85df247ae9be02c3a39d71d1fdfed6e08137841bdff5389239c5e64c0cc5101fc3888b705a294d2b5c4a949501878650196139cd229c
6
+ metadata.gz: ad7faec453b2ed5c2acc7b6960e35f9573d8526c8aaf351efb164bd9ee73f324dd18a1c0cb721c8e9947ff03f4431403d91d6ca5c708f7fa83e6feb573bfc00d
7
+ data.tar.gz: af3f22db577c5dc7815f94e0755b07c03f4265cb900345ca000fc30b6d3383089e1cedcc59a0591f427813e7d90a510cf896d73f52b696eb904cf6cb3913456b
@@ -1,3 +1,6 @@
1
+ ## v0.1.12
2
+ * Add `Bogo::Cli#config` method that merges `#options` with `#opts`
3
+
1
4
  ## v0.1.10
2
5
  * Pass namespaced configuration through to UI
3
6
 
@@ -7,6 +7,8 @@ module Bogo
7
7
  # Abstract command class
8
8
  class Command
9
9
 
10
+ include Bogo::Memoization
11
+
10
12
  # @return [Hash] options
11
13
  attr_reader :options
12
14
  # @return [Array] cli arguments
@@ -24,7 +26,7 @@ module Bogo
24
26
  :app_name => options.fetch(:app_name,
25
27
  self.class.name.split('::').first
26
28
  )
27
- ).merge(opts)
29
+ ).merge(config.to_smash)
28
30
  @ui = options.delete(:ui) || Ui.new(ui_args)
29
31
  load_config!
30
32
  end
@@ -38,11 +40,19 @@ module Bogo
38
40
 
39
41
  protected
40
42
 
43
+ # Provides top level options with command specific options
44
+ # merged to provide custom overrides
45
+ #
46
+ # @return [Smash]
47
+ def config
48
+ options.to_smash.deep_merge(opts.to_smash)
49
+ end
50
+
41
51
  # Command specific options
42
52
  #
43
53
  # @return [Hash]
44
54
  def opts
45
- options.fetch(self.class.name.split('::').last.downcase, {})
55
+ options.fetch(Bogo::Utility.snake(self.class.name.split('::').last), {})
46
56
  end
47
57
 
48
58
  # Load configuration file and merge opts
@@ -1,6 +1,6 @@
1
1
  module Bogo
2
2
  module Cli
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.10')
4
+ VERSION = Gem::Version.new('0.1.12')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo