comma 2.1.3 → 3.0.0

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.
Files changed (43) hide show
  1. data/{.rvmrc.example → .rvmrc} +1 -1
  2. data/Appraisals +2 -2
  3. data/Gemfile.lock +13 -15
  4. data/README.markdown +10 -10
  5. data/comma.gemspec +3 -5
  6. data/gemfiles/active3.0.9.gemfile +8 -0
  7. data/gemfiles/active3.0.9.gemfile.lock +48 -0
  8. data/gemfiles/active3.1.1.gemfile +8 -0
  9. data/gemfiles/active3.1.1.gemfile.lock +50 -0
  10. data/gemfiles/active3.2.1.gemfile +8 -0
  11. data/gemfiles/active3.2.1.gemfile.lock +50 -0
  12. data/gemfiles/{rails2.3.7.gemfile → rails3.0.9.gemfile} +1 -1
  13. data/gemfiles/rails3.0.9.gemfile.lock +99 -0
  14. data/gemfiles/{rails2.3.2.gemfile → rails3.1.1.gemfile} +1 -1
  15. data/gemfiles/rails3.1.1.gemfile.lock +110 -0
  16. data/gemfiles/{rails2.3.15.gemfile → rails3.2.1.gemfile} +1 -1
  17. data/gemfiles/rails3.2.1.gemfile.lock +108 -0
  18. data/lib/comma.rb +12 -29
  19. data/lib/comma/object.rb +1 -1
  20. data/lib/comma/{named_scope.rb → relation.rb} +2 -2
  21. data/lib/comma/version.rb +1 -1
  22. data/spec/comma/ar_spec.rb +1 -8
  23. metadata +32 -79
  24. data/.travis.yml +0 -9
  25. data/gemfiles/active2.3.14.gemfile +0 -8
  26. data/gemfiles/active2.3.14.gemfile.lock +0 -39
  27. data/gemfiles/active2.3.15.gemfile +0 -8
  28. data/gemfiles/active2.3.15.gemfile.lock +0 -39
  29. data/gemfiles/active2.3.2.gemfile +0 -8
  30. data/gemfiles/active2.3.2.gemfile.lock +0 -39
  31. data/gemfiles/active2.3.5.gemfile +0 -8
  32. data/gemfiles/active2.3.5.gemfile.lock +0 -39
  33. data/gemfiles/active2.3.7.gemfile +0 -8
  34. data/gemfiles/active2.3.7.gemfile.lock +0 -39
  35. data/gemfiles/rails2.3.14.gemfile +0 -7
  36. data/gemfiles/rails2.3.14.gemfile.lock +0 -53
  37. data/gemfiles/rails2.3.15.gemfile.lock +0 -53
  38. data/gemfiles/rails2.3.2.gemfile.lock +0 -51
  39. data/gemfiles/rails2.3.5.gemfile +0 -7
  40. data/gemfiles/rails2.3.5.gemfile.lock +0 -53
  41. data/gemfiles/rails2.3.7.gemfile.lock +0 -53
  42. data/lib/comma/association_proxy.rb +0 -6
  43. data/lib/comma/render_as_csv.rb +0 -49
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "2.3.15"
5
+ gem "rails", "~>3.2.1"
6
6
 
7
7
  gemspec :path=>"../"
@@ -0,0 +1,108 @@
1
+ PATH
2
+ remote: /Users/tom/Development/Projects/comma
3
+ specs:
4
+ comma (3.0.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.2.1)
10
+ actionpack (= 3.2.1)
11
+ mail (~> 2.4.0)
12
+ actionpack (3.2.1)
13
+ activemodel (= 3.2.1)
14
+ activesupport (= 3.2.1)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.1)
18
+ rack (~> 1.4.0)
19
+ rack-cache (~> 1.1)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.1.2)
22
+ activemodel (3.2.1)
23
+ activesupport (= 3.2.1)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.1)
26
+ activemodel (= 3.2.1)
27
+ activesupport (= 3.2.1)
28
+ arel (~> 3.0.0)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.1)
31
+ activemodel (= 3.2.1)
32
+ activesupport (= 3.2.1)
33
+ activesupport (3.2.1)
34
+ i18n (~> 0.6)
35
+ multi_json (~> 1.0)
36
+ appraisal (0.4.1)
37
+ bundler
38
+ rake
39
+ arel (3.0.0)
40
+ builder (3.0.0)
41
+ diff-lcs (1.1.3)
42
+ erubis (2.7.0)
43
+ hike (1.2.1)
44
+ i18n (0.6.0)
45
+ journey (1.0.1)
46
+ json (1.6.5)
47
+ mail (2.4.1)
48
+ i18n (>= 0.4.0)
49
+ mime-types (~> 1.16)
50
+ treetop (~> 1.4.8)
51
+ mime-types (1.17.2)
52
+ multi_json (1.1.0)
53
+ polyglot (0.3.3)
54
+ rack (1.4.1)
55
+ rack-cache (1.1)
56
+ rack (>= 0.4)
57
+ rack-ssl (1.3.2)
58
+ rack
59
+ rack-test (0.6.1)
60
+ rack (>= 1.0)
61
+ rails (3.2.1)
62
+ actionmailer (= 3.2.1)
63
+ actionpack (= 3.2.1)
64
+ activerecord (= 3.2.1)
65
+ activeresource (= 3.2.1)
66
+ activesupport (= 3.2.1)
67
+ bundler (~> 1.0)
68
+ railties (= 3.2.1)
69
+ railties (3.2.1)
70
+ actionpack (= 3.2.1)
71
+ activesupport (= 3.2.1)
72
+ rack-ssl (~> 1.3.2)
73
+ rake (>= 0.8.7)
74
+ rdoc (~> 3.4)
75
+ thor (~> 0.14.6)
76
+ rake (0.9.2)
77
+ rdoc (3.12)
78
+ json (~> 1.4)
79
+ rspec (2.8.0)
80
+ rspec-core (~> 2.8.0)
81
+ rspec-expectations (~> 2.8.0)
82
+ rspec-mocks (~> 2.8.0)
83
+ rspec-core (2.8.0)
84
+ rspec-expectations (2.8.0)
85
+ diff-lcs (~> 1.1.2)
86
+ rspec-mocks (2.8.0)
87
+ sprockets (2.1.2)
88
+ hike (~> 1.2)
89
+ rack (~> 1.0)
90
+ tilt (~> 1.1, != 1.3.0)
91
+ sqlite3 (1.3.5)
92
+ thor (0.14.6)
93
+ tilt (1.3.3)
94
+ treetop (1.4.10)
95
+ polyglot
96
+ polyglot (>= 0.3.1)
97
+ tzinfo (0.3.31)
98
+
99
+ PLATFORMS
100
+ ruby
101
+
102
+ DEPENDENCIES
103
+ appraisal (~> 0.4.1)
104
+ comma!
105
+ rails (~> 3.2.1)
106
+ rake (= 0.9.2)
107
+ rspec (~> 2.8.0)
108
+ sqlite3 (~> 1.3.4)
data/lib/comma.rb CHANGED
@@ -3,42 +3,25 @@ if RUBY_VERSION >= '1.9'
3
3
  require 'csv'
4
4
  CSV_HANDLER = CSV
5
5
  else
6
- begin
7
- # try faster csv
8
- require 'fastercsv'
9
- CSV_HANDLER = FasterCSV
10
- rescue Exception => e
11
- fail_message = "FasterCSV not installed, please `gem install fastercsv` for faster processing"
12
- if defined? Rails
13
- Rails.logger.info fail_message
14
- else
15
- puts fail_message
16
- end
17
- require 'csv'
18
- CSV_HANDLER = CSV
19
- end
6
+ raise "Error - This Comma version only supports Ruby 1.9. Please use an older version."
20
7
  end
21
8
 
22
- #Enable class_attribute_accessor
23
- require 'active_support/core_ext/class/inheritable_attributes'
24
-
25
- # begin
26
- # require 'action_controller'
27
- # rescue Exception => e
28
- # #Force load rails for specs until controller specs completed
29
- # end
30
-
31
- if defined?(ActiveRecord)
32
- require 'comma/association_proxy'
33
- require 'comma/named_scope'
9
+ if defined? Rails and (Rails.version.split('.').map(&:to_i).first < 3)
10
+ raise "Error - This Comma version only supports Rails 3.x. Please use a 2.x version of Comma for use with earlier rails versions."
34
11
  end
35
12
 
13
+ require 'active_support/core_ext/class/attribute'
14
+ require 'comma/relation' if defined?(ActiveRecord::Relation)
15
+
36
16
  require 'comma/extractors'
37
17
  require 'comma/generator'
38
18
  require 'comma/array'
39
19
  require 'comma/object'
40
- require 'comma/render_as_csv'
41
20
 
42
- if defined?(RenderAsCSV) && defined?(ActionController)
43
- ActionController::Base.send :include, RenderAsCSV
21
+ #Load into Rails controllers
22
+ if defined?(ActionController::Renderers) && ActionController::Renderers.respond_to?(:add)
23
+ ActionController::Renderers.add :csv do |obj, options|
24
+ filename = options[:filename] || 'data'
25
+ send_data obj.to_comma, :type => Mime::CSV, :disposition => "attachment; filename=#{filename}.csv"
26
+ end
44
27
  end
data/lib/comma/object.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Object
2
- class_inheritable_accessor :comma_formats
2
+ class_attribute :comma_formats
3
3
 
4
4
  def self.comma(style = :default, &block)
5
5
  (self.comma_formats ||= {})[style] = block
@@ -1,5 +1,5 @@
1
- class ActiveRecord::NamedScope::Scope
1
+ class ActiveRecord::Relation
2
2
  def to_comma(style = :default)
3
3
  Comma::Generator.new(self, style).run(:find_each)
4
4
  end
5
- end
5
+ end
data/lib/comma/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Comma
2
- VERSION = "2.1.3"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -3,14 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe Comma, 'generating CSV from an ActiveRecord object' do
4
4
 
5
5
  class Person < ActiveRecord::Base
6
- #TODO : Rails 2.3.x Deprecation
7
- if defined?(ActiveRecord::Relation)
8
- #Rails 3.x
9
- scope :teenagers, lambda { {:conditions => { :age => 13..19 }} }
10
- else
11
- #Rails 2.x
12
- named_scope :teenagers, :conditions => { :age => 13..19 }
13
- end
6
+ scope :teenagers, lambda { {:conditions => { :age => 13..19 }} }
14
7
 
15
8
  comma do
16
9
  name
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: 2.1.3
4
+ version: 3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,43 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-14 00:00:00.000000000 Z
13
+ date: 2012-02-19 00:00:00.000000000Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: fastercsv
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 1.5.4
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: 1.5.4
31
15
  - !ruby/object:Gem::Dependency
32
16
  name: rake
33
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &70126322915060 !ruby/object:Gem::Requirement
34
18
  none: false
35
19
  requirements:
36
- - - '='
20
+ - - =
37
21
  - !ruby/object:Gem::Version
38
- version: 0.8.7
22
+ version: 0.9.2
39
23
  type: :development
40
24
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - '='
45
- - !ruby/object:Gem::Version
46
- version: 0.8.7
25
+ version_requirements: *70126322915060
47
26
  - !ruby/object:Gem::Dependency
48
27
  name: sqlite3
49
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &70126322913740 !ruby/object:Gem::Requirement
50
29
  none: false
51
30
  requirements:
52
31
  - - ~>
@@ -54,44 +33,29 @@ dependencies:
54
33
  version: 1.3.4
55
34
  type: :development
56
35
  prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 1.3.4
36
+ version_requirements: *70126322913740
63
37
  - !ruby/object:Gem::Dependency
64
38
  name: rspec
65
- requirement: !ruby/object:Gem::Requirement
39
+ requirement: &70126322912840 !ruby/object:Gem::Requirement
66
40
  none: false
67
41
  requirements:
68
42
  - - ~>
69
43
  - !ruby/object:Gem::Version
70
- version: 2.7.0
44
+ version: 2.8.0
71
45
  type: :development
72
46
  prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: 2.7.0
47
+ version_requirements: *70126322912840
79
48
  - !ruby/object:Gem::Dependency
80
49
  name: appraisal
81
- requirement: !ruby/object:Gem::Requirement
50
+ requirement: &70126322911980 !ruby/object:Gem::Requirement
82
51
  none: false
83
52
  requirements:
84
- - - ! '>='
53
+ - - ~>
85
54
  - !ruby/object:Gem::Version
86
- version: 0.4.0
55
+ version: 0.4.1
87
56
  type: :development
88
57
  prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: 0.4.0
58
+ version_requirements: *70126322911980
95
59
  description: Ruby Comma Seperated Values generation library
96
60
  email:
97
61
  - crafterm@redartisan.com
@@ -101,8 +65,7 @@ extensions: []
101
65
  extra_rdoc_files: []
102
66
  files:
103
67
  - .gitignore
104
- - .rvmrc.example
105
- - .travis.yml
68
+ - .rvmrc
106
69
  - Appraisals
107
70
  - Gemfile
108
71
  - Gemfile.lock
@@ -110,39 +73,29 @@ files:
110
73
  - README.markdown
111
74
  - Rakefile
112
75
  - comma.gemspec
113
- - gemfiles/active2.3.14.gemfile
114
- - gemfiles/active2.3.14.gemfile.lock
115
- - gemfiles/active2.3.15.gemfile
116
- - gemfiles/active2.3.15.gemfile.lock
117
- - gemfiles/active2.3.2.gemfile
118
- - gemfiles/active2.3.2.gemfile.lock
119
- - gemfiles/active2.3.5.gemfile
120
- - gemfiles/active2.3.5.gemfile.lock
121
- - gemfiles/active2.3.7.gemfile
122
- - gemfiles/active2.3.7.gemfile.lock
76
+ - gemfiles/active3.0.9.gemfile
77
+ - gemfiles/active3.0.9.gemfile.lock
78
+ - gemfiles/active3.1.1.gemfile
79
+ - gemfiles/active3.1.1.gemfile.lock
80
+ - gemfiles/active3.2.1.gemfile
81
+ - gemfiles/active3.2.1.gemfile.lock
123
82
  - gemfiles/activesupport2.gemfile
124
83
  - gemfiles/activesupport2.gemfile.lock
125
84
  - gemfiles/activesupport3.gemfile
126
85
  - gemfiles/activesupport3.gemfile.lock
127
- - gemfiles/rails2.3.14.gemfile
128
- - gemfiles/rails2.3.14.gemfile.lock
129
- - gemfiles/rails2.3.15.gemfile
130
- - gemfiles/rails2.3.15.gemfile.lock
131
- - gemfiles/rails2.3.2.gemfile
132
- - gemfiles/rails2.3.2.gemfile.lock
133
- - gemfiles/rails2.3.5.gemfile
134
- - gemfiles/rails2.3.5.gemfile.lock
135
- - gemfiles/rails2.3.7.gemfile
136
- - gemfiles/rails2.3.7.gemfile.lock
86
+ - gemfiles/rails3.0.9.gemfile
87
+ - gemfiles/rails3.0.9.gemfile.lock
88
+ - gemfiles/rails3.1.1.gemfile
89
+ - gemfiles/rails3.1.1.gemfile.lock
90
+ - gemfiles/rails3.2.1.gemfile
91
+ - gemfiles/rails3.2.1.gemfile.lock
137
92
  - init.rb
138
93
  - lib/comma.rb
139
94
  - lib/comma/array.rb
140
- - lib/comma/association_proxy.rb
141
95
  - lib/comma/extractors.rb
142
96
  - lib/comma/generator.rb
143
- - lib/comma/named_scope.rb
144
97
  - lib/comma/object.rb
145
- - lib/comma/render_as_csv.rb
98
+ - lib/comma/relation.rb
146
99
  - lib/comma/version.rb
147
100
  - spec/comma/ar_spec.rb
148
101
  - spec/comma/comma_spec.rb
@@ -164,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
117
  version: '0'
165
118
  segments:
166
119
  - 0
167
- hash: -3789187626327987822
120
+ hash: 4325782371584984549
168
121
  required_rubygems_version: !ruby/object:Gem::Requirement
169
122
  none: false
170
123
  requirements:
@@ -173,10 +126,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
126
  version: '0'
174
127
  segments:
175
128
  - 0
176
- hash: -3789187626327987822
129
+ hash: 4325782371584984549
177
130
  requirements: []
178
131
  rubyforge_project: comma
179
- rubygems_version: 1.8.23
132
+ rubygems_version: 1.8.10
180
133
  signing_key:
181
134
  specification_version: 3
182
135
  summary: Ruby Comma Seperated Values generation library
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - ree
4
- - 1.8.7
5
- - 1.9.2
6
- - 1.9.3
7
- - rbx-18mode
8
-
9
- script: "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "2.3.14"
6
- gem "activerecord", "2.3.14"
7
-
8
- gemspec :path=>"../"
@@ -1,39 +0,0 @@
1
- PATH
2
- remote: /Users/tom/src/personal/comma
3
- specs:
4
- comma (2.1.3)
5
- fastercsv (~> 1.5.4)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- activerecord (2.3.14)
11
- activesupport (= 2.3.14)
12
- activesupport (2.3.14)
13
- appraisal (0.4.1)
14
- bundler
15
- rake
16
- diff-lcs (1.1.3)
17
- fastercsv (1.5.5)
18
- rake (0.8.7)
19
- rspec (2.7.0)
20
- rspec-core (~> 2.7.0)
21
- rspec-expectations (~> 2.7.0)
22
- rspec-mocks (~> 2.7.0)
23
- rspec-core (2.7.1)
24
- rspec-expectations (2.7.0)
25
- diff-lcs (~> 1.1.2)
26
- rspec-mocks (2.7.0)
27
- sqlite3 (1.3.5)
28
-
29
- PLATFORMS
30
- ruby
31
-
32
- DEPENDENCIES
33
- activerecord (= 2.3.14)
34
- activesupport (= 2.3.14)
35
- appraisal (>= 0.4.0)
36
- comma!
37
- rake (= 0.8.7)
38
- rspec (~> 2.7.0)
39
- sqlite3 (~> 1.3.4)