thor-addons 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: ecbce51975324beec95b2ec8bbd5c4a0d7272beb
4
- data.tar.gz: 65ff6886d60b046be49187208c4f53b2f1608827
3
+ metadata.gz: 57bc529d64b5258fc3371a119e2fb77c09a0a688
4
+ data.tar.gz: b8fc11c322e1b4a133d51345671c16050ac36ab1
5
5
  SHA512:
6
- metadata.gz: cb0497cde13470f94d69ab3b337cfc96aaa0942305992295afcad8ca0a99130668a2f2225b93d92ebe5c6b504bc18299d0d5d4111f7ec1baa056aed7ff633d1f
7
- data.tar.gz: a7a78ecf49cb710dbdb7629e2f18aebd259ea44af3b57ebb48def44e9886facb0b621266648f99d31753f981c8e4130836a650fd890117e12ad98b0fcea431b3
6
+ metadata.gz: a5df9d9d73797fb81bef0688560d6487ca06abc93000acfa38683bfd1f86c7ba619e5f43adbdbf050dca435e893c960518e94b95f2a7d5c9e63c2ba6db03a93e
7
+ data.tar.gz: 38b29725e9138527a2b177a800b353827ae4e43628f3e8b27deaeab43b7da7c2f89b842618c69bbc0acefa1352d9d7c037db18c44603768e25f010b09a4376da
data/CHANGELOG.md CHANGED
@@ -1,8 +1,14 @@
1
+ 0.1.5 (22/09/2017)
2
+
3
+ BUG FIXES:
4
+
5
+ * Fix hash with indifferent access ([#10](https://github.com/eredi93/thor-addons/pull/10))
6
+
1
7
  0.1.4 (21/09/2017)
2
8
 
3
9
  BUG FIXES:
4
10
 
5
- * Options override #2 ([#4](https://github.com/eredi93/thor-addons/pull/8))
11
+ * Options override ([#8](https://github.com/eredi93/thor-addons/pull/8))
6
12
 
7
13
  0.1.3 (08/08/2017)
8
14
 
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jacopo Scrinzi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -20,7 +20,7 @@ module ThorAddons
20
20
  end
21
21
 
22
22
  def options
23
- original = super
23
+ original = hash_with_indifferent_access(super)
24
24
  config_file = original[:config_file]
25
25
 
26
26
  return original unless with_env? || with_config_file?
@@ -95,7 +95,7 @@ module ThorAddons
95
95
 
96
96
  def add_defaults(hash)
97
97
  hash.inject({}) do |memo, (k, v)|
98
- memo[k] = v.nil? ? defaults[k.to_sym] : v
98
+ memo[k] = v.nil? ? defaults[k] : v
99
99
 
100
100
  memo
101
101
  end
@@ -103,7 +103,7 @@ module ThorAddons
103
103
 
104
104
  def remove_defaults(hash)
105
105
  hash.inject({}) do |memo, (k, v)|
106
- if defaults[k.to_sym] == v
106
+ if defaults[k] == v
107
107
  memo[k] = nil
108
108
  else
109
109
  memo[k] = v
@@ -118,7 +118,7 @@ module ThorAddons
118
118
  parse_options.merge!(config[:class_options]) if config[:class_options]
119
119
  parse_options.merge!(config[:command_options]) if config[:command_options]
120
120
 
121
- parse_options.inject({}) do |memo, (key, value)|
121
+ options_hash = parse_options.inject({}) do |memo, (key, value)|
122
122
  begin
123
123
  memo[key] = value.default
124
124
  rescue NoMethodError
@@ -127,10 +127,12 @@ module ThorAddons
127
127
 
128
128
  memo
129
129
  end
130
+
131
+ hash_with_indifferent_access(options_hash)
130
132
  end
131
133
 
132
134
  def hash_with_indifferent_access(hash)
133
- ::Thor::CoreExt::HashWithIndifferentAccess.new(hash)
135
+ ::SymbolizedHash.new(hash)
134
136
  end
135
137
  end
136
138
  end
@@ -1,3 +1,3 @@
1
1
  module ThorAddons
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,7 @@
1
+ require "yaml"
2
+ require "thor"
3
+ require "thor"
4
+ require "symbolized"
5
+
6
+ require "thor-addons/version"
7
+ require "thor-addons/options"
data/thor-addons.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "thor_addons/version"
4
+ require "thor-addons/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "thor-addons"
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "thor", "~> 0.19"
21
+ spec.add_dependency "symbolized", "~> 0.0.1"
21
22
 
22
23
  spec.add_development_dependency "bundler"
23
24
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thor-addons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacopo Scrinzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-21 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: symbolized
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -79,11 +93,12 @@ files:
79
93
  - CONTRIBUTING.md
80
94
  - Dockerfile
81
95
  - Gemfile
96
+ - LICENSE.md
82
97
  - README.md
83
98
  - Rakefile
84
- - lib/thor_addons.rb
85
- - lib/thor_addons/options.rb
86
- - lib/thor_addons/version.rb
99
+ - lib/thor-addons.rb
100
+ - lib/thor-addons/options.rb
101
+ - lib/thor-addons/version.rb
87
102
  - thor-addons.gemspec
88
103
  homepage: https://github.com/eredi93/thor-addons
89
104
  licenses:
data/lib/thor_addons.rb DELETED
@@ -1,5 +0,0 @@
1
- require "yaml"
2
- require "thor"
3
-
4
- require "thor_addons/version"
5
- require "thor_addons/options"