comma 4.2.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -1
  3. data/.rubocop_todo.yml +3 -364
  4. data/.travis.yml +26 -57
  5. data/Appraisals +31 -1
  6. data/Gemfile +5 -1
  7. data/Gemfile.lock +54 -36
  8. data/README.md +3 -3
  9. data/Rakefile +2 -0
  10. data/comma.gemspec +13 -14
  11. data/gemfiles/active5.0.7.2.gemfile +12 -0
  12. data/gemfiles/active5.0.7.2.gemfile.lock +113 -0
  13. data/gemfiles/active5.1.7.gemfile +12 -0
  14. data/gemfiles/active5.1.7.gemfile.lock +113 -0
  15. data/gemfiles/active5.2.4.3.gemfile +12 -0
  16. data/gemfiles/{active5.2.0.gemfile.lock → active5.2.4.3.gemfile.lock} +48 -41
  17. data/gemfiles/active6.0.3.1.gemfile +12 -0
  18. data/gemfiles/active6.0.3.1.gemfile.lock +113 -0
  19. data/gemfiles/active6.1.0.gemfile +12 -0
  20. data/gemfiles/active6.1.0.gemfile.lock +112 -0
  21. data/gemfiles/{rails5.0.1.gemfile → rails5.0.7.2.gemfile} +5 -2
  22. data/gemfiles/rails5.0.7.2.gemfile.lock +204 -0
  23. data/gemfiles/{rails4.2.8.gemfile → rails5.1.7.gemfile} +5 -2
  24. data/gemfiles/{rails5.2.0.gemfile.lock → rails5.1.7.gemfile.lock} +97 -97
  25. data/gemfiles/rails5.2.4.3.gemfile +14 -0
  26. data/gemfiles/rails5.2.4.3.gemfile.lock +212 -0
  27. data/gemfiles/{rails4.1.16.gemfile → rails6.0.3.1.gemfile} +4 -2
  28. data/gemfiles/rails6.0.3.1.gemfile.lock +227 -0
  29. data/gemfiles/{rails4.0.13.gemfile → rails6.1.0.gemfile} +4 -2
  30. data/gemfiles/rails6.1.0.gemfile.lock +230 -0
  31. data/init.rb +2 -0
  32. data/lib/comma.rb +26 -35
  33. data/lib/comma/array.rb +2 -0
  34. data/lib/comma/data_extractor.rb +5 -5
  35. data/lib/comma/data_mapper_collection.rb +9 -3
  36. data/lib/comma/extractor.rb +3 -5
  37. data/lib/comma/generator.rb +11 -11
  38. data/lib/comma/header_extractor.rb +19 -14
  39. data/lib/comma/mongoid.rb +10 -7
  40. data/lib/comma/object.rb +5 -1
  41. data/lib/comma/relation.rb +16 -10
  42. data/lib/comma/version.rb +3 -1
  43. data/spec/comma/comma_spec.rb +71 -50
  44. data/spec/comma/data_extractor_spec.rb +13 -17
  45. data/spec/comma/header_extractor_spec.rb +7 -13
  46. data/spec/comma/rails/active_record_spec.rb +34 -33
  47. data/spec/comma/rails/data_mapper_collection_spec.rb +4 -3
  48. data/spec/comma/rails/mongoid_spec.rb +8 -7
  49. data/spec/controllers/users_controller_spec.rb +83 -70
  50. data/spec/non_rails_app/ruby_classes.rb +13 -6
  51. data/spec/rails_app/active_record/config.rb +3 -1
  52. data/spec/rails_app/active_record/models.rb +4 -2
  53. data/spec/rails_app/data_mapper/config.rb +2 -0
  54. data/spec/rails_app/mongoid/config.rb +4 -2
  55. data/spec/rails_app/rails_app.rb +12 -11
  56. data/spec/rails_app/tmp/.gitkeep +0 -0
  57. data/spec/spec_helper.rb +21 -4
  58. metadata +31 -48
  59. data/gemfiles/active4.0.13.gemfile +0 -10
  60. data/gemfiles/active4.0.13.gemfile.lock +0 -107
  61. data/gemfiles/active4.1.16.gemfile +0 -10
  62. data/gemfiles/active4.1.16.gemfile.lock +0 -106
  63. data/gemfiles/active4.2.8.gemfile +0 -10
  64. data/gemfiles/active4.2.8.gemfile.lock +0 -105
  65. data/gemfiles/active5.0.1.gemfile +0 -10
  66. data/gemfiles/active5.0.1.gemfile.lock +0 -104
  67. data/gemfiles/active5.1.0.gemfile +0 -10
  68. data/gemfiles/active5.1.0.gemfile.lock +0 -104
  69. data/gemfiles/active5.2.0.gemfile +0 -10
  70. data/gemfiles/rails4.0.13.gemfile.lock +0 -158
  71. data/gemfiles/rails4.1.16.gemfile.lock +0 -162
  72. data/gemfiles/rails4.2.8.gemfile.lock +0 -187
  73. data/gemfiles/rails5.0.1.gemfile.lock +0 -194
  74. data/gemfiles/rails5.1.0.gemfile +0 -11
  75. data/gemfiles/rails5.1.0.gemfile.lock +0 -194
  76. data/gemfiles/rails5.2.0.gemfile +0 -11
@@ -1,17 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Book
2
4
  attr_accessor :name, :description, :isbn
3
5
 
4
6
  def initialize(name, description, isbn)
5
- @name, @description, @isbn = name, description, isbn
7
+ @name = name
8
+ @description = description
9
+ @isbn = isbn
6
10
  end
7
11
 
8
12
  comma do
9
13
  name 'Title'
10
14
  description
11
15
 
12
- isbn :authority => :issuer
13
- isbn :number_10 => 'ISBN-10'
14
- isbn :number_13 => 'ISBN-13'
16
+ isbn authority: :issuer
17
+ isbn number_10: 'ISBN-10'
18
+ isbn number_13: 'ISBN-13'
15
19
  end
16
20
 
17
21
  comma :brief do
@@ -24,8 +28,11 @@ class Isbn
24
28
  attr_accessor :number_10, :number_13
25
29
 
26
30
  def initialize(isbn_10, isbn_13)
27
- @number_10, @number_13 = isbn_10, isbn_13
31
+ @number_10 = isbn_10
32
+ @number_13 = isbn_13
28
33
  end
29
34
 
30
- def authority; 'ISBN'; end
35
+ def authority
36
+ 'ISBN'
37
+ end
31
38
  end
@@ -1,2 +1,4 @@
1
- ActiveRecord::Base.configurations = {'test' => {'adapter' => 'sqlite3', 'database' => ':memory:'}}
1
+ # frozen_string_literal: true
2
+
3
+ ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => ':memory:' } }
2
4
  ActiveRecord::Base.establish_connection(:test)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Post < ActiveRecord::Base
2
4
  has_one :user
3
5
 
@@ -13,7 +15,7 @@ class User < ActiveRecord::Base
13
15
  comma do
14
16
  first_name
15
17
  last_name
16
- full_name "Name"
18
+ full_name 'Name'
17
19
  end
18
20
 
19
21
  comma :shortened do
@@ -27,7 +29,7 @@ class User < ActiveRecord::Base
27
29
  end
28
30
 
29
31
  MIGRATION_CLASS =
30
- if Rails::VERSION::STRING =~ /^5.*/
32
+ if Rails::VERSION::STRING =~ /^[56].*/
31
33
  ActiveRecord::Migration[4.2]
32
34
  else
33
35
  ActiveRecord::Migration
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  DataMapper.setup(:default, 'sqlite::memory:')
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Mongoid.configure do |config|
2
4
  config.sessions = {
3
- :default => {
4
- :hosts => ['localhost:27017'], :database => 'comma_test'
5
+ default: {
6
+ hosts: ['localhost:27017'], database: 'comma_test'
5
7
  }
6
8
  }
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'action_controller/railtie'
2
4
  require 'action_view/railtie'
3
5
 
@@ -6,7 +8,7 @@ require 'rails_app/active_record/config' if defined?(ActiveRecord)
6
8
 
7
9
  app = CommaTestApp = Class.new(Rails::Application)
8
10
  app.config.secret_token = '6f6acf0443f74fd0aa8ff07a7c2fbe0a'
9
- app.config.session_store :cookie_store, :key => '_rails_app_session'
11
+ app.config.session_store :cookie_store, key: '_rails_app_session'
10
12
  app.config.active_support.deprecation = :log
11
13
  app.config.eager_load = false
12
14
  app.config.root = File.dirname(__FILE__)
@@ -14,10 +16,10 @@ Rails.backtrace_cleaner.remove_silencers!
14
16
  app.initialize!
15
17
 
16
18
  app.routes.draw do
17
- resources :users, :only => [:index]
18
- get 'with_custom_options', :to => 'users#with_custom_options'
19
- get 'with_custom_style', :to => 'users#with_custom_style'
20
- root :to => 'users#index'
19
+ resources :users, only: [:index]
20
+ get 'with_custom_options', to: 'users#with_custom_options'
21
+ get 'with_custom_style', to: 'users#with_custom_style'
22
+ root to: 'users#index'
21
23
  end
22
24
 
23
25
  # models
@@ -48,17 +50,17 @@ class UsersController < ApplicationController
48
50
  respond_to do |format|
49
51
  format.html do
50
52
  if is_rails_4?
51
- render :text => 'Users!'
53
+ render text: 'Users!'
52
54
  else
53
- render :plain => 'Users!'
55
+ render plain: 'Users!'
54
56
  end
55
57
  end
56
- format.csv { render :csv => User.all }
58
+ format.csv { render csv: User.all }
57
59
  end
58
60
  end
59
61
 
60
62
  def with_custom_options
61
- render_options = {:csv => User.all}.update(symbolize_param_keys(params[:custom_options]))
63
+ render_options = { csv: User.all }.update(symbolize_param_keys(params[:custom_options]))
62
64
 
63
65
  respond_to do |format|
64
66
  format.csv { render render_options }
@@ -67,10 +69,9 @@ class UsersController < ApplicationController
67
69
 
68
70
  def with_custom_style
69
71
  respond_to do |format|
70
- format.csv { render :csv => User.all, :style => :shortened }
72
+ format.csv { render csv: User.all, style: :shortened }
71
73
  end
72
74
  end
73
-
74
75
  end
75
76
 
76
77
  # helpers
File without changes
@@ -1,8 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
- $LOAD_PATH.unshift(File.expand_path(File.join(*%w{.. .. lib}), __FILE__))
4
+ $LOAD_PATH.unshift(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
3
5
 
6
+ require 'simplecov'
4
7
  require 'coveralls'
5
- Coveralls.wear!
8
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
9
+ if defined? Rails
10
+ SimpleCov.start('rails') do
11
+ add_filter %r{^/spec/comma/rails/data_mapper_collection_spec\.rb$}
12
+ add_filter %r{^/spec/comma/rails/mongoid_spec\.rb$}
13
+ end
14
+ else
15
+ SimpleCov.start do
16
+ add_filter %r{^/spec/comma/rails/data_mapper_collection_spec\.rb}
17
+ add_filter %r{^/spec/comma/rails/mongoid_spec\.rb}
18
+ add_filter %r{^/spec/controllers/}
19
+ end
20
+ end
6
21
 
7
22
  require 'bundler/setup'
8
23
  Bundler.require
@@ -13,13 +28,15 @@ require 'rspec/its'
13
28
  begin
14
29
  require 'rails'
15
30
  rescue LoadError
31
+ warn 'rails not loaded'
16
32
  end
17
33
 
18
- %w{data_mapper mongoid active_record}.each do |orm|
34
+ %w[data_mapper mongoid active_record].each do |orm|
19
35
  begin
20
36
  require orm
21
37
  break
22
38
  rescue LoadError
39
+ warn "#{orm} not loaded"
23
40
  end
24
41
  end
25
42
 
@@ -34,4 +51,4 @@ end
34
51
 
35
52
  Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |file| require file }
36
53
 
37
- require File.expand_path('../spec/non_rails_app/ruby_classes' , __dir__)
54
+ require File.expand_path('../spec/non_rails_app/ruby_classes', __dir__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comma
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Crafter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-11 00:00:00.000000000 Z
12
+ date: 2020-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,20 +17,20 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.0.0
20
+ version: 4.2.0
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6'
23
+ version: '6.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 4.0.0
30
+ version: 4.2.0
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6'
33
+ version: '6.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: appraisal
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 10.5.0
54
+ version: 13.0.1
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 10.5.0
61
+ version: 13.0.1
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rspec
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -101,20 +101,6 @@ dependencies:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
- - !ruby/object:Gem::Dependency
105
- name: sqlite3
106
- requirement: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 1.3.11
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 1.3.11
118
104
  description: Ruby Comma Seperated Values generation library
119
105
  email:
120
106
  - crafterm@redartisan.com
@@ -136,30 +122,26 @@ files:
136
122
  - README.md
137
123
  - Rakefile
138
124
  - comma.gemspec
139
- - gemfiles/active4.0.13.gemfile
140
- - gemfiles/active4.0.13.gemfile.lock
141
- - gemfiles/active4.1.16.gemfile
142
- - gemfiles/active4.1.16.gemfile.lock
143
- - gemfiles/active4.2.8.gemfile
144
- - gemfiles/active4.2.8.gemfile.lock
145
- - gemfiles/active5.0.1.gemfile
146
- - gemfiles/active5.0.1.gemfile.lock
147
- - gemfiles/active5.1.0.gemfile
148
- - gemfiles/active5.1.0.gemfile.lock
149
- - gemfiles/active5.2.0.gemfile
150
- - gemfiles/active5.2.0.gemfile.lock
151
- - gemfiles/rails4.0.13.gemfile
152
- - gemfiles/rails4.0.13.gemfile.lock
153
- - gemfiles/rails4.1.16.gemfile
154
- - gemfiles/rails4.1.16.gemfile.lock
155
- - gemfiles/rails4.2.8.gemfile
156
- - gemfiles/rails4.2.8.gemfile.lock
157
- - gemfiles/rails5.0.1.gemfile
158
- - gemfiles/rails5.0.1.gemfile.lock
159
- - gemfiles/rails5.1.0.gemfile
160
- - gemfiles/rails5.1.0.gemfile.lock
161
- - gemfiles/rails5.2.0.gemfile
162
- - gemfiles/rails5.2.0.gemfile.lock
125
+ - gemfiles/active5.0.7.2.gemfile
126
+ - gemfiles/active5.0.7.2.gemfile.lock
127
+ - gemfiles/active5.1.7.gemfile
128
+ - gemfiles/active5.1.7.gemfile.lock
129
+ - gemfiles/active5.2.4.3.gemfile
130
+ - gemfiles/active5.2.4.3.gemfile.lock
131
+ - gemfiles/active6.0.3.1.gemfile
132
+ - gemfiles/active6.0.3.1.gemfile.lock
133
+ - gemfiles/active6.1.0.gemfile
134
+ - gemfiles/active6.1.0.gemfile.lock
135
+ - gemfiles/rails5.0.7.2.gemfile
136
+ - gemfiles/rails5.0.7.2.gemfile.lock
137
+ - gemfiles/rails5.1.7.gemfile
138
+ - gemfiles/rails5.1.7.gemfile.lock
139
+ - gemfiles/rails5.2.4.3.gemfile
140
+ - gemfiles/rails5.2.4.3.gemfile.lock
141
+ - gemfiles/rails6.0.3.1.gemfile
142
+ - gemfiles/rails6.0.3.1.gemfile.lock
143
+ - gemfiles/rails6.1.0.gemfile
144
+ - gemfiles/rails6.1.0.gemfile.lock
163
145
  - init.rb
164
146
  - lib/comma.rb
165
147
  - lib/comma/array.rb
@@ -185,6 +167,7 @@ files:
185
167
  - spec/rails_app/data_mapper/config.rb
186
168
  - spec/rails_app/mongoid/config.rb
187
169
  - spec/rails_app/rails_app.rb
170
+ - spec/rails_app/tmp/.gitkeep
188
171
  - spec/spec_helper.rb
189
172
  homepage: http://github.com/comma-csv/comma
190
173
  licenses:
@@ -205,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
188
  - !ruby/object:Gem::Version
206
189
  version: '0'
207
190
  requirements: []
208
- rubyforge_project: comma
209
- rubygems_version: 2.7.6
191
+ rubygems_version: 3.1.4
210
192
  signing_key:
211
193
  specification_version: 4
212
194
  summary: Ruby Comma Seperated Values generation library
@@ -224,4 +206,5 @@ test_files:
224
206
  - spec/rails_app/data_mapper/config.rb
225
207
  - spec/rails_app/mongoid/config.rb
226
208
  - spec/rails_app/rails_app.rb
209
+ - spec/rails_app/tmp/.gitkeep
227
210
  - spec/spec_helper.rb
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "coveralls", :require => false
6
- gem "rubocop", :require => false
7
- gem "activesupport", "4.0.13"
8
- gem "activerecord", "4.0.13"
9
-
10
- gemspec :path => "../"
@@ -1,107 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- comma (4.0.1)
5
- activesupport (>= 4.0.0, < 5.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (4.0.13)
11
- activesupport (= 4.0.13)
12
- builder (~> 3.1.0)
13
- activerecord (4.0.13)
14
- activemodel (= 4.0.13)
15
- activerecord-deprecated_finders (~> 1.0.2)
16
- activesupport (= 4.0.13)
17
- arel (~> 4.0.0)
18
- activerecord-deprecated_finders (1.0.4)
19
- activesupport (4.0.13)
20
- i18n (~> 0.6, >= 0.6.9)
21
- minitest (~> 4.2)
22
- multi_json (~> 1.3)
23
- thread_safe (~> 0.1)
24
- tzinfo (~> 0.3.37)
25
- appraisal (1.0.3)
26
- bundler
27
- rake
28
- thor (>= 0.14.0)
29
- arel (4.0.2)
30
- ast (2.3.0)
31
- builder (3.1.4)
32
- coveralls (0.8.14)
33
- json (>= 1.8, < 3)
34
- simplecov (~> 0.12.0)
35
- term-ansicolor (~> 1.3)
36
- thor (~> 0.19.1)
37
- tins (~> 1.6.0)
38
- diff-lcs (1.2.5)
39
- docile (1.1.5)
40
- i18n (0.7.0)
41
- json (2.0.1)
42
- minitest (4.7.5)
43
- multi_json (1.12.1)
44
- parser (2.3.1.4)
45
- ast (~> 2.2)
46
- powerpack (0.1.1)
47
- rainbow (2.1.0)
48
- rake (10.5.0)
49
- rspec (3.5.0)
50
- rspec-core (~> 3.5.0)
51
- rspec-expectations (~> 3.5.0)
52
- rspec-mocks (~> 3.5.0)
53
- rspec-activemodel-mocks (1.0.3)
54
- activemodel (>= 3.0)
55
- activesupport (>= 3.0)
56
- rspec-mocks (>= 2.99, < 4.0)
57
- rspec-core (3.5.2)
58
- rspec-support (~> 3.5.0)
59
- rspec-expectations (3.5.0)
60
- diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.5.0)
62
- rspec-its (1.2.0)
63
- rspec-core (>= 3.0.0)
64
- rspec-expectations (>= 3.0.0)
65
- rspec-mocks (3.5.0)
66
- diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.5.0)
68
- rspec-support (3.5.0)
69
- rubocop (0.43.0)
70
- parser (>= 2.3.1.1, < 3.0)
71
- powerpack (~> 0.1)
72
- rainbow (>= 1.99.1, < 3.0)
73
- ruby-progressbar (~> 1.7)
74
- unicode-display_width (~> 1.0, >= 1.0.1)
75
- ruby-progressbar (1.8.1)
76
- simplecov (0.12.0)
77
- docile (~> 1.1.0)
78
- json (>= 1.8, < 3)
79
- simplecov-html (~> 0.10.0)
80
- simplecov-html (0.10.0)
81
- sqlite3 (1.3.11)
82
- term-ansicolor (1.3.2)
83
- tins (~> 1.0)
84
- thor (0.19.1)
85
- thread_safe (0.3.5)
86
- tins (1.6.0)
87
- tzinfo (0.3.51)
88
- unicode-display_width (1.1.1)
89
-
90
- PLATFORMS
91
- ruby
92
-
93
- DEPENDENCIES
94
- activerecord (= 4.0.13)
95
- activesupport (= 4.0.13)
96
- appraisal (~> 1.0.0)
97
- comma!
98
- coveralls
99
- rake (~> 10.5.0)
100
- rspec (~> 3.5.0)
101
- rspec-activemodel-mocks
102
- rspec-its
103
- rubocop
104
- sqlite3 (~> 1.3.11)
105
-
106
- BUNDLED WITH
107
- 1.13.2