thor-addons 1.0.2 → 1.0.3

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: d5a1da1f817c7446be1005a04ca36b5435476d81abfaf964e4cf207a88d503a9
4
- data.tar.gz: 9417c7ebb9447112b44c2b1e738dbe6936893e6ff979e902d121ff0cd67623fd
3
+ metadata.gz: 7bd656f336a408fa69a9cda65493fb7d9c3d8b3bba39d01c28af7c82a565a04d
4
+ data.tar.gz: 67638ae62b9ae368c9d97a3c929dab7600bf4b28e6a9da2d70ef4f53573666c2
5
5
  SHA512:
6
- metadata.gz: 99427fd7c696e271917a9a4cb5572f093a6854ed7ed51d897231fe075f2c6d4497eac5d77c54b9d1e32a5f73e579c6229b2485bf80140b9a138a46cf151f7b83
7
- data.tar.gz: 13a639ea0c4fbb72facf520d8250b6b82bde195ae04e89dd11e736e7ca99938a7d173aadfa22b78a45ba0950831838c2b1eacb894d42ae6164b4657ce759de07
6
+ metadata.gz: 207fdff2a961cdeba426b9906f547adf02d5e7ce9122464c2c4be337721fa003335925b6c6fcfef2aa787346d17c58c6043344d08136ad5a6569ecaf52f8a48d
7
+ data.tar.gz: a6f49a41898b3323cba5fd15d89eff699723eb9166760f1af9235fc79dcfbc206bc8ac2dd04f4ff5e73c7832326954fc0f619a7ca5eb1a7db59a85cd06425fcb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 1.0.3 (22/04/2018)
2
+
3
+ BUG FIXES:
4
+
5
+ * Fix config parsing selecting only the called commands ([#20](https://github.com/eredi93/thor-addons/pull/20))
6
+
1
7
  1.0.2 (17/04/2018)
2
8
 
3
9
  BUG FIXES:
@@ -11,29 +11,23 @@ module ThorAddons
11
11
  end
12
12
 
13
13
  def self.extract_command_data(data, command)
14
- data_hash = data["global"] || {}
15
-
16
- return data_hash if command.nil? || data[command].nil?
17
-
18
- data_hash.merge(data[command])
14
+ [data.fetch("global", {}), data.fetch(command, {})]
19
15
  end
20
16
 
21
17
  def self.get_command_config_data(data, invocations, current_command_name)
22
18
  invocations ||= {}
23
19
  commands = (invocations.values.flatten << current_command_name)
24
20
 
25
- command_options = extract_command_data(data, commands.shift)
21
+ global_options, cmd_options = extract_command_data(data, commands.shift)
26
22
 
27
23
  commands.each do |cmd|
28
- should_break = command_options[cmd].nil?
29
- command_options.merge!(extract_command_data(command_options, cmd))
30
-
31
- %W[#{cmd} global].each { |k| command_options.delete(k) }
24
+ break if cmd_options[cmd].nil?
32
25
 
33
- break if should_break
26
+ global, cmd_options = extract_command_data(cmd_options, cmd)
27
+ global_options.merge!(global)
34
28
  end
35
29
 
36
- command_options
30
+ global_options.merge(cmd_options)
37
31
  end
38
32
 
39
33
  def self.parse(config_file, invocations, current_command_name, defaults)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ThorAddons
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  end
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: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacopo Scrinzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: symbolized