bogo-cli 0.1.20 → 0.1.22

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: 2e147b3d448618f5545995f9be5731d2c9c26f55
4
- data.tar.gz: 193dc839ea95586554ea5d3fcd67baba79cf49f8
3
+ metadata.gz: acd52ffa30759ad9440c86ea5b919da900aab8ee
4
+ data.tar.gz: 66c23dd1d5c282dbf55fec2e51a9256926bae158
5
5
  SHA512:
6
- metadata.gz: 9c08c98499e364c5694f6b761b759c38ab0e907e5fa7506f88c61291ad5d56b613a7d98f1359eabfcaf5cbbe58849cd75f30b4ccfe55195ede05e16f20c061c4
7
- data.tar.gz: 5d4b3f9ac445b4e61a3fc610c2ff6fa8c5fbf174a39fa7189bfb4e15832949964b1833f2ce6a2f78b8469ea005da5f2cb5929eb9631cce7b74b81baf0d234037
6
+ metadata.gz: 5fa6e498163fed36510646ce599c1be0b948d2339a972aff985986727f7d50b64358808ec20426c57f41e7137473a33373e8311827aa907ccc61b21a62416ef8
7
+ data.tar.gz: a08e2273c046137d1319a50e0de07332cdfe0606e6e3db29584a3028dc568a1852fe2f4b06c6ae82dcd3e6f3187fb020b7d83247f12acc16354deb151e077904
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.22
2
+ * Add `Bogo::Cli#config_class` to specify custom `Bogo::Config`
3
+ * Always load provided args through config
4
+
1
5
  ## v0.1.20
2
6
  * Bug fix on command initialization when options provided are Hash-like
3
7
 
@@ -21,6 +21,7 @@ module Bogo
21
21
  # @return [self]
22
22
  def initialize(cli_opts, args)
23
23
  @options = cli_opts.to_hash.to_smash(:snake)
24
+ @options.delete_if{|k,v| v.nil?}
24
25
  @arguments = args
25
26
  ui_args = Smash.new(
26
27
  :app_name => options.fetch(:app_name,
@@ -72,22 +73,29 @@ module Bogo
72
73
  # @return [Hash]
73
74
  def load_config!
74
75
  if(options[:config])
75
- config = Bogo::Config.new(options[:config])
76
+ config_inst = config_class.new(options[:config])
76
77
  elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))
77
78
  path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|
78
79
  full_check = File.expand_path(check)
79
80
  File.exists?(full_check)
80
81
  end
81
- config = Bogo::Config.new(path) if path
82
+ config_inst = config_class.new(path) if path
82
83
  end
83
- if(config)
84
+ new_opts = config_class.new(options)
85
+ @options = new_opts.to_smash
86
+ if(config_inst)
84
87
  merge_opts = Smash[options.to_smash.map{|k,v| [k,v] unless v.nil?}.compact]
85
88
  merge_opts.delete(:config)
86
- @options = config.to_smash.deep_merge(merge_opts)
89
+ @options = config_inst.to_smash.deep_merge(merge_opts)
87
90
  end
88
91
  options
89
92
  end
90
93
 
94
+ # @return [Class] config class
95
+ def config_class
96
+ Bogo::Config
97
+ end
98
+
91
99
  # Wrap action within nice text. Output resulting Hash if provided
92
100
  #
93
101
  # @param msg [String] message of action in progress
@@ -1,6 +1,6 @@
1
1
  module Bogo
2
2
  module Cli
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.20')
4
+ VERSION = Gem::Version.new('0.1.22')
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.20
4
+ version: 0.1.22
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-04-23 00:00:00.000000000 Z
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo
@@ -106,4 +106,3 @@ signing_key:
106
106
  specification_version: 4
107
107
  summary: CLI Helper libraries
108
108
  test_files: []
109
- has_rdoc: