amazing_print 1.6.0 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -2
  3. data/lib/amazing_print/ext/active_record.rb +32 -2
  4. data/lib/amazing_print/ext/nobrainer.rb +2 -2
  5. data/lib/amazing_print/formatters/base_formatter.rb +5 -1
  6. data/lib/amazing_print/formatters/hash_formatter.rb +29 -9
  7. data/lib/amazing_print/formatters/mswin_helper.rb +4 -4
  8. data/lib/amazing_print/formatters/object_formatter.rb +1 -1
  9. data/lib/amazing_print/formatters/struct_formatter.rb +1 -1
  10. data/lib/amazing_print/inspector.rb +1 -1
  11. data/lib/amazing_print/version.rb +1 -1
  12. metadata +6 -63
  13. data/.gitignore +0 -35
  14. data/Appraisals +0 -66
  15. data/Gemfile +0 -18
  16. data/Gemfile.lock +0 -94
  17. data/LICENSE +0 -22
  18. data/Rakefile +0 -25
  19. data/spec/active_record_helper.rb +0 -43
  20. data/spec/colors_spec.rb +0 -120
  21. data/spec/core_ext/logger_spec.rb +0 -70
  22. data/spec/ext/action_controller_spec.rb +0 -40
  23. data/spec/ext/action_view_spec.rb +0 -24
  24. data/spec/ext/active_model_spec.rb +0 -37
  25. data/spec/ext/active_record_spec.rb +0 -302
  26. data/spec/ext/active_support_spec.rb +0 -37
  27. data/spec/ext/mongo_mapper_spec.rb +0 -265
  28. data/spec/ext/mongoid_spec.rb +0 -135
  29. data/spec/ext/nobrainer_spec.rb +0 -64
  30. data/spec/ext/nokogiri_spec.rb +0 -52
  31. data/spec/ext/ostruct_spec.rb +0 -24
  32. data/spec/ext/ripple_spec.rb +0 -53
  33. data/spec/ext/sequel_spec.rb +0 -45
  34. data/spec/formats_spec.rb +0 -795
  35. data/spec/methods_spec.rb +0 -520
  36. data/spec/misc_spec.rb +0 -206
  37. data/spec/objects_spec.rb +0 -225
  38. data/spec/sequel_helper.rb +0 -18
  39. data/spec/spec_helper.rb +0 -112
  40. data/spec/support/active_record_data/3_2_diana.txt +0 -24
  41. data/spec/support/active_record_data/3_2_diana_legacy.txt +0 -24
  42. data/spec/support/active_record_data/3_2_multi.txt +0 -50
  43. data/spec/support/active_record_data/3_2_multi_legacy.txt +0 -50
  44. data/spec/support/active_record_data/4_0_diana.txt +0 -98
  45. data/spec/support/active_record_data/4_0_multi.txt +0 -198
  46. data/spec/support/active_record_data/4_1_diana.txt +0 -97
  47. data/spec/support/active_record_data/4_1_multi.txt +0 -196
  48. data/spec/support/active_record_data/4_2_diana.txt +0 -109
  49. data/spec/support/active_record_data/4_2_diana_legacy.txt +0 -109
  50. data/spec/support/active_record_data/4_2_multi.txt +0 -220
  51. data/spec/support/active_record_data/4_2_multi_legacy.txt +0 -220
  52. data/spec/support/active_record_data/5_0_diana.txt +0 -105
  53. data/spec/support/active_record_data/5_0_multi.txt +0 -212
  54. data/spec/support/active_record_data/5_1_diana.txt +0 -104
  55. data/spec/support/active_record_data/5_1_multi.txt +0 -210
  56. data/spec/support/active_record_data/5_2_diana.txt +0 -104
  57. data/spec/support/active_record_data/5_2_multi.txt +0 -210
  58. data/spec/support/active_record_data/6_0_diana.txt +0 -104
  59. data/spec/support/active_record_data/6_0_multi.txt +0 -210
  60. data/spec/support/active_record_data/6_1_diana.txt +0 -109
  61. data/spec/support/active_record_data/6_1_multi.txt +0 -220
  62. data/spec/support/active_record_data/7_0_diana.txt +0 -110
  63. data/spec/support/active_record_data/7_0_multi.txt +0 -222
  64. data/spec/support/active_record_data.rb +0 -22
  65. data/spec/support/ext_verifier.rb +0 -46
  66. data/spec/support/mongoid_versions.rb +0 -24
  67. data/spec/support/rails_versions.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 114d8297770972541aa0e40c8dd8fbc8dccf658089fe2b69d272fac2994b9621
4
- data.tar.gz: 4e26b60b130dfe0b8eb4ebfe1d91f61cb3ca3de60d07ce0166650257bf83bce9
3
+ metadata.gz: 1936b7b4ca5adfa821918412efe3e0dee3ac1bfc82f27c07374169b212fe6014
4
+ data.tar.gz: 40c690d728938fbc4e2e46bde9189007acedecea5b43736ca5d1a5dbc59c5deb
5
5
  SHA512:
6
- metadata.gz: f1890155df4d922d6975a3ddca5c229a2d6f3c1326cc82836bea4816a068dade724f1dfcaadc8697b213474908fc17671aa75dc79d1758cbe378509267440534
7
- data.tar.gz: 270b1f75b7aa990b103325f69468ea985c29a09f5b23450cc0e7b9a600a5f3a3ea6805c813151e1b584801195784fd604e30881dae9fd1e2ab1107c769eadd52
6
+ metadata.gz: 2e406d97f347bab6f9cd2ece415bc15a1edc0d0f655d08c4f09e21802f293b5f94199f81a0fa3b80857307b0988688eb5a940da6ec1cb79e6583334db5d6b704
7
+ data.tar.gz: d6f5ec436363f8ea1c48e5db11ff6ca62b3198d82be5b33dd949e98d0e700c7735c4b624a36f176cd1c5a08a2785047bfcaad0ea12f674d7138a4a32fb699861
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Unreleased
3
+ ## v1.7.2
4
4
 
5
- ## V1.6.0
5
+ - update the version string in `AmazingPrint.version`
6
+
7
+ ## v1.7.1
8
+
9
+ - no changes, only linting
10
+
11
+ ## v1.7.0
12
+
13
+ - Require Ruby >= 3.0
14
+ - Add support for `::ActiveModel::Attributes`
15
+ - Preserve user defined color defaults
16
+ - Micro-optimization to `AmazingPrint::ActiveRecord#cast` (avoid calls to `#ancestors`)
17
+
18
+ ## v1.6.0
6
19
 
7
20
  - Use pager with Pry #96
8
21
  - Add Rails 7 appraisal #98
@@ -20,11 +20,15 @@ module AmazingPrint
20
20
 
21
21
  if object.is_a?(::ActiveRecord::Base)
22
22
  cast = :active_record_instance
23
+ elsif object.is_a?(Class) && object.include?(::ActiveModel::Attributes)
24
+ cast = :active_model_class
25
+ elsif object.is_a?(::ActiveModel::Attributes)
26
+ cast = :active_model_instance
23
27
  elsif object.is_a?(::ActiveModel::Errors)
24
28
  cast = :active_model_error
25
- elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
29
+ elsif object.is_a?(Class) && object <= ::ActiveRecord::Base
26
30
  cast = :active_record_class
27
- elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation)
31
+ elsif type == :activerecord_relation || object.is_a?(::ActiveRecord::Relation)
28
32
  cast = :array
29
33
  end
30
34
  cast
@@ -71,6 +75,32 @@ module AmazingPrint
71
75
  [awesome_simple("class #{object} < #{object.superclass}", :class), awesome_hash(data)].join(' ')
72
76
  end
73
77
 
78
+ # Format ActiveModel instance object.
79
+ #------------------------------------------------------------------------------
80
+ def awesome_active_model_instance(object)
81
+ return object.inspect unless defined?(::ActiveSupport::OrderedHash)
82
+ return awesome_object(object) if @options[:raw]
83
+
84
+ data = object.attributes.each_with_object(::ActiveSupport::OrderedHash.new) do |c, hash|
85
+ hash[c.first.to_sym] = c.last
86
+ end
87
+
88
+ [awesome_simple(object.to_s, :active_model_instance), awesome_hash(data)].join(' ')
89
+ end
90
+
91
+ # Format ActiveModel class object.
92
+ #------------------------------------------------------------------------------
93
+ def awesome_active_model_class(object)
94
+ return object.inspect unless defined?(::ActiveSupport::OrderedHash)
95
+ return awesome_class(object) if @options[:raw]
96
+
97
+ data = object.attribute_types.each_with_object(::ActiveSupport::OrderedHash.new) do |c, hash|
98
+ hash[c.first.to_sym] = c.last.type
99
+ end
100
+
101
+ [awesome_simple("class #{object} < #{object.superclass}", :class), awesome_hash(data)].join(' ')
102
+ end
103
+
74
104
  # Format ActiveModel error object.
75
105
  #------------------------------------------------------------------------------
76
106
  def awesome_active_model_error(object)
@@ -32,9 +32,9 @@ module AmazingPrint
32
32
  #------------------------------------------------------------------------------
33
33
  def awesome_nobrainer_class(object)
34
34
  name = "#{awesome_simple(object, :class)} < #{awesome_simple(object.superclass, :class)}"
35
- data = object.fields.map do |field, options|
35
+ data = object.fields.to_h do |field, options|
36
36
  [field, (options[:type] || Object).to_s.underscore.to_sym]
37
- end.to_h
37
+ end
38
38
 
39
39
  name = "class #{awesome_simple(object.to_s, :class)}"
40
40
  base = "< #{awesome_simple(object.superclass.to_s, :class)}"
@@ -143,8 +143,12 @@ module AmazingPrint
143
143
  end
144
144
  end
145
145
 
146
+ def colorless(string)
147
+ string.gsub(/\e\[[\d;]+m/, '')
148
+ end
149
+
146
150
  def colorless_size(string)
147
- string.gsub(/\e\[[\d;]+m/, '').size
151
+ colorless(string).size
148
152
  end
149
153
  end
150
154
  end
@@ -65,8 +65,18 @@ module AmazingPrint
65
65
  result
66
66
  end
67
67
 
68
+ def key_size(key)
69
+ return key.inspect.size if symbol?(key)
70
+
71
+ if options[:html]
72
+ single_line { inspector.awesome(key) }.size
73
+ else
74
+ plain_single_line { inspector.awesome(key) }.size
75
+ end
76
+ end
77
+
68
78
  def max_key_width(keys)
69
- keys.map { |key, _value| colorless_size(key) }.max || 0
79
+ keys.map { |key, _value| key_size(key) }.max || 0
70
80
  end
71
81
 
72
82
  def printable_keys
@@ -75,27 +85,37 @@ module AmazingPrint
75
85
  keys.sort! { |a, b| a.to_s <=> b.to_s } if options[:sort_keys]
76
86
 
77
87
  keys.map! do |key|
78
- plain_single_line do
79
- [inspector.awesome(key), hash[key]]
88
+ single_line do
89
+ [key, hash[key]]
80
90
  end
81
91
  end
82
92
  end
83
93
 
84
94
  def symbol?(key)
85
- key[0] == ':'
95
+ key.is_a?(Symbol)
86
96
  end
87
97
 
88
98
  def ruby19_syntax(key, value, width)
89
- key[0] = ''
90
- key << ':'
91
- "#{align(key, width)} #{inspector.awesome(value)}"
99
+ # Move the colon to the right side of the symbol
100
+ awesome_key = inspector.awesome(key).sub(/#{key.inspect}/, "#{key}:")
101
+
102
+ "#{align(awesome_key, width)} #{inspector.awesome(value)}"
92
103
  end
93
104
 
94
105
  def pre_ruby19_syntax(key, value, width)
95
- "#{align(key, width)}#{colorize(' => ', :hash)}#{inspector.awesome(value)}"
106
+ awesome_key = single_line { inspector.awesome(key) }
107
+ "#{align(awesome_key, width)}#{colorize(' => ', :hash)}#{inspector.awesome(value)}"
108
+ end
109
+
110
+ def plain_single_line(&block)
111
+ plain = options[:plain]
112
+ options[:plain] = true
113
+ single_line(&block)
114
+ ensure
115
+ options[:plain] = plain
96
116
  end
97
117
 
98
- def plain_single_line
118
+ def single_line
99
119
  multiline = options[:multiline]
100
120
  options[:multiline] = false
101
121
  yield
@@ -27,10 +27,10 @@ module AmazingPrint
27
27
  def mode
28
28
  r = ['-'] * 6
29
29
  r[0] = 'd' if @stat.directory?
30
- r[1] = 'a' unless (@attrs & FILE_ATTRIBUTE_ARCHIVE).zero?
31
- r[2] = 'r' unless (@attrs & FILE_ATTRIBUTE_READONLY).zero?
32
- r[3] = 'h' unless (@attrs & FILE_ATTRIBUTE_HIDDEN).zero?
33
- r[4] = 's' unless (@attrs & FILE_ATTRIBUTE_SYSTEM).zero?
30
+ r[1] = 'a' unless @attrs.nobits?(FILE_ATTRIBUTE_ARCHIVE)
31
+ r[2] = 'r' unless @attrs.nobits?(FILE_ATTRIBUTE_READONLY)
32
+ r[3] = 'h' unless @attrs.nobits?(FILE_ATTRIBUTE_HIDDEN)
33
+ r[4] = 's' unless @attrs.nobits?(FILE_ATTRIBUTE_SYSTEM)
34
34
  r[5] = 'l' if File.symlink? @fname
35
35
  r.join
36
36
  end
@@ -17,7 +17,7 @@ module AmazingPrint
17
17
 
18
18
  def format
19
19
  vars = variables.map do |var|
20
- property = var.to_s[1..-1].to_sym # to_s because of some monkey patching done by Puppet.
20
+ property = var.to_s[1..].to_sym # to_s because of some monkey patching done by Puppet.
21
21
  accessor = if object.respond_to?(:"#{property}=")
22
22
  object.respond_to?(property) ? :accessor : :writer
23
23
  else
@@ -17,7 +17,7 @@ module AmazingPrint
17
17
 
18
18
  def format
19
19
  vars = variables.map do |var|
20
- property = var.to_s[1..-1].to_sym # to_s because of some monkey patching done by Puppet.
20
+ property = var.to_s[1..].to_sym # to_s because of some monkey patching done by Puppet.
21
21
  accessor = if struct.respond_to?(:"#{property}=")
22
22
  struct.respond_to?(property) ? :accessor : :writer
23
23
  else
@@ -192,7 +192,7 @@ module AmazingPrint
192
192
  #---------------------------------------------------------------------------
193
193
  def merge_custom_defaults!
194
194
  load_dotfile
195
- merge_options!(AmazingPrint.defaults) if AmazingPrint.defaults.is_a?(Hash)
195
+ merge_options!(AmazingPrint.defaults.dup) if AmazingPrint.defaults.is_a?(Hash)
196
196
  rescue StandardError => e
197
197
  warn "Could not load '.aprc' from ENV['HOME']: #{e}"
198
198
  end
@@ -7,6 +7,6 @@
7
7
  #------------------------------------------------------------------------------
8
8
  module AmazingPrint
9
9
  def self.version
10
- '1.6.0'
10
+ '1.7.2'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazing_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dvorkin
8
8
  - Kevin McCormackPatrik Wenger
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: 'Great Ruby debugging companion: pretty print Ruby objects to visualize
15
14
  their structure. Supports custom object formatting via plugins'
@@ -18,15 +17,9 @@ executables: []
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - ".gitignore"
22
- - Appraisals
23
20
  - CHANGELOG.md
24
21
  - CONTRIBUTING.md
25
- - Gemfile
26
- - Gemfile.lock
27
- - LICENSE
28
22
  - README.md
29
- - Rakefile
30
23
  - lib/amazing_print.rb
31
24
  - lib/amazing_print/colorize.rb
32
25
  - lib/amazing_print/colors.rb
@@ -64,60 +57,11 @@ files:
64
57
  - lib/amazing_print/inspector.rb
65
58
  - lib/amazing_print/version.rb
66
59
  - lib/ap.rb
67
- - spec/active_record_helper.rb
68
- - spec/colors_spec.rb
69
- - spec/core_ext/logger_spec.rb
70
- - spec/ext/action_controller_spec.rb
71
- - spec/ext/action_view_spec.rb
72
- - spec/ext/active_model_spec.rb
73
- - spec/ext/active_record_spec.rb
74
- - spec/ext/active_support_spec.rb
75
- - spec/ext/mongo_mapper_spec.rb
76
- - spec/ext/mongoid_spec.rb
77
- - spec/ext/nobrainer_spec.rb
78
- - spec/ext/nokogiri_spec.rb
79
- - spec/ext/ostruct_spec.rb
80
- - spec/ext/ripple_spec.rb
81
- - spec/ext/sequel_spec.rb
82
- - spec/formats_spec.rb
83
- - spec/methods_spec.rb
84
- - spec/misc_spec.rb
85
- - spec/objects_spec.rb
86
- - spec/sequel_helper.rb
87
- - spec/spec_helper.rb
88
- - spec/support/active_record_data.rb
89
- - spec/support/active_record_data/3_2_diana.txt
90
- - spec/support/active_record_data/3_2_diana_legacy.txt
91
- - spec/support/active_record_data/3_2_multi.txt
92
- - spec/support/active_record_data/3_2_multi_legacy.txt
93
- - spec/support/active_record_data/4_0_diana.txt
94
- - spec/support/active_record_data/4_0_multi.txt
95
- - spec/support/active_record_data/4_1_diana.txt
96
- - spec/support/active_record_data/4_1_multi.txt
97
- - spec/support/active_record_data/4_2_diana.txt
98
- - spec/support/active_record_data/4_2_diana_legacy.txt
99
- - spec/support/active_record_data/4_2_multi.txt
100
- - spec/support/active_record_data/4_2_multi_legacy.txt
101
- - spec/support/active_record_data/5_0_diana.txt
102
- - spec/support/active_record_data/5_0_multi.txt
103
- - spec/support/active_record_data/5_1_diana.txt
104
- - spec/support/active_record_data/5_1_multi.txt
105
- - spec/support/active_record_data/5_2_diana.txt
106
- - spec/support/active_record_data/5_2_multi.txt
107
- - spec/support/active_record_data/6_0_diana.txt
108
- - spec/support/active_record_data/6_0_multi.txt
109
- - spec/support/active_record_data/6_1_diana.txt
110
- - spec/support/active_record_data/6_1_multi.txt
111
- - spec/support/active_record_data/7_0_diana.txt
112
- - spec/support/active_record_data/7_0_multi.txt
113
- - spec/support/ext_verifier.rb
114
- - spec/support/mongoid_versions.rb
115
- - spec/support/rails_versions.rb
116
60
  homepage: https://github.com/amazing-print/amazing_print
117
61
  licenses:
118
62
  - MIT
119
- metadata: {}
120
- post_install_message:
63
+ metadata:
64
+ changelog_uri: https://github.com/amazing-print/amazing_print/blob/master/CHANGELOG.md
121
65
  rdoc_options: []
122
66
  require_paths:
123
67
  - lib
@@ -125,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
69
  requirements:
126
70
  - - ">="
127
71
  - !ruby/object:Gem::Version
128
- version: 2.5.0
72
+ version: 3.0.0
129
73
  required_rubygems_version: !ruby/object:Gem::Requirement
130
74
  requirements:
131
75
  - - ">="
132
76
  - !ruby/object:Gem::Version
133
77
  version: '0'
134
78
  requirements: []
135
- rubygems_version: 3.5.6
136
- signing_key:
79
+ rubygems_version: 3.6.2
137
80
  specification_version: 4
138
81
  summary: Pretty print Ruby objects with proper indentation and colors
139
82
  test_files: []
data/.gitignore DELETED
@@ -1,35 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## RUBYMINE
17
- .idea
18
-
19
- ## PROJECT::GENERAL
20
- coverage
21
- rdoc
22
- pkg
23
- .ruby-version
24
- gemfiles/*.gemfile.lock
25
- Gemfile.lock
26
- /tmp
27
- /.bundle
28
- /gemfiles/.bundle
29
-
30
- ## PROJECT::RVM
31
- .rvmrc
32
-
33
- # PROJECT::RBENV
34
- .ruby-gemset
35
- *.gem
data/Appraisals DELETED
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if RUBY_VERSION < '3'
4
- appraise 'rails-5.2' do
5
- gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0', platform: :jruby
6
- gem 'rails', '~> 5.2.0'
7
- gem 'sqlite3', platform: :mri
8
- end
9
-
10
- appraise 'rails-6.0' do
11
- gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0', platform: :jruby
12
- gem 'rails', '~> 6.0.0'
13
- gem 'sqlite3', platform: :mri
14
- end
15
-
16
- appraise 'mongoid-4.0' do
17
- # https://github.com/rails/rails/issues/34822#issuecomment-570670516
18
- gem 'bigdecimal', '~> 1.4', platforms: :mri
19
- gem 'mongoid', '~> 4.0.0'
20
- end
21
-
22
- appraise 'mongoid-5.0' do
23
- # https://github.com/rails/rails/issues/34822#issuecomment-570670516
24
- gem 'bigdecimal', '~> 1.4', platforms: :mri
25
- gem 'mongoid', '~> 5.0.0'
26
- end
27
-
28
- appraise 'mongoid-6.0' do
29
- gem 'mongoid', '~> 6.0.0'
30
- end
31
-
32
- appraise 'mongo_mapper' do
33
- gem 'activemodel', '~> 4.2.0'
34
- gem 'activesupport', '~> 4.2.0'
35
- gem 'bigdecimal', '~> 1.4', platforms: :mri
36
- gem 'mongo_mapper', '~> 0.14'
37
- end
38
- end
39
-
40
- if RUBY_VERSION >= '2.7'
41
- appraise 'rails-7.0' do
42
- gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0', platform: :jruby
43
- gem 'rails', '~> 7.0.0'
44
- gem 'sqlite3', platform: :mri
45
- end
46
-
47
- appraise 'mongoid-7.0' do
48
- gem 'mongoid', '~> 7.0.0'
49
- end
50
-
51
- appraise 'mongoid-8.0' do
52
- gem 'mongoid', '~> 8.0.0'
53
- end
54
- end
55
-
56
- appraise 'rails-6.1' do
57
- gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0', platform: :jruby
58
- gem 'rails', '~> 6.1.0'
59
- gem 'sqlite3', platform: :mri
60
- end
61
-
62
- appraise 'sequel-5.0' do
63
- gem 'jdbc-sqlite3', platform: :jruby
64
- gem 'sequel', '~> 5.0'
65
- gem 'sqlite3', platform: :mri
66
- end
data/Gemfile DELETED
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in amazing_print.gemspec
6
- gemspec
7
-
8
- # Development dependencies
9
- # Update this once https://github.com/thoughtbot/appraisal/pull/202 is released
10
- gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git', branch: :main
11
-
12
- gem 'bigdecimal'
13
- gem 'fakefs', '~> 1.2'
14
- gem 'nokogiri', '~> 1.10'
15
- gem 'pry'
16
- gem 'rspec', '~> 3.9'
17
- gem 'rubocop', '~> 1.20'
18
- gem 'rubocop-rspec', '~> 2.4'
data/Gemfile.lock DELETED
@@ -1,94 +0,0 @@
1
- GIT
2
- remote: https://github.com/thoughtbot/appraisal.git
3
- revision: feb78bcc6177038399bff098cb6c2bd4bca4972a
4
- branch: main
5
- specs:
6
- appraisal (2.5.0)
7
- bundler
8
- rake
9
- thor (>= 0.14.0)
10
-
11
- PATH
12
- remote: .
13
- specs:
14
- amazing_print (1.5.0)
15
-
16
- GEM
17
- remote: https://rubygems.org/
18
- specs:
19
- ast (2.4.2)
20
- bigdecimal (3.1.6)
21
- coderay (1.1.3)
22
- diff-lcs (1.5.0)
23
- fakefs (1.9.0)
24
- json (2.7.1)
25
- language_server-protocol (3.17.0.3)
26
- method_source (1.0.0)
27
- nokogiri (1.16.0-x86_64-linux)
28
- racc (~> 1.4)
29
- parallel (1.24.0)
30
- parser (3.3.0.2)
31
- ast (~> 2.4.1)
32
- racc
33
- pry (0.14.2)
34
- coderay (~> 1.1)
35
- method_source (~> 1.0)
36
- racc (1.7.3)
37
- rainbow (3.1.1)
38
- rake (13.1.0)
39
- regexp_parser (2.9.0)
40
- rexml (3.2.6)
41
- rspec (3.12.0)
42
- rspec-core (~> 3.12.0)
43
- rspec-expectations (~> 3.12.0)
44
- rspec-mocks (~> 3.12.0)
45
- rspec-core (3.12.2)
46
- rspec-support (~> 3.12.0)
47
- rspec-expectations (3.12.3)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.12.0)
50
- rspec-mocks (3.12.6)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.12.0)
53
- rspec-support (3.12.1)
54
- rubocop (1.59.0)
55
- json (~> 2.3)
56
- language_server-protocol (>= 3.17.0)
57
- parallel (~> 1.10)
58
- parser (>= 3.2.2.4)
59
- rainbow (>= 2.2.2, < 4.0)
60
- regexp_parser (>= 1.8, < 3.0)
61
- rexml (>= 3.2.5, < 4.0)
62
- rubocop-ast (>= 1.30.0, < 2.0)
63
- ruby-progressbar (~> 1.7)
64
- unicode-display_width (>= 2.4.0, < 3.0)
65
- rubocop-ast (1.30.0)
66
- parser (>= 3.2.1.0)
67
- rubocop-capybara (2.20.0)
68
- rubocop (~> 1.41)
69
- rubocop-factory_bot (2.25.1)
70
- rubocop (~> 1.41)
71
- rubocop-rspec (2.26.1)
72
- rubocop (~> 1.40)
73
- rubocop-capybara (~> 2.17)
74
- rubocop-factory_bot (~> 2.22)
75
- ruby-progressbar (1.13.0)
76
- thor (1.3.0)
77
- unicode-display_width (2.5.0)
78
-
79
- PLATFORMS
80
- x86_64-linux
81
-
82
- DEPENDENCIES
83
- amazing_print!
84
- appraisal!
85
- bigdecimal
86
- fakefs (~> 1.2)
87
- nokogiri (~> 1.10)
88
- pry
89
- rspec (~> 3.9)
90
- rubocop (~> 1.20)
91
- rubocop-rspec (~> 2.4)
92
-
93
- BUNDLED WITH
94
- 2.5.4
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2010-2019 Michael Dvorkin
4
- Copyright (c) 2020 AmazingPrint
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'bundler/setup'
5
-
6
- require 'bundler'
7
- Bundler::GemHelper.install_tasks
8
-
9
- task :default do
10
- if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
11
- Rake::Task['spec'].invoke
12
- else
13
- Rake::Task['appraise'].invoke
14
- end
15
- end
16
-
17
- task :appraise do
18
- exec 'appraisal install && appraisal rake'
19
- end
20
-
21
- desc 'Run all amazing_print gem specs'
22
- task :spec do
23
- # Run plain rspec command without RSpec::Core::RakeTask overrides.
24
- exec 'rspec -c spec'
25
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if ExtVerifier.has_rails?
4
- # Required to use the column support
5
- module Rails
6
- def self.env
7
- {}
8
- end
9
- end
10
-
11
- # Establish connection to in-memory SQLite DB
12
- ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
13
-
14
- # Create the users table
15
- ActiveRecord::Migration.verbose = false
16
- ActiveRecord::Migration.create_table :users do |t|
17
- t.string :name
18
- t.integer :rank
19
- t.boolean :admin
20
- t.datetime :created_at
21
- end
22
-
23
- ActiveRecord::Migration.create_table :emails do |t|
24
- t.references :user
25
- t.string :email_address
26
- end
27
-
28
- # Create models
29
- class User < ActiveRecord::Base; has_many :emails; end
30
-
31
- class SubUser < User; end
32
-
33
- class Email < ActiveRecord::Base; belongs_to :user; end
34
-
35
- class TableFreeModel
36
- include ::ActiveModel::Validations
37
- attr_reader(:name)
38
-
39
- def attributes
40
- { 'name' => name }
41
- end
42
- end
43
- end