postgres-copy 0.5.3 → 0.5.4

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
data/lib/postgres-copy.rb CHANGED
@@ -11,7 +11,6 @@ class PostgresCopy < Rails::Railtie
11
11
  end
12
12
  ActiveSupport.on_load :action_controller do
13
13
  require "postgres-copy/csv_responder"
14
- require "postgres-copy/zip_responder"
15
14
  end
16
15
  end
17
16
  end
@@ -1,7 +1,9 @@
1
- class ActionController::Responder
1
+ module Responders::CsvResponder
2
2
  def to_csv
3
- name = "#{controller.resource.class.name.downcase}_#{Time.now.to_i}"
4
-
5
- return controller.send_data controller.send(:end_of_association_chain).pg_copy_to_string, :filename => "/tmp/#{name}.csv", :type => "text/csv", :disposition => 'inline'
3
+ controller.response_body = Enumerator.new do |y|
4
+ controller.send(:end_of_association_chain).pg_copy_to do |line|
5
+ y << line
6
+ end
7
+ end
6
8
  end
7
9
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "postgres-copy"
8
- s.version = "0.5.3"
8
+ s.version = "0.5.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Diogo Biazus"]
12
- s.date = "2012-12-21"
12
+ s.date = "2013-01-21"
13
13
  s.description = "Now you can use the super fast COPY for import/export data directly from your AR models."
14
14
  s.email = "diogob@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
28
28
  "lib/postgres-copy.rb",
29
29
  "lib/postgres-copy/active_record.rb",
30
30
  "lib/postgres-copy/csv_responder.rb",
31
- "lib/postgres-copy/zip_responder.rb",
32
31
  "postgres-copy.gemspec",
33
32
  "spec/fixtures/2_col_binary_data.dat",
34
33
  "spec/fixtures/comma_with_header.csv",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgres-copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
@@ -175,7 +175,6 @@ files:
175
175
  - lib/postgres-copy.rb
176
176
  - lib/postgres-copy/active_record.rb
177
177
  - lib/postgres-copy/csv_responder.rb
178
- - lib/postgres-copy/zip_responder.rb
179
178
  - postgres-copy.gemspec
180
179
  - spec/fixtures/2_col_binary_data.dat
181
180
  - spec/fixtures/comma_with_header.csv
@@ -211,7 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
210
  version: '0'
212
211
  segments:
213
212
  - 0
214
- hash: 4588526125653232900
213
+ hash: -4554510163054013066
215
214
  required_rubygems_version: !ruby/object:Gem::Requirement
216
215
  none: false
217
216
  requirements:
@@ -1,14 +0,0 @@
1
-
2
- Mime::Type.register 'application/zip', :zip
3
-
4
- class ActionController::Responder
5
- def to_zip
6
- name = "#{controller.resource.class.name.downcase}_#{Time.now.to_i}"
7
- controller.send(:end_of_association_chain).pg_copy_to "/tmp/#{name}.csv"
8
- Dir.chdir('/tmp') do
9
- `zip #{name} #{name}.csv`
10
- zip = "#{name}.zip"
11
- return controller.send_file zip, :filename => zip, :type => "application/zip", :disposition => 'inline'
12
- end
13
- end
14
- end