kinetic_cafe_error 1.6 → 1.7

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: 37643698d0f31692802e45814d1ef9fa5dd03bb1
4
- data.tar.gz: 91419c4aa9df887087a7629c4b6e4e2a4a140554
3
+ metadata.gz: 9e2c0e4bf3c54e900432944fabebcc48c1d8960b
4
+ data.tar.gz: c54cb33eaf01dd5620e22c85a8b6a1f66c224b97
5
5
  SHA512:
6
- metadata.gz: 5415ff4c3bc5b8b5e75b104bfc1bb453450964ca850a9844b7b0895486826e21dbd6405d64c0e320a7822b9c3412941fb11c2c7d30161b1e10aaa434b706c9a3
7
- data.tar.gz: ea8288a297cf85abc62c1420f83f3f6c6bbc68a193e97fc8812845ed6ceb39b92b6d0b8cc57d4d5269b84a0042c8ff4abfe79b9a4005d1a95e3d2fbec3fd7751
6
+ metadata.gz: 5451adec280190d619f7fc85ae9055aae91b5a0de05676e3395b586c225b71b4ac7e22a3e763c44b78f66449403b92bafd7cac0700038d336e9f5b3f669bbdde
7
+ data.tar.gz: 38169cedbb31a0391c0f425d5c024eb5bd92aab4193bbd18aabe4b961a8a65181aa12b2072846cf2b9ece3a6343d9b001a76bdc1bc5c746a5b7fe06ff42e5f14
data/History.rdoc CHANGED
@@ -1,3 +1,16 @@
1
+ === 1.7 / 2015-08-05
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Add a +params+ parameter to the <tt>kcerror:defined</tt> task that
6
+ will show the parameter names the exception expects.
7
+
8
+ * 1 bug fix:
9
+
10
+ * RubyMine does not fully initialize the project when running RSpec, meaning
11
+ that while Rake is defined, Rake::DSL is not. As such, we need to prevent
12
+ the Rake task from loading unless Rake::DSL is present.
13
+
1
14
  === 1.6 / 2015-07-30
2
15
 
3
16
  * 2 minor enhancements:
data/README.rdoc CHANGED
@@ -38,8 +38,9 @@ automatically injected, which enables the following functionality:
38
38
 
39
39
  * Two rake tasks:
40
40
 
41
- * <tt>rake kcerror:defined</tt>, showing the errors defined in the known
42
- hierarchy.
41
+ * <tt>rake kcerror:defined[params]</tt>, showing the errors defined in the
42
+ known hierarchy. If +params+ is 'yes', the expected parameters will be
43
+ shown.
43
44
 
44
45
  * <tt>rake kcerror:translations[output]</tt>, creating a template translation
45
46
  file for all defined errors.
@@ -109,7 +110,7 @@ KineticCafe::Error provides four experimental matchers:
109
110
 
110
111
  Add kinetic_cafe_error to your Gemfile:
111
112
 
112
- gem 'kinetic_cafe_error', '~> 1.2'
113
+ gem 'kinetic_cafe_error', '~> 1.7'
113
114
 
114
115
  If not using Rails, install with RubyGems:
115
116
 
@@ -25,7 +25,7 @@ module KineticCafe # :nodoc:
25
25
  # rescue clause and handled there, as is shown in the included
26
26
  # KineticCafe::ErrorHandler controller concern for Rails.
27
27
  class Error < ::StandardError
28
- VERSION = '1.6' # :nodoc:
28
+ VERSION = '1.7' # :nodoc:
29
29
 
30
30
  # Get the KineticCafe::Error functionality.
31
31
  include KineticCafe::ErrorModule
@@ -219,4 +219,4 @@ end
219
219
 
220
220
  require_relative 'error_dsl'
221
221
  require_relative 'error_engine' if defined?(::Rails)
222
- require_relative 'error_tasks' if defined?(::Rake)
222
+ require_relative 'error_tasks' if defined?(::Rake::DSL)
@@ -9,21 +9,35 @@ module KineticCafe::ErrorTasks
9
9
 
10
10
  namespace :kcerror do
11
11
  desc 'Show defined errors.'
12
- task defined: 'kcerror:find' do
13
- display = ->(root, prefix = '') {
14
- puts "#{prefix}- #{root}"
12
+ task :defined, [ :params ] => 'kcerror:find' do |_, args|
13
+ show_params = args.params =~ /^y/i
14
+
15
+ display = ->(root, prefix: '', show_params: false) {
16
+ line = "#{prefix}- #{root}"
17
+
18
+ if !root.i18n_params.empty? && show_params
19
+ line << " (" << root.i18n_params.join(', ') << ")"
20
+ end
21
+
22
+ puts line
15
23
 
16
24
  if @descendants[root]
17
25
  sorted = @descendants[root].sort_by(&:to_s)
18
26
  sorted.each do |child|
19
27
  s = (child == sorted.last) ? '`' : '|'
20
- display.(child, "#{prefix.tr('|`', ' ')} #{s}")
28
+ display.(
29
+ child,
30
+ prefix: "#{prefix.tr('|`', ' ')} #{s}",
31
+ show_params: show_params
32
+ )
21
33
  end
22
34
  end
23
35
  }
24
36
 
25
37
  if @descendants[StandardError]
26
- @descendants[StandardError].sort_by(&:to_s).each { |d| display.(d) }
38
+ @descendants[StandardError].sort_by(&:to_s).each { |d|
39
+ display.(d, show_params: show_params)
40
+ }
27
41
  else
28
42
  puts 'No defined errors.'
29
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kinetic_cafe_error
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.6'
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-30 00:00:00.000000000 Z
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest