kungfuig 0.5.7 → 0.5.8

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: 710529a449153af8d6165ab4048a8027d0ac2297
4
- data.tar.gz: efe992810bda32c01e2669ba81fab5925dda3a6c
3
+ metadata.gz: 70ebdf0a5662d38602eac378b7ec01ec641f00b3
4
+ data.tar.gz: d4a756c9db21daa1548f3e41e04089d5c622527c
5
5
  SHA512:
6
- metadata.gz: c730db342199e07d7601f77e120f278b3b0888870f86d3d252a7ace86d381f61e4b984e2e5257d6ff195939ff1a9cf32b3e60be2da948a6b51816c7afd1e6c29
7
- data.tar.gz: 95523cd9b5e349c8109b443991b59f2f9a929e29abe0bfb47e28040d9192ae6aa5f6746139df4a38b022cf79923dd69f5461061904f6dd2f49fd7295ae7eca35
6
+ metadata.gz: 9997c1a39cdedef891fa5e02e50b496daa4ee87179294819818bcca442312d55d4cfe42e44f80c8152040f1644d401f0853ef16db7e09893834020581fc49810
7
+ data.tar.gz: 70bbeda0218ca5edaa9a2bbc88ffaba37522fa222dba3b4eed936a4426bd52dc50eeecd7c6fc323a6037306bf02e628f3fb289b9cf4c9daca5bdf6fa33229f0f
@@ -30,7 +30,7 @@ Metrics/CyclomaticComplexity:
30
30
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
31
31
  # URISchemes: http, https
32
32
  Metrics/LineLength:
33
- Max: 153
33
+ Max: 180
34
34
 
35
35
  # Offense count: 2
36
36
  # Configuration parameters: CountComments.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Kungfuig
1
+ # [![夫](kungfuig.png)](https://en.wiktionary.org/wiki/%E5%A4%AB) Kungfuig
2
2
 
3
3
  **Kungfuig** (_pronounced: [ˌkʌŋˈfig]_) provides a drastically easy way to plug configuration into everything.
4
4
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -25,7 +25,6 @@ module Kungfuig
25
25
  # rubocop:enable Style/MethodName
26
26
  # rubocop:enable Style/VariableName
27
27
 
28
- # rubocop:disable Metrics/CyclomaticComplexity
29
28
  # rubocop:disable Metrics/MethodLength
30
29
  def load_stuff hos
31
30
  case hos
@@ -33,13 +32,13 @@ module Kungfuig
33
32
  when Hash then Hashie::Mash.new(hos)
34
33
  when String
35
34
  begin
36
- File.exist?(hos) ? Hashie::Mash.load(hos) : Hashie::Mash.new(YAML.load(hos)).tap do |opts|
37
- fail ArgumentError.new "#{__callee__} expects valid YAML configuration file or YAML string." unless opts.is_a?(Hash)
38
- end
35
+ File.exist?(hos) ? Hashie::Mash.load(hos) : Hashie::Mash.new(YAML.load(hos))
39
36
  rescue ArgumentError
40
- fail ArgumentError.new "#{__callee__} expects valid YAML configuration file. [#{hos}] contains invalid syntax."
37
+ fail ArgumentError, "#{__callee__} expects valid YAML configuration file. “#{hos.inspect} contains invalid syntax."
41
38
  rescue Psych::SyntaxError
42
- fail ArgumentError.new "#{__callee__} expects valid YAML configuration string. Got:\n#{hos}"
39
+ fail ArgumentError, "#{__callee__} expects valid YAML configuration string. Got:\n#{hos.inspect}"
40
+ rescue
41
+ fail ArgumentError, "#{__callee__} expects valid YAML configuration string (misspelled file name?). Got:\n#{hos.inspect}"
43
42
  end
44
43
  when ->(h) { h.respond_to?(:to_hash) } then Hashie::Mash.new(h.to_hash)
45
44
  else
@@ -47,7 +46,6 @@ module Kungfuig
47
46
  end
48
47
  end
49
48
  # rubocop:enable Metrics/MethodLength
50
- # rubocop:enable Metrics/CyclomaticComplexity
51
49
  module_function :load_stuff
52
50
 
53
51
  module InstanceMethods
@@ -24,8 +24,6 @@ module Kungfuig
24
24
  end
25
25
 
26
26
  # rubocop:disable Metrics/AbcSize
27
- # rubocop:disable Metrics/CyclomaticComplexity
28
- # rubocop:disable Metrics/PerceivedComplexity
29
27
  # rubocop:disable Metrics/MethodLength
30
28
  def bottleneck(receiver, method, result, *args)
31
29
  respond_to = ->(m, r) { r.respond_to? m.to_sym }
@@ -39,18 +37,15 @@ module Kungfuig
39
37
  @hash[c.name] && @hash[c.name][method]
40
38
  end)
41
39
 
42
- job = Kernel.const_get(@hash[receiver_class.name][method])
43
- if Kernel.const_defined?('Rails') && Rails.env.development?
44
- job.new.perform(r, method, result, *args)
45
- else
46
- job.perform_async(r, method, result, *args)
47
- end
40
+ Kernel.const_get(@hash[receiver_class.name][method]).perform_async(r, method, result, *args)
48
41
  rescue => e
49
- Kungfuig.✍("Fail [#{e.message}] while #{receiver}", method, result, *args)
42
+ Kungfuig.✍([
43
+ "Fail [#{e.message}]",
44
+ *e.backtrace.unshift("Backtrace:").join("#{$/}⮩ "),
45
+ "while #{receiver}"
46
+ ].join($/), method, result, *args)
50
47
  end
51
48
  # rubocop:enable Metrics/MethodLength
52
- # rubocop:enable Metrics/PerceivedComplexity
53
- # rubocop:enable Metrics/CyclomaticComplexity
54
49
  # rubocop:enable Metrics/AbcSize
55
50
  end
56
51
  end
@@ -1,3 +1,3 @@
1
1
  module Kungfuig
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kungfuig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kantox LTD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -157,7 +157,13 @@ files:
157
157
  - Gemfile
158
158
  - README.md
159
159
  - Rakefile
160
+ - img/kungfuig-100.png
161
+ - img/kungfuig-16.png
162
+ - img/kungfuig-200.png
163
+ - img/kungfuig-400.png
164
+ - img/kungfuig.xcf
160
165
  - kungfuig.gemspec
166
+ - kungfuig.png
161
167
  - lib/kungfuig.rb
162
168
  - lib/kungfuig/aspector.rb
163
169
  - lib/kungfuig/color.rb