postgres-copy 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/postgres-copy.rb +0 -1
- data/lib/postgres-copy/csv_responder.rb +6 -4
- data/postgres-copy.gemspec +2 -3
- metadata +3 -4
- data/lib/postgres-copy/zip_responder.rb +0 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/lib/postgres-copy.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
module Responders::CsvResponder
|
2
2
|
def to_csv
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
data/postgres-copy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "postgres-copy"
|
8
|
-
s.version = "0.5.
|
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 = "
|
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.
|
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:
|
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:
|
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
|