amazing_print 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +7 -4
- data/CHANGELOG.md +10 -1
- data/README.md +5 -5
- data/lib/amazing_print/ext/active_record.rb +3 -3
- data/lib/amazing_print/ext/mongo_mapper.rb +1 -1
- data/lib/amazing_print/version.rb +1 -1
- data/spec/active_record_helper.rb +8 -0
- data/spec/ext/active_model_spec.rb +37 -0
- data/spec/ext/mongo_mapper_spec.rb +2 -2
- metadata +42 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d1a2c6f2a9c7b910cf3a164259418a8b89e37ac5584ff9a99f5d2ab6079ca70
|
4
|
+
data.tar.gz: 89963f9ddcfc830c4901963a2c0dc314bb0cda65c18dd601cc13b6bee146cf72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15bb7524e156bdc2994fe91542c4d5217d50434f9bed4dcd226a577eb17cb0c514b6077072433ae627c60de9e082b90bb1ac1d8c2de6d1fbbe796fd09ed78639
|
7
|
+
data.tar.gz: 8d598afc6f5b52480df736911725af1112b106ca691e620f0400748b75db1fb31561958749bb9255ffe8ad223fd2442d4ff25570a263a771102debe12c39b81f
|
data/Appraisals
CHANGED
@@ -48,10 +48,13 @@ appraise 'sequel-5.0' do
|
|
48
48
|
gem 'sqlite3', platform: :mri
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
appraise 'mongo_mapper' do
|
52
|
+
gem 'activemodel', '~> 4.2.0'
|
53
|
+
gem 'activesupport', '~> 4.2.0'
|
54
|
+
gem 'bigdecimal', '~> 1.4'
|
55
|
+
gem 'mongo_mapper', '~> 0.14'
|
56
|
+
end
|
57
|
+
|
55
58
|
# appraise 'ripple' do
|
56
59
|
# gem 'tzinfo'
|
57
60
|
# gem 'ripple'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## unreleased
|
2
|
-
-
|
2
|
+
- Correctly print active_model_errors for models that don't have tables
|
3
|
+
|
4
|
+
## v1.2.0
|
5
|
+
|
6
|
+
- Fix frozen string literal issue with ActiveRecord
|
7
|
+
- Add uncolor String method to remove ANSI color codes - #30 by duffyjp
|
8
|
+
- Restore original copyright - #33 by amarshall
|
9
|
+
- Remove method core extension since it is not needed since ruby 1.9 - #37 by grosser
|
10
|
+
- Remove pale and black string color aliases - #38
|
11
|
+
- Fix formatting ActionController::Parameters - #29
|
3
12
|
|
4
13
|
|
5
14
|
## v1.1.0
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ ruby19_syntax: false, # Use Ruby 1.9 hash syntax in output.
|
|
48
48
|
class_name: :class, # Method called to report the instance class name. (e.g. :to_s)
|
49
49
|
object_id: true, # Show object id.
|
50
50
|
color: {
|
51
|
-
args: :
|
51
|
+
args: :whiteish,
|
52
52
|
array: :white,
|
53
53
|
bigdecimal: :blue,
|
54
54
|
class: :yellow,
|
@@ -56,13 +56,13 @@ color: {
|
|
56
56
|
falseclass: :red,
|
57
57
|
integer: :blue,
|
58
58
|
float: :blue,
|
59
|
-
hash: :
|
59
|
+
hash: :whiteish,
|
60
60
|
keyword: :cyan,
|
61
61
|
method: :purpleish,
|
62
62
|
nilclass: :red,
|
63
63
|
rational: :blue,
|
64
64
|
string: :yellowish,
|
65
|
-
struct: :
|
65
|
+
struct: :whiteish,
|
66
66
|
symbol: :cyanish,
|
67
67
|
time: :greenish,
|
68
68
|
trueclass: :green,
|
@@ -74,7 +74,7 @@ Supported color names:
|
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
:gray, :red, :green, :yellow, :blue, :purple, :cyan, :white
|
77
|
-
:
|
77
|
+
:grayish, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :whiteish
|
78
78
|
```
|
79
79
|
|
80
80
|
Use `Object#ai` to return an ASCII encoded string:
|
@@ -328,7 +328,7 @@ For example:
|
|
328
328
|
AmazingPrint.defaults = {
|
329
329
|
:indent => -2,
|
330
330
|
:color => {
|
331
|
-
:hash => :
|
331
|
+
:hash => :whiteish,
|
332
332
|
:class => :white
|
333
333
|
}
|
334
334
|
}
|
@@ -55,7 +55,7 @@ module AmazingPrint
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
[object.to_s, awesome_hash(data)].join(' ')
|
59
59
|
end
|
60
60
|
|
61
61
|
# Format ActiveRecord class object.
|
@@ -85,7 +85,7 @@ module AmazingPrint
|
|
85
85
|
return awesome_object(object) if @options[:raw]
|
86
86
|
|
87
87
|
object_dump = object.marshal_dump.first
|
88
|
-
data = if object_dump.class.column_names != object_dump.attributes.keys
|
88
|
+
data = if object_dump.class.try(:column_names) != object_dump.attributes.keys
|
89
89
|
object_dump.attributes
|
90
90
|
else
|
91
91
|
object_dump.class.column_names.each_with_object(::ActiveSupport::OrderedHash.new) do |name, hash|
|
@@ -97,7 +97,7 @@ module AmazingPrint
|
|
97
97
|
end
|
98
98
|
|
99
99
|
data.merge!({ details: object.details, messages: object.messages })
|
100
|
-
|
100
|
+
[object.to_s, awesome_hash(data)].join(' ')
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
@@ -29,4 +29,12 @@ if ExtVerifier.has_rails?
|
|
29
29
|
class User < ActiveRecord::Base; has_many :emails; end
|
30
30
|
class SubUser < User; end
|
31
31
|
class Email < ActiveRecord::Base; belongs_to :user; end
|
32
|
+
class TableFreeModel
|
33
|
+
include ::ActiveModel::Validations
|
34
|
+
attr_reader(:name)
|
35
|
+
|
36
|
+
def attributes
|
37
|
+
{ 'name' => name }
|
38
|
+
end
|
39
|
+
end
|
32
40
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'active_record_helper'
|
5
|
+
|
6
|
+
RSpec.describe 'ActiveModel::Errors formatting', skip: -> { !ExtVerifier.has_rails? }.call do
|
7
|
+
before do
|
8
|
+
@ap = AmazingPrint::Inspector.new(plain: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should format active_model_errors properly' do
|
12
|
+
model = TableFreeModel.new
|
13
|
+
model.errors.add(:name, "can't be blank")
|
14
|
+
|
15
|
+
out = @ap.awesome(model.errors)
|
16
|
+
|
17
|
+
str = <<~ERRORS.strip
|
18
|
+
#<ActiveModel::Errors:placeholder_id> {
|
19
|
+
"name" => nil,
|
20
|
+
:details => {
|
21
|
+
:name => [
|
22
|
+
[0] {
|
23
|
+
:error => "can't be blank"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
},
|
27
|
+
:messages => {
|
28
|
+
:name => [
|
29
|
+
[0] "can't be blank"
|
30
|
+
]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
ERRORS
|
34
|
+
|
35
|
+
expect(out).to be_similar_to(str)
|
36
|
+
end
|
37
|
+
end
|
@@ -31,8 +31,8 @@ RSpec.describe 'AmazingPrint/MongoMapper', skip: -> { !ExtVerifier.has_mongo_map
|
|
31
31
|
user = MongoUser.new(first_name: 'Al', last_name: 'Capone')
|
32
32
|
|
33
33
|
out = @ap.send(:awesome, user)
|
34
|
-
|
35
|
-
|
34
|
+
.gsub(/#\<Proc:.+?\>/, 'amazing_print_PROC_STUB')
|
35
|
+
.gsub(/BSON::ObjectId\('[\da-f]+?'\)/, "BSON::ObjectId('123456789')")
|
36
36
|
|
37
37
|
str = if MongoMapper::Version >= '0.13'
|
38
38
|
<<~EOS.strip
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazing_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dvorkin
|
8
8
|
- Kevin McCormackPatrik Wenger
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-06-
|
12
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: appraisal
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- spec/core_ext/string_spec.rb
|
153
153
|
- spec/ext/action_controller_spec.rb
|
154
154
|
- spec/ext/action_view_spec.rb
|
155
|
+
- spec/ext/active_model_spec.rb
|
155
156
|
- spec/ext/active_record_spec.rb
|
156
157
|
- spec/ext/active_support_spec.rb
|
157
158
|
- spec/ext/mongo_mapper_spec.rb
|
@@ -195,7 +196,7 @@ homepage: https://github.com/amazing-print/amazing_print
|
|
195
196
|
licenses:
|
196
197
|
- MIT
|
197
198
|
metadata: {}
|
198
|
-
post_install_message:
|
199
|
+
post_install_message:
|
199
200
|
rdoc_options: []
|
200
201
|
require_paths:
|
201
202
|
- lib
|
@@ -211,52 +212,53 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
212
|
version: '0'
|
212
213
|
requirements: []
|
213
214
|
rubygems_version: 3.1.2
|
214
|
-
signing_key:
|
215
|
+
signing_key:
|
215
216
|
specification_version: 4
|
216
217
|
summary: Pretty print Ruby objects with proper indentation and colors
|
217
218
|
test_files:
|
218
|
-
- spec/
|
219
|
+
- spec/methods_spec.rb
|
220
|
+
- spec/spec_helper.rb
|
221
|
+
- spec/colors_spec.rb
|
222
|
+
- spec/formats_spec.rb
|
223
|
+
- spec/active_record_helper.rb
|
224
|
+
- spec/objects_spec.rb
|
225
|
+
- spec/ext/active_record_spec.rb
|
226
|
+
- spec/ext/action_view_spec.rb
|
227
|
+
- spec/ext/ostruct_spec.rb
|
228
|
+
- spec/ext/mongoid_spec.rb
|
229
|
+
- spec/ext/ripple_spec.rb
|
230
|
+
- spec/ext/sequel_spec.rb
|
231
|
+
- spec/ext/active_support_spec.rb
|
232
|
+
- spec/ext/active_model_spec.rb
|
233
|
+
- spec/ext/nokogiri_spec.rb
|
234
|
+
- spec/ext/mongo_mapper_spec.rb
|
235
|
+
- spec/ext/nobrainer_spec.rb
|
236
|
+
- spec/ext/action_controller_spec.rb
|
237
|
+
- spec/core_ext/string_spec.rb
|
238
|
+
- spec/core_ext/logger_spec.rb
|
219
239
|
- spec/support/mongoid_versions.rb
|
220
|
-
- spec/support/
|
221
|
-
- spec/support/active_record_data/
|
240
|
+
- spec/support/active_record_data/6_0_diana.txt
|
241
|
+
- spec/support/active_record_data/4_2_diana.txt
|
222
242
|
- spec/support/active_record_data/4_2_multi_legacy.txt
|
243
|
+
- spec/support/active_record_data/3_2_diana.txt
|
244
|
+
- spec/support/active_record_data/4_0_diana.txt
|
245
|
+
- spec/support/active_record_data/4_2_diana_legacy.txt
|
223
246
|
- spec/support/active_record_data/5_1_diana.txt
|
224
|
-
- spec/support/active_record_data/4_2_diana.txt
|
225
|
-
- spec/support/active_record_data/5_2_diana.txt
|
226
|
-
- spec/support/active_record_data/4_1_diana.txt
|
227
|
-
- spec/support/active_record_data/6_0_diana.txt
|
228
|
-
- spec/support/active_record_data/5_0_diana.txt
|
229
|
-
- spec/support/active_record_data/5_2_multi.txt
|
230
|
-
- spec/support/active_record_data/4_1_multi.txt
|
231
|
-
- spec/support/active_record_data/3_2_diana_legacy.txt
|
232
247
|
- spec/support/active_record_data/6_0_multi.txt
|
233
|
-
- spec/support/active_record_data/5_0_multi.txt
|
234
|
-
- spec/support/active_record_data/3_2_diana.txt
|
235
248
|
- spec/support/active_record_data/3_2_multi_legacy.txt
|
249
|
+
- spec/support/active_record_data/5_0_multi.txt
|
250
|
+
- spec/support/active_record_data/5_2_multi.txt
|
236
251
|
- spec/support/active_record_data/4_2_multi.txt
|
237
252
|
- spec/support/active_record_data/5_1_multi.txt
|
238
|
-
- spec/support/active_record_data/3_2_multi.txt
|
239
|
-
- spec/support/active_record_data/4_0_diana.txt
|
240
253
|
- spec/support/active_record_data/4_0_multi.txt
|
254
|
+
- spec/support/active_record_data/3_2_diana_legacy.txt
|
255
|
+
- spec/support/active_record_data/4_1_multi.txt
|
256
|
+
- spec/support/active_record_data/5_2_diana.txt
|
257
|
+
- spec/support/active_record_data/4_1_diana.txt
|
258
|
+
- spec/support/active_record_data/3_2_multi.txt
|
259
|
+
- spec/support/active_record_data/5_0_diana.txt
|
260
|
+
- spec/support/rails_versions.rb
|
241
261
|
- spec/support/active_record_data.rb
|
242
|
-
- spec/
|
243
|
-
- spec/objects_spec.rb
|
244
|
-
- spec/misc_spec.rb
|
245
|
-
- spec/colors_spec.rb
|
246
|
-
- spec/active_record_helper.rb
|
247
|
-
- spec/core_ext/logger_spec.rb
|
248
|
-
- spec/core_ext/string_spec.rb
|
262
|
+
- spec/support/ext_verifier.rb
|
249
263
|
- spec/sequel_helper.rb
|
250
|
-
- spec/
|
251
|
-
- spec/ext/nobrainer_spec.rb
|
252
|
-
- spec/ext/ostruct_spec.rb
|
253
|
-
- spec/ext/nokogiri_spec.rb
|
254
|
-
- spec/ext/active_support_spec.rb
|
255
|
-
- spec/ext/active_record_spec.rb
|
256
|
-
- spec/ext/action_view_spec.rb
|
257
|
-
- spec/ext/sequel_spec.rb
|
258
|
-
- spec/ext/ripple_spec.rb
|
259
|
-
- spec/ext/mongo_mapper_spec.rb
|
260
|
-
- spec/ext/mongoid_spec.rb
|
261
|
-
- spec/ext/action_controller_spec.rb
|
262
|
-
- spec/spec_helper.rb
|
264
|
+
- spec/misc_spec.rb
|