activerecord-postgres-copy 0.2.2 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +92 -15
- data/README.md +6 -3
- data/Rakefile +7 -17
- data/VERSION +1 -1
- data/lib/postgres-copy.rb +17 -0
- data/lib/{activerecord-postgres-copy/base.rb → postgres-copy/active_record.rb} +9 -2
- data/lib/postgres-copy/csv_responder.rb +7 -0
- data/lib/postgres-copy/zip_responder.rb +14 -0
- data/spec/fixtures/extra_field.rb +1 -1
- data/spec/fixtures/reserved_word_model.rb +5 -0
- data/spec/fixtures/reserved_words.csv +2 -0
- data/spec/fixtures/tab_with_two_lines.csv +3 -0
- data/spec/fixtures/test_model.rb +1 -1
- data/spec/pg_copy_from_spec.rb +19 -5
- data/spec/spec_helper.rb +7 -4
- metadata +113 -77
- data/.gitignore +0 -21
- data/activerecord-postgres-copy.gemspec +0 -74
- data/lib/activerecord-postgres-copy.rb +0 -3
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,94 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
4
|
+
actionmailer (3.1.3)
|
5
|
+
actionpack (= 3.1.3)
|
6
|
+
mail (~> 2.3.0)
|
7
|
+
actionpack (3.1.3)
|
8
|
+
activemodel (= 3.1.3)
|
9
|
+
activesupport (= 3.1.3)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
i18n (~> 0.6)
|
13
|
+
rack (~> 1.3.5)
|
14
|
+
rack-cache (~> 1.1)
|
15
|
+
rack-mount (~> 0.8.2)
|
16
|
+
rack-test (~> 0.6.1)
|
17
|
+
sprockets (~> 2.0.3)
|
18
|
+
activemodel (3.1.3)
|
19
|
+
activesupport (= 3.1.3)
|
20
|
+
builder (~> 3.0.0)
|
21
|
+
i18n (~> 0.6)
|
22
|
+
activerecord (3.1.3)
|
23
|
+
activemodel (= 3.1.3)
|
24
|
+
activesupport (= 3.1.3)
|
25
|
+
arel (~> 2.2.1)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activeresource (3.1.3)
|
28
|
+
activemodel (= 3.1.3)
|
29
|
+
activesupport (= 3.1.3)
|
30
|
+
activesupport (3.1.3)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
arel (2.2.1)
|
33
|
+
builder (3.0.0)
|
34
|
+
diff-lcs (1.1.2)
|
35
|
+
erubis (2.7.0)
|
36
|
+
hike (1.2.1)
|
37
|
+
i18n (0.6.0)
|
38
|
+
json (1.6.4)
|
39
|
+
mail (2.3.0)
|
40
|
+
i18n (>= 0.4.0)
|
41
|
+
mime-types (~> 1.16)
|
42
|
+
treetop (~> 1.4.8)
|
43
|
+
mime-types (1.17.2)
|
44
|
+
multi_json (1.0.4)
|
45
|
+
pg (0.11.0)
|
46
|
+
polyglot (0.3.3)
|
47
|
+
rack (1.3.6)
|
48
|
+
rack-cache (1.1)
|
49
|
+
rack (>= 0.4)
|
50
|
+
rack-mount (0.8.3)
|
51
|
+
rack (>= 1.0.0)
|
52
|
+
rack-ssl (1.3.2)
|
53
|
+
rack
|
54
|
+
rack-test (0.6.1)
|
55
|
+
rack (>= 1.0)
|
56
|
+
rails (3.1.3)
|
57
|
+
actionmailer (= 3.1.3)
|
58
|
+
actionpack (= 3.1.3)
|
59
|
+
activerecord (= 3.1.3)
|
60
|
+
activeresource (= 3.1.3)
|
61
|
+
activesupport (= 3.1.3)
|
62
|
+
bundler (~> 1.0)
|
63
|
+
railties (= 3.1.3)
|
64
|
+
railties (3.1.3)
|
65
|
+
actionpack (= 3.1.3)
|
66
|
+
activesupport (= 3.1.3)
|
67
|
+
rack-ssl (~> 1.3.2)
|
68
|
+
rake (>= 0.8.7)
|
69
|
+
rdoc (~> 3.4)
|
70
|
+
thor (~> 0.14.6)
|
71
|
+
rake (0.8.7)
|
72
|
+
rdoc (3.12)
|
73
|
+
json (~> 1.4)
|
74
|
+
rspec (2.6.0)
|
75
|
+
rspec-core (~> 2.6.0)
|
76
|
+
rspec-expectations (~> 2.6.0)
|
77
|
+
rspec-mocks (~> 2.6.0)
|
78
|
+
rspec-core (2.6.3)
|
79
|
+
rspec-expectations (2.6.0)
|
80
|
+
diff-lcs (~> 1.1.2)
|
81
|
+
rspec-mocks (2.6.0)
|
82
|
+
sprockets (2.0.3)
|
83
|
+
hike (~> 1.2)
|
84
|
+
rack (~> 1.0)
|
85
|
+
tilt (~> 1.1, != 1.3.0)
|
86
|
+
thor (0.14.6)
|
87
|
+
tilt (1.3.3)
|
88
|
+
treetop (1.4.10)
|
89
|
+
polyglot
|
90
|
+
polyglot (>= 0.3.1)
|
91
|
+
tzinfo (0.3.31)
|
19
92
|
|
20
93
|
PLATFORMS
|
21
94
|
ruby
|
@@ -23,3 +96,7 @@ PLATFORMS
|
|
23
96
|
DEPENDENCIES
|
24
97
|
activerecord
|
25
98
|
pg
|
99
|
+
rails
|
100
|
+
rake (= 0.8.7)
|
101
|
+
rspec (~> 2.6)
|
102
|
+
rspec-core (~> 2.6)
|
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# postgres-copy
|
2
2
|
|
3
3
|
This Gem will enable your AR models to use the PostgreSQL COPY command to import/export data in CSV format.
|
4
|
-
|
4
|
+
If you need to tranfer data between a PostgreSQL database and CSV files, the PostgreSQL native CSV parser
|
5
|
+
will give you a greater performance than using the ruby CSV+INSERT commands.
|
6
|
+
I have not found time to make accurate benchmarks, but in the use scenario where I have developed the gem
|
7
|
+
I have had a four-fold performance gain.
|
5
8
|
|
6
9
|
## Install
|
7
10
|
|
8
|
-
gem install
|
11
|
+
gem install postgres-copy
|
9
12
|
|
10
13
|
## Usage
|
11
14
|
|
data/Rakefile
CHANGED
@@ -5,10 +5,10 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "activerecord-postgres-copy"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{
|
8
|
+
gem.summary = %Q{This version is obsolete, please use the postgres-copy gem}
|
9
|
+
gem.description = %Q{This version is obsolete, please use the postgres-copy gem}
|
10
10
|
gem.email = "diogob@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/diogob/
|
11
|
+
gem.homepage = "http://github.com/diogob/postgres-copy"
|
12
12
|
gem.authors = ["Diogo Biazus"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
14
|
gem.add_dependency "activerecord", ">= 3.0.0"
|
@@ -19,26 +19,16 @@ rescue LoadError
|
|
19
19
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
20
|
end
|
21
21
|
|
22
|
-
require
|
23
|
-
|
24
|
-
spec.
|
25
|
-
spec.
|
22
|
+
require "rspec/core/rake_task" # RSpec 2.0
|
23
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
24
|
+
spec.pattern = 'spec/*_spec.rb'
|
25
|
+
spec.rspec_opts = ["--backtrace", "--color", "--format progress", "-r ./spec/spec_helper.rb"]
|
26
26
|
end
|
27
|
-
|
28
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
-
spec.libs << 'lib' << 'spec'
|
30
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
-
spec.rcov = true
|
32
|
-
end
|
33
|
-
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
27
|
task :default => :spec
|
37
28
|
|
38
29
|
require 'rake/rdoctask'
|
39
30
|
Rake::RDocTask.new do |rdoc|
|
40
31
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
-
|
42
32
|
rdoc.rdoc_dir = 'rdoc'
|
43
33
|
rdoc.title = "activerecord-postgres-copy #{version}"
|
44
34
|
rdoc.rdoc_files.include('README*')
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.6
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
require 'postgres-copy/active_record'
|
4
|
+
require 'rails'
|
5
|
+
|
6
|
+
class PostgresCopy < Rails::Railtie
|
7
|
+
|
8
|
+
initializer 'postgres-copy' do
|
9
|
+
ActiveSupport.on_load :active_record do
|
10
|
+
require "postgres-copy/active_record"
|
11
|
+
end
|
12
|
+
ActiveSupport.on_load :action_controller do
|
13
|
+
require "postgres-copy/csv_responder"
|
14
|
+
require "postgres-copy/zip_responder"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -12,6 +12,13 @@ module ActiveRecord
|
|
12
12
|
end
|
13
13
|
return self
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.pg_copy_to_string
|
17
|
+
# It would be cool to work like an Enumerable
|
18
|
+
data = ''
|
19
|
+
self.pg_copy_to{|l| data += l }
|
20
|
+
data
|
21
|
+
end
|
15
22
|
|
16
23
|
def self.pg_copy_from path_or_io, options = {}
|
17
24
|
options = {:delimiter => "\t"}.merge(options)
|
@@ -20,13 +27,13 @@ module ActiveRecord
|
|
20
27
|
line = io.gets
|
21
28
|
columns_list = options[:columns] || line.strip.split(options[:delimiter])
|
22
29
|
columns_list = columns_list.map{|c| options[:map][c.to_s] } if options[:map]
|
23
|
-
connection.execute
|
30
|
+
connection.execute %{COPY #{quoted_table_name} ("#{columns_list.join('","')}") FROM STDIN WITH DELIMITER '#{options[:delimiter]}' CSV}
|
24
31
|
while line = io.gets do
|
25
32
|
next if line.strip.size == 0
|
26
33
|
if block_given?
|
27
34
|
row = line.strip.split(options[:delimiter])
|
28
35
|
yield(row)
|
29
|
-
line = row.join(options[:delimiter])
|
36
|
+
line = row.join(options[:delimiter]) + "\n"
|
30
37
|
end
|
31
38
|
connection.raw_connection.put_copy_data line
|
32
39
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ActionController::Responder
|
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 => "application/zip", :disposition => 'inline'
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,14 @@
|
|
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
|
data/spec/fixtures/test_model.rb
CHANGED
data/spec/pg_copy_from_spec.rb
CHANGED
@@ -35,6 +35,14 @@ describe "COPY FROM" do
|
|
35
35
|
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'changed this data'}]
|
36
36
|
end
|
37
37
|
|
38
|
+
it "should import 2 lines and allow changes in block" do
|
39
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_two_lines.csv'), 'r')) do |row|
|
40
|
+
row[1] = 'changed this data'
|
41
|
+
end
|
42
|
+
TestModel.order(:id).first.attributes.should == {'id' => 1, 'data' => 'changed this data'}
|
43
|
+
TestModel.count.should == 2
|
44
|
+
end
|
45
|
+
|
38
46
|
it "should be able to copy from using custom set of columns" do
|
39
47
|
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_only_data.csv'), 'r'), :columns => ["data"])
|
40
48
|
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
@@ -60,11 +68,17 @@ describe "COPY FROM" do
|
|
60
68
|
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
61
69
|
end
|
62
70
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
71
|
+
#we should implement this later
|
72
|
+
#it "should raise error in malformed files" do
|
73
|
+
#lambda do
|
74
|
+
#TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_error.csv'), 'r'))
|
75
|
+
#end.should raise_error
|
76
|
+
#TestModel.order(:id).all.map{|r| r.attributes}.should == []
|
77
|
+
#end
|
78
|
+
|
79
|
+
it "should copy from even when table fields need identifier quoting" do
|
80
|
+
ReservedWordModel.pg_copy_from File.expand_path('spec/fixtures/reserved_words.csv')
|
81
|
+
ReservedWordModel.order(:id).all.map{|r| r.attributes}.should == [{"group"=>"group name", "id"=>1, "select"=>"test select"}]
|
68
82
|
end
|
69
83
|
end
|
70
84
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,10 +2,11 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'fixtures/test_model'
|
4
4
|
require 'fixtures/extra_field'
|
5
|
-
require '
|
6
|
-
require '
|
5
|
+
require 'fixtures/reserved_word_model'
|
6
|
+
require 'rspec'
|
7
|
+
require 'rspec/autorun'
|
7
8
|
|
8
|
-
|
9
|
+
RSpec.configure do |config|
|
9
10
|
config.before(:suite) do
|
10
11
|
# we create a test database if it does not exist
|
11
12
|
# I do not use database users or password for the tests, using ident authentication instead
|
@@ -19,11 +20,13 @@ Spec::Runner.configure do |config|
|
|
19
20
|
SET client_min_messages TO warning;
|
20
21
|
DROP TABLE IF EXISTS test_models;
|
21
22
|
DROP TABLE IF EXISTS extra_fields;
|
23
|
+
DROP TABLE IF EXISTS reserved_word_models;
|
22
24
|
CREATE TABLE test_models (id serial PRIMARY KEY, data text);
|
25
|
+
CREATE TABLE reserved_word_models (id serial PRIMARY KEY, "select" text, "group" text);
|
23
26
|
CREATE TABLE extra_fields (id serial PRIMARY KEY, data text, created_at timestamp, updated_at timestamp);
|
24
27
|
}
|
25
28
|
rescue Exception => e
|
26
|
-
puts "
|
29
|
+
puts "Exception: #{e}"
|
27
30
|
ActiveRecord::Base.establish_connection(
|
28
31
|
:adapter => "postgresql",
|
29
32
|
:host => "localhost",
|
metadata
CHANGED
@@ -1,77 +1,127 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres-copy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 2
|
10
|
-
version: 0.2.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.6
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Diogo Biazus
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2011-12-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pg
|
16
|
+
requirement: &70222191228800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70222191228800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activerecord
|
27
|
+
requirement: &70222191225880 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70222191225880
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rails
|
38
|
+
requirement: &70222191402760 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70222191402760
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70222191398800 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - =
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.7
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70222191398800
|
58
|
+
- !ruby/object:Gem::Dependency
|
22
59
|
name: rspec
|
60
|
+
requirement: &70222191395200 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.6'
|
66
|
+
type: :runtime
|
23
67
|
prerelease: false
|
24
|
-
|
68
|
+
version_requirements: *70222191395200
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-core
|
71
|
+
requirement: &70222191406500 !ruby/object:Gem::Requirement
|
25
72
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.6'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70222191406500
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: &70222191404700 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
34
87
|
version: 1.2.9
|
35
88
|
type: :development
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: activerecord
|
39
89
|
prerelease: false
|
40
|
-
|
90
|
+
version_requirements: *70222191404700
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: activerecord
|
93
|
+
requirement: &70222191403940 !ruby/object:Gem::Requirement
|
41
94
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 7
|
46
|
-
segments:
|
47
|
-
- 3
|
48
|
-
- 0
|
49
|
-
- 0
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
50
98
|
version: 3.0.0
|
51
99
|
type: :runtime
|
52
|
-
|
53
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70222191403940
|
102
|
+
description: This version is obsolete, please use the postgres-copy gem
|
54
103
|
email: diogob@gmail.com
|
55
104
|
executables: []
|
56
|
-
|
57
105
|
extensions: []
|
58
|
-
|
59
|
-
extra_rdoc_files:
|
106
|
+
extra_rdoc_files:
|
60
107
|
- LICENSE
|
61
108
|
- README.md
|
62
|
-
files:
|
109
|
+
files:
|
63
110
|
- .document
|
64
|
-
- .
|
111
|
+
- .rspec
|
65
112
|
- Gemfile
|
66
113
|
- Gemfile.lock
|
67
114
|
- LICENSE
|
68
115
|
- README.md
|
69
116
|
- Rakefile
|
70
117
|
- VERSION
|
71
|
-
-
|
72
|
-
- lib/
|
73
|
-
- lib/
|
118
|
+
- lib/postgres-copy.rb
|
119
|
+
- lib/postgres-copy/active_record.rb
|
120
|
+
- lib/postgres-copy/csv_responder.rb
|
121
|
+
- lib/postgres-copy/zip_responder.rb
|
74
122
|
- spec/fixtures/extra_field.rb
|
123
|
+
- spec/fixtures/reserved_word_model.rb
|
124
|
+
- spec/fixtures/reserved_words.csv
|
75
125
|
- spec/fixtures/semicolon_with_different_header.csv
|
76
126
|
- spec/fixtures/semicolon_with_header.csv
|
77
127
|
- spec/fixtures/tab_only_data.csv
|
@@ -79,48 +129,34 @@ files:
|
|
79
129
|
- spec/fixtures/tab_with_error.csv
|
80
130
|
- spec/fixtures/tab_with_extra_line.csv
|
81
131
|
- spec/fixtures/tab_with_header.csv
|
132
|
+
- spec/fixtures/tab_with_two_lines.csv
|
82
133
|
- spec/fixtures/test_model.rb
|
83
134
|
- spec/pg_copy_from_spec.rb
|
84
135
|
- spec/pg_copy_to_spec.rb
|
85
136
|
- spec/spec.opts
|
86
137
|
- spec/spec_helper.rb
|
87
|
-
|
88
|
-
homepage: http://github.com/diogob/activerecord-postgres-copy
|
138
|
+
homepage: http://github.com/diogob/postgres-copy
|
89
139
|
licenses: []
|
90
|
-
|
91
140
|
post_install_message:
|
92
|
-
rdoc_options:
|
93
|
-
|
94
|
-
require_paths:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
95
143
|
- lib
|
96
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
145
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
151
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
segments:
|
112
|
-
- 0
|
113
|
-
version: "0"
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
114
156
|
requirements: []
|
115
|
-
|
116
157
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.
|
158
|
+
rubygems_version: 1.8.10
|
118
159
|
signing_key:
|
119
160
|
specification_version: 3
|
120
|
-
summary:
|
121
|
-
test_files:
|
122
|
-
- spec/spec_helper.rb
|
123
|
-
- spec/pg_copy_from_spec.rb
|
124
|
-
- spec/pg_copy_to_spec.rb
|
125
|
-
- spec/fixtures/test_model.rb
|
126
|
-
- spec/fixtures/extra_field.rb
|
161
|
+
summary: This version is obsolete, please use the postgres-copy gem
|
162
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{activerecord-postgres-copy}
|
8
|
-
s.version = "0.2.2"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Diogo Biazus"]
|
12
|
-
s.date = %q{2011-02-09}
|
13
|
-
s.description = %q{Now you can use the super fast COPY for import/export data directly from your AR models.}
|
14
|
-
s.email = %q{diogob@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"activerecord-postgres-copy.gemspec",
|
29
|
-
"lib/activerecord-postgres-copy.rb",
|
30
|
-
"lib/activerecord-postgres-copy/base.rb",
|
31
|
-
"spec/fixtures/extra_field.rb",
|
32
|
-
"spec/fixtures/semicolon_with_different_header.csv",
|
33
|
-
"spec/fixtures/semicolon_with_header.csv",
|
34
|
-
"spec/fixtures/tab_only_data.csv",
|
35
|
-
"spec/fixtures/tab_with_different_header.csv",
|
36
|
-
"spec/fixtures/tab_with_error.csv",
|
37
|
-
"spec/fixtures/tab_with_extra_line.csv",
|
38
|
-
"spec/fixtures/tab_with_header.csv",
|
39
|
-
"spec/fixtures/test_model.rb",
|
40
|
-
"spec/pg_copy_from_spec.rb",
|
41
|
-
"spec/pg_copy_to_spec.rb",
|
42
|
-
"spec/spec.opts",
|
43
|
-
"spec/spec_helper.rb"
|
44
|
-
]
|
45
|
-
s.homepage = %q{http://github.com/diogob/activerecord-postgres-copy}
|
46
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
47
|
-
s.require_paths = ["lib"]
|
48
|
-
s.rubygems_version = %q{1.3.7}
|
49
|
-
s.summary = %q{Put COPY command functionality in ActiveRecord's model class}
|
50
|
-
s.test_files = [
|
51
|
-
"spec/spec_helper.rb",
|
52
|
-
"spec/pg_copy_from_spec.rb",
|
53
|
-
"spec/pg_copy_to_spec.rb",
|
54
|
-
"spec/fixtures/test_model.rb",
|
55
|
-
"spec/fixtures/extra_field.rb"
|
56
|
-
]
|
57
|
-
|
58
|
-
if s.respond_to? :specification_version then
|
59
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
|
-
s.specification_version = 3
|
61
|
-
|
62
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
64
|
-
s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
|
65
|
-
else
|
66
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
67
|
-
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
68
|
-
end
|
69
|
-
else
|
70
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
71
|
-
s.add_dependency(%q<activerecord>, [">= 3.0.0"])
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|