amazing_print 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/Appraisals +60 -0
  4. data/CHANGELOG.md +2 -0
  5. data/CONTRIBUTING.md +81 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +21 -0
  8. data/README.md +356 -0
  9. data/Rakefile +23 -0
  10. data/lib/amazing_print.rb +46 -0
  11. data/lib/amazing_print/colorize.rb +25 -0
  12. data/lib/amazing_print/core_ext/awesome_method_array.rb +82 -0
  13. data/lib/amazing_print/core_ext/class.rb +23 -0
  14. data/lib/amazing_print/core_ext/kernel.rb +25 -0
  15. data/lib/amazing_print/core_ext/logger.rb +21 -0
  16. data/lib/amazing_print/core_ext/method.rb +21 -0
  17. data/lib/amazing_print/core_ext/object.rb +23 -0
  18. data/lib/amazing_print/core_ext/string.rb +42 -0
  19. data/lib/amazing_print/custom_defaults.rb +57 -0
  20. data/lib/amazing_print/ext/action_view.rb +22 -0
  21. data/lib/amazing_print/ext/active_record.rb +103 -0
  22. data/lib/amazing_print/ext/active_support.rb +45 -0
  23. data/lib/amazing_print/ext/mongo_mapper.rb +125 -0
  24. data/lib/amazing_print/ext/mongoid.rb +68 -0
  25. data/lib/amazing_print/ext/nobrainer.rb +53 -0
  26. data/lib/amazing_print/ext/nokogiri.rb +45 -0
  27. data/lib/amazing_print/ext/ostruct.rb +27 -0
  28. data/lib/amazing_print/ext/ripple.rb +71 -0
  29. data/lib/amazing_print/ext/sequel.rb +55 -0
  30. data/lib/amazing_print/formatter.rb +120 -0
  31. data/lib/amazing_print/formatters.rb +14 -0
  32. data/lib/amazing_print/formatters/array_formatter.rb +139 -0
  33. data/lib/amazing_print/formatters/base_formatter.rb +148 -0
  34. data/lib/amazing_print/formatters/class_formatter.rb +24 -0
  35. data/lib/amazing_print/formatters/dir_formatter.rb +21 -0
  36. data/lib/amazing_print/formatters/file_formatter.rb +21 -0
  37. data/lib/amazing_print/formatters/hash_formatter.rb +106 -0
  38. data/lib/amazing_print/formatters/method_formatter.rb +21 -0
  39. data/lib/amazing_print/formatters/object_formatter.rb +82 -0
  40. data/lib/amazing_print/formatters/simple_formatter.rb +20 -0
  41. data/lib/amazing_print/formatters/struct_formatter.rb +74 -0
  42. data/lib/amazing_print/indentator.rb +17 -0
  43. data/lib/amazing_print/inspector.rb +175 -0
  44. data/lib/amazing_print/version.rb +10 -0
  45. data/lib/ap.rb +10 -0
  46. data/spec/active_record_helper.rb +30 -0
  47. data/spec/colors_spec.rb +114 -0
  48. data/spec/core_ext/logger_spec.rb +44 -0
  49. data/spec/core_ext/string_spec.rb +20 -0
  50. data/spec/ext/action_view_spec.rb +17 -0
  51. data/spec/ext/active_record_spec.rb +297 -0
  52. data/spec/ext/active_support_spec.rb +26 -0
  53. data/spec/ext/mongo_mapper_spec.rb +259 -0
  54. data/spec/ext/mongoid_spec.rb +66 -0
  55. data/spec/ext/nobrainer_spec.rb +58 -0
  56. data/spec/ext/nokogiri_spec.rb +50 -0
  57. data/spec/ext/ostruct_spec.rb +22 -0
  58. data/spec/ext/ripple_spec.rb +47 -0
  59. data/spec/formats_spec.rb +779 -0
  60. data/spec/methods_spec.rb +478 -0
  61. data/spec/misc_spec.rb +245 -0
  62. data/spec/objects_spec.rb +219 -0
  63. data/spec/spec_helper.rb +106 -0
  64. data/spec/support/active_record_data.rb +20 -0
  65. data/spec/support/active_record_data/3_2_diana.txt +24 -0
  66. data/spec/support/active_record_data/3_2_diana_legacy.txt +24 -0
  67. data/spec/support/active_record_data/3_2_multi.txt +50 -0
  68. data/spec/support/active_record_data/3_2_multi_legacy.txt +50 -0
  69. data/spec/support/active_record_data/4_0_diana.txt +98 -0
  70. data/spec/support/active_record_data/4_0_multi.txt +198 -0
  71. data/spec/support/active_record_data/4_1_diana.txt +97 -0
  72. data/spec/support/active_record_data/4_1_multi.txt +196 -0
  73. data/spec/support/active_record_data/4_2_diana.txt +109 -0
  74. data/spec/support/active_record_data/4_2_diana_legacy.txt +109 -0
  75. data/spec/support/active_record_data/4_2_multi.txt +220 -0
  76. data/spec/support/active_record_data/4_2_multi_legacy.txt +220 -0
  77. data/spec/support/active_record_data/5_0_diana.txt +105 -0
  78. data/spec/support/active_record_data/5_0_multi.txt +212 -0
  79. data/spec/support/active_record_data/5_1_diana.txt +104 -0
  80. data/spec/support/active_record_data/5_1_multi.txt +210 -0
  81. data/spec/support/active_record_data/5_2_diana.txt +104 -0
  82. data/spec/support/active_record_data/5_2_multi.txt +210 -0
  83. data/spec/support/active_record_data/6_0_diana.txt +104 -0
  84. data/spec/support/active_record_data/6_0_multi.txt +210 -0
  85. data/spec/support/ext_verifier.rb +41 -0
  86. data/spec/support/mongoid_versions.rb +22 -0
  87. data/spec/support/rails_versions.rb +50 -0
  88. metadata +243 -0
@@ -0,0 +1,41 @@
1
+ module ExtVerifier
2
+ def require_dependencies!(dependencies)
3
+ dependencies.each do |dependency|
4
+ begin
5
+ require dependency
6
+ rescue LoadError
7
+ end
8
+ end
9
+ end
10
+ module_function :require_dependencies!
11
+
12
+ def has_rails?
13
+ defined?(Rails)
14
+ end
15
+ module_function :has_rails?
16
+
17
+ def has_mongoid?
18
+ defined?(Mongoid)
19
+ end
20
+ module_function :has_mongoid?
21
+
22
+ def has_mongo_mapper?
23
+ defined?(MongoMapper)
24
+ end
25
+ module_function :has_mongo_mapper?
26
+
27
+ def has_ripple?
28
+ defined?(Ripple)
29
+ end
30
+ module_function :has_ripple?
31
+
32
+ def has_nobrainer?
33
+ defined?(NoBrainer)
34
+ end
35
+ module_function :has_nobrainer?
36
+ end
37
+
38
+ RSpec.configure do |config|
39
+ config.include(ExtVerifier)
40
+ config.extend(ExtVerifier)
41
+ end
@@ -0,0 +1,22 @@
1
+ module MongoidVersions
2
+ def mongoid_version
3
+ Gem::Version.new(Mongoid::VERSION)
4
+ end
5
+
6
+ def mongoid_4_0?
7
+ Gem::Requirement.new('~> 4.0.0').satisfied_by?(mongoid_version)
8
+ end
9
+
10
+ def mongoid_5_0?
11
+ Gem::Requirement.new('~> 5.0.0').satisfied_by?(mongoid_version)
12
+ end
13
+
14
+ def mongoid_6_0?
15
+ Gem::Requirement.new('~> 6.0.0').satisfied_by?(mongoid_version)
16
+ end
17
+ end
18
+
19
+ RSpec.configure do |config|
20
+ config.include(MongoidVersions)
21
+ config.extend(MongoidVersions)
22
+ end
@@ -0,0 +1,50 @@
1
+ module RailsVersions
2
+ def rails_version
3
+ Gem::Version.new(Rails::VERSION::STRING)
4
+ end
5
+
6
+ def rails_6_0?
7
+ Gem::Requirement.new('~> 6.0.0').satisfied_by?(rails_version)
8
+ end
9
+ alias activerecord_6_0? rails_6_0?
10
+
11
+ def rails_5_2?
12
+ Gem::Requirement.new('~> 5.2.0').satisfied_by?(rails_version)
13
+ end
14
+ alias activerecord_5_2? rails_5_2?
15
+
16
+ def rails_5_1?
17
+ Gem::Requirement.new('~> 5.1.0').satisfied_by?(rails_version)
18
+ end
19
+ alias activerecord_5_1? rails_5_1?
20
+
21
+ def rails_5_0?
22
+ Gem::Requirement.new('~> 5.0.0.racecar1').satisfied_by?(rails_version)
23
+ end
24
+ alias activerecord_5_0? rails_5_0?
25
+
26
+ def rails_4_2?
27
+ Gem::Requirement.new('~> 4.2.0').satisfied_by?(rails_version)
28
+ end
29
+ alias activerecord_4_2? rails_4_2?
30
+
31
+ def rails_4_1?
32
+ Gem::Requirement.new('~> 4.1.0').satisfied_by?(rails_version)
33
+ end
34
+ alias activerecord_4_1? rails_4_1?
35
+
36
+ def rails_4_0?
37
+ Gem::Requirement.new('~> 4.0.0').satisfied_by?(rails_version)
38
+ end
39
+ alias activerecord_4_0? rails_4_0?
40
+
41
+ def rails_3_2?
42
+ Gem::Requirement.new('~> 3.2.0').satisfied_by?(rails_version)
43
+ end
44
+ alias activerecord_3_2? rails_3_2?
45
+ end
46
+
47
+ RSpec.configure do |config|
48
+ config.include(RailsVersions)
49
+ config.extend(RailsVersions)
50
+ end
metadata ADDED
@@ -0,0 +1,243 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: amazing_print
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael Dvorkin
8
+ - Kevin McCormack
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2020-04-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: appraisal
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: fakefs
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 0.2.1
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 0.2.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: nokogiri
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.6.5
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.6.5
56
+ - !ruby/object:Gem::Dependency
57
+ name: pry
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 3.0.0
84
+ description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
85
+ their structure. Supports custom object formatting via plugins'
86
+ email: harlemsquirrel@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Appraisals
93
+ - CHANGELOG.md
94
+ - CONTRIBUTING.md
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE
98
+ - README.md
99
+ - Rakefile
100
+ - lib/amazing_print.rb
101
+ - lib/amazing_print/colorize.rb
102
+ - lib/amazing_print/core_ext/awesome_method_array.rb
103
+ - lib/amazing_print/core_ext/class.rb
104
+ - lib/amazing_print/core_ext/kernel.rb
105
+ - lib/amazing_print/core_ext/logger.rb
106
+ - lib/amazing_print/core_ext/method.rb
107
+ - lib/amazing_print/core_ext/object.rb
108
+ - lib/amazing_print/core_ext/string.rb
109
+ - lib/amazing_print/custom_defaults.rb
110
+ - lib/amazing_print/ext/action_view.rb
111
+ - lib/amazing_print/ext/active_record.rb
112
+ - lib/amazing_print/ext/active_support.rb
113
+ - lib/amazing_print/ext/mongo_mapper.rb
114
+ - lib/amazing_print/ext/mongoid.rb
115
+ - lib/amazing_print/ext/nobrainer.rb
116
+ - lib/amazing_print/ext/nokogiri.rb
117
+ - lib/amazing_print/ext/ostruct.rb
118
+ - lib/amazing_print/ext/ripple.rb
119
+ - lib/amazing_print/ext/sequel.rb
120
+ - lib/amazing_print/formatter.rb
121
+ - lib/amazing_print/formatters.rb
122
+ - lib/amazing_print/formatters/array_formatter.rb
123
+ - lib/amazing_print/formatters/base_formatter.rb
124
+ - lib/amazing_print/formatters/class_formatter.rb
125
+ - lib/amazing_print/formatters/dir_formatter.rb
126
+ - lib/amazing_print/formatters/file_formatter.rb
127
+ - lib/amazing_print/formatters/hash_formatter.rb
128
+ - lib/amazing_print/formatters/method_formatter.rb
129
+ - lib/amazing_print/formatters/object_formatter.rb
130
+ - lib/amazing_print/formatters/simple_formatter.rb
131
+ - lib/amazing_print/formatters/struct_formatter.rb
132
+ - lib/amazing_print/indentator.rb
133
+ - lib/amazing_print/inspector.rb
134
+ - lib/amazing_print/version.rb
135
+ - lib/ap.rb
136
+ - spec/active_record_helper.rb
137
+ - spec/colors_spec.rb
138
+ - spec/core_ext/logger_spec.rb
139
+ - spec/core_ext/string_spec.rb
140
+ - spec/ext/action_view_spec.rb
141
+ - spec/ext/active_record_spec.rb
142
+ - spec/ext/active_support_spec.rb
143
+ - spec/ext/mongo_mapper_spec.rb
144
+ - spec/ext/mongoid_spec.rb
145
+ - spec/ext/nobrainer_spec.rb
146
+ - spec/ext/nokogiri_spec.rb
147
+ - spec/ext/ostruct_spec.rb
148
+ - spec/ext/ripple_spec.rb
149
+ - spec/formats_spec.rb
150
+ - spec/methods_spec.rb
151
+ - spec/misc_spec.rb
152
+ - spec/objects_spec.rb
153
+ - spec/spec_helper.rb
154
+ - spec/support/active_record_data.rb
155
+ - spec/support/active_record_data/3_2_diana.txt
156
+ - spec/support/active_record_data/3_2_diana_legacy.txt
157
+ - spec/support/active_record_data/3_2_multi.txt
158
+ - spec/support/active_record_data/3_2_multi_legacy.txt
159
+ - spec/support/active_record_data/4_0_diana.txt
160
+ - spec/support/active_record_data/4_0_multi.txt
161
+ - spec/support/active_record_data/4_1_diana.txt
162
+ - spec/support/active_record_data/4_1_multi.txt
163
+ - spec/support/active_record_data/4_2_diana.txt
164
+ - spec/support/active_record_data/4_2_diana_legacy.txt
165
+ - spec/support/active_record_data/4_2_multi.txt
166
+ - spec/support/active_record_data/4_2_multi_legacy.txt
167
+ - spec/support/active_record_data/5_0_diana.txt
168
+ - spec/support/active_record_data/5_0_multi.txt
169
+ - spec/support/active_record_data/5_1_diana.txt
170
+ - spec/support/active_record_data/5_1_multi.txt
171
+ - spec/support/active_record_data/5_2_diana.txt
172
+ - spec/support/active_record_data/5_2_multi.txt
173
+ - spec/support/active_record_data/6_0_diana.txt
174
+ - spec/support/active_record_data/6_0_multi.txt
175
+ - spec/support/ext_verifier.rb
176
+ - spec/support/mongoid_versions.rb
177
+ - spec/support/rails_versions.rb
178
+ homepage: https://github.com/amazing-print/amazing_print
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubygems_version: 3.1.2
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: Pretty print Ruby objects with proper indentation and colors
201
+ test_files:
202
+ - spec/methods_spec.rb
203
+ - spec/spec_helper.rb
204
+ - spec/colors_spec.rb
205
+ - spec/formats_spec.rb
206
+ - spec/active_record_helper.rb
207
+ - spec/objects_spec.rb
208
+ - spec/ext/active_record_spec.rb
209
+ - spec/ext/action_view_spec.rb
210
+ - spec/ext/ostruct_spec.rb
211
+ - spec/ext/mongoid_spec.rb
212
+ - spec/ext/ripple_spec.rb
213
+ - spec/ext/active_support_spec.rb
214
+ - spec/ext/nokogiri_spec.rb
215
+ - spec/ext/mongo_mapper_spec.rb
216
+ - spec/ext/nobrainer_spec.rb
217
+ - spec/core_ext/string_spec.rb
218
+ - spec/core_ext/logger_spec.rb
219
+ - spec/support/mongoid_versions.rb
220
+ - spec/support/active_record_data/6_0_diana.txt
221
+ - spec/support/active_record_data/4_2_diana.txt
222
+ - spec/support/active_record_data/4_2_multi_legacy.txt
223
+ - spec/support/active_record_data/3_2_diana.txt
224
+ - spec/support/active_record_data/4_0_diana.txt
225
+ - spec/support/active_record_data/4_2_diana_legacy.txt
226
+ - spec/support/active_record_data/5_1_diana.txt
227
+ - spec/support/active_record_data/6_0_multi.txt
228
+ - spec/support/active_record_data/3_2_multi_legacy.txt
229
+ - spec/support/active_record_data/5_0_multi.txt
230
+ - spec/support/active_record_data/5_2_multi.txt
231
+ - spec/support/active_record_data/4_2_multi.txt
232
+ - spec/support/active_record_data/5_1_multi.txt
233
+ - spec/support/active_record_data/4_0_multi.txt
234
+ - spec/support/active_record_data/3_2_diana_legacy.txt
235
+ - spec/support/active_record_data/4_1_multi.txt
236
+ - spec/support/active_record_data/5_2_diana.txt
237
+ - spec/support/active_record_data/4_1_diana.txt
238
+ - spec/support/active_record_data/3_2_multi.txt
239
+ - spec/support/active_record_data/5_0_diana.txt
240
+ - spec/support/rails_versions.rb
241
+ - spec/support/active_record_data.rb
242
+ - spec/support/ext_verifier.rb
243
+ - spec/misc_spec.rb