activerecord-postgres-copy 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +25 -0
- data/LICENSE +20 -0
- data/README.md +30 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/activerecord-postgres-copy.gemspec +74 -0
- data/lib/activerecord-postgres-copy.rb +3 -0
- data/lib/activerecord-postgres-copy/base.rb +36 -0
- data/spec/fixtures/extra_field.rb +5 -0
- data/spec/fixtures/semicolon_with_different_header.csv +2 -0
- data/spec/fixtures/semicolon_with_header.csv +2 -0
- data/spec/fixtures/tab_only_data.csv +2 -0
- data/spec/fixtures/tab_with_different_header.csv +2 -0
- data/spec/fixtures/tab_with_error.csv +3 -0
- data/spec/fixtures/tab_with_extra_line.csv +3 -0
- data/spec/fixtures/tab_with_header.csv +2 -0
- data/spec/fixtures/test_model.rb +4 -0
- data/spec/pg_copy_from_spec.rb +70 -0
- data/spec/pg_copy_to_spec.rb +35 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +37 -0
- metadata +126 -0
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.0.3)
|
5
|
+
activesupport (= 3.0.3)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.4)
|
8
|
+
activerecord (3.0.3)
|
9
|
+
activemodel (= 3.0.3)
|
10
|
+
activesupport (= 3.0.3)
|
11
|
+
arel (~> 2.0.2)
|
12
|
+
tzinfo (~> 0.3.23)
|
13
|
+
activesupport (3.0.3)
|
14
|
+
arel (2.0.6)
|
15
|
+
builder (2.1.2)
|
16
|
+
i18n (0.5.0)
|
17
|
+
pg (0.10.1)
|
18
|
+
tzinfo (0.3.23)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
activerecord
|
25
|
+
pg
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Diogo Biazus
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# activerecord-postgres-copy
|
2
|
+
|
3
|
+
This Gem will enable your AR models to use the PostgreSQL COPY command to import/export data in CSV format.
|
4
|
+
It's still in its ealry stages of development, *not production ready*.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
gem install activerecord-postgres-copy
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
The gem will add two aditiontal class methods to ActiveRecord::Base as a monkey patch (I'll change this soon):
|
13
|
+
|
14
|
+
* pg_copy_to (description yet to be added)
|
15
|
+
* pg_copy_from (description yet to be added)
|
16
|
+
|
17
|
+
|
18
|
+
## Note on Patches/Pull Requests
|
19
|
+
|
20
|
+
* Fork the project.
|
21
|
+
* Make your feature addition or bug fix.
|
22
|
+
* Add tests for it. This is important so I don't break it in a
|
23
|
+
future version unintentionally.
|
24
|
+
* Commit, do not mess with rakefile, version, or history.
|
25
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
26
|
+
* Send me a pull request. Bonus points for topic branches.
|
27
|
+
|
28
|
+
## Copyright
|
29
|
+
|
30
|
+
Copyright (c) 2011 Diogo Biazus. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "activerecord-postgres-copy"
|
8
|
+
gem.summary = %Q{Put COPY command functionality in ActiveRecord's model class}
|
9
|
+
gem.description = %Q{Now you can use the super fast COPY for import/export data directly from your AR models.}
|
10
|
+
gem.email = "diogob@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/diogob/activerecord-postgres-copy"
|
12
|
+
gem.authors = ["Diogo Biazus"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "activerecord", ">= 3.0.0"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
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
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "activerecord-postgres-copy #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.2
|
@@ -0,0 +1,74 @@
|
|
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
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Base
|
3
|
+
def self.pg_copy_to path = nil
|
4
|
+
if path
|
5
|
+
raise "You have to choose between exporting to a file or receiving the lines inside a block" if block_given?
|
6
|
+
connection.execute "COPY (#{self.scoped.to_sql}) TO #{sanitize(path)} WITH DELIMITER '\t' CSV HEADER"
|
7
|
+
else
|
8
|
+
connection.execute "COPY (#{self.scoped.to_sql}) TO STDOUT WITH DELIMITER '\t' CSV HEADER"
|
9
|
+
while line = connection.raw_connection.get_copy_data do
|
10
|
+
yield(line) if block_given?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
return self
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.pg_copy_from path_or_io, options = {}
|
17
|
+
options = {:delimiter => "\t"}.merge(options)
|
18
|
+
io = path_or_io.instance_of?(String) ? File.open(path_or_io, 'r') : path_or_io
|
19
|
+
# The first line should be always the HEADER.
|
20
|
+
line = io.gets
|
21
|
+
columns_list = options[:columns] || line.strip.split(options[:delimiter])
|
22
|
+
columns_list = columns_list.map{|c| options[:map][c.to_s] } if options[:map]
|
23
|
+
connection.execute "COPY #{quoted_table_name} (#{columns_list.join(",")}) FROM STDIN WITH DELIMITER '#{options[:delimiter]}' CSV"
|
24
|
+
while line = io.gets do
|
25
|
+
next if line.strip.size == 0
|
26
|
+
if block_given?
|
27
|
+
row = line.strip.split(options[:delimiter])
|
28
|
+
yield(row)
|
29
|
+
line = row.join(options[:delimiter])
|
30
|
+
end
|
31
|
+
connection.raw_connection.put_copy_data line
|
32
|
+
end
|
33
|
+
connection.raw_connection.put_copy_end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "COPY FROM" do
|
4
|
+
before(:each) do
|
5
|
+
ActiveRecord::Base.connection.execute %{
|
6
|
+
TRUNCATE TABLE test_models;
|
7
|
+
SELECT setval('test_models_id_seq', 1, false);
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should import from file if path is passed without field_map" do
|
12
|
+
TestModel.pg_copy_from File.expand_path('spec/fixtures/tab_with_header.csv')
|
13
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should import from IO without field_map" do
|
17
|
+
TestModel.pg_copy_from File.open(File.expand_path('spec/fixtures/tab_with_header.csv'), 'r')
|
18
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should import with custom delimiter from path" do
|
22
|
+
TestModel.pg_copy_from File.expand_path('spec/fixtures/semicolon_with_header.csv'), :delimiter => ';'
|
23
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should import with custom delimiter from IO" do
|
27
|
+
TestModel.pg_copy_from File.open(File.expand_path('spec/fixtures/semicolon_with_header.csv'), 'r'), :delimiter => ';'
|
28
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should import and allow changes in block" do
|
32
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_header.csv'), 'r')) do |row|
|
33
|
+
row[1] = 'changed this data'
|
34
|
+
end
|
35
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'changed this data'}]
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should be able to copy from using custom set of columns" do
|
39
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_only_data.csv'), 'r'), :columns => ["data"])
|
40
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
41
|
+
end
|
42
|
+
|
43
|
+
it "default set of columns should be all table columns minus [id, created_at, updated_at]" do
|
44
|
+
ExtraField.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_header.csv'), 'r'))
|
45
|
+
ExtraField.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1', 'created_at' => nil, 'updated_at' => nil}]
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to map the header in the file to diferent column names" do
|
49
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_different_header.csv'), 'r'), :map => {'cod' => 'id', 'info' => 'data'})
|
50
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to map the header in the file to diferent column names with custom delimiter" do
|
54
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/semicolon_with_different_header.csv'), 'r'), :delimiter => ';', :map => {'cod' => 'id', 'info' => 'data'})
|
55
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should ignore empty lines" do
|
59
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_extra_line.csv'), 'r'))
|
60
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should raise error in malformed files" do
|
64
|
+
lambda do
|
65
|
+
TestModel.pg_copy_from(File.open(File.expand_path('spec/fixtures/tab_with_error.csv'), 'r'))
|
66
|
+
end.should raise_error
|
67
|
+
TestModel.order(:id).all.map{|r| r.attributes}.should == []
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "COPY TO" do
|
4
|
+
before(:all) do
|
5
|
+
ActiveRecord::Base.connection.execute %{
|
6
|
+
TRUNCATE TABLE test_models;
|
7
|
+
SELECT setval('test_models_id_seq', 1, false);
|
8
|
+
}
|
9
|
+
TestModel.create :data => 'test data 1'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should copy and pass data to block if block is given and no path is passed" do
|
13
|
+
File.open('spec/fixtures/tab_with_header.csv', 'r') do |f|
|
14
|
+
TestModel.pg_copy_to do |row|
|
15
|
+
row.should == f.readline
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should copy to disk if block is not given and a path is passed" do
|
21
|
+
TestModel.pg_copy_to '/tmp/export.csv'
|
22
|
+
File.open('spec/fixtures/tab_with_header.csv', 'r') do |fixture|
|
23
|
+
File.open('/tmp/export.csv', 'r') do |result|
|
24
|
+
result.read.should == fixture.read
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should raise exception if I pass a path and a block simultaneously" do
|
30
|
+
lambda do
|
31
|
+
TestModel.pg_copy_to('/tmp/bogus_path') do |row|
|
32
|
+
end
|
33
|
+
end.should raise_error
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'fixtures/test_model'
|
4
|
+
require 'fixtures/extra_field'
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/autorun'
|
7
|
+
|
8
|
+
Spec::Runner.configure do |config|
|
9
|
+
config.before(:suite) do
|
10
|
+
# we create a test database if it does not exist
|
11
|
+
# I do not use database users or password for the tests, using ident authentication instead
|
12
|
+
begin
|
13
|
+
ActiveRecord::Base.establish_connection(
|
14
|
+
:adapter => "postgresql",
|
15
|
+
:host => "localhost",
|
16
|
+
:database => "ar_pg_copy_test"
|
17
|
+
)
|
18
|
+
ActiveRecord::Base.connection.execute %{
|
19
|
+
SET client_min_messages TO warning;
|
20
|
+
DROP TABLE IF EXISTS test_models;
|
21
|
+
DROP TABLE IF EXISTS extra_fields;
|
22
|
+
CREATE TABLE test_models (id serial PRIMARY KEY, data text);
|
23
|
+
CREATE TABLE extra_fields (id serial PRIMARY KEY, data text, created_at timestamp, updated_at timestamp);
|
24
|
+
}
|
25
|
+
rescue Exception => e
|
26
|
+
puts "RESCUE"
|
27
|
+
ActiveRecord::Base.establish_connection(
|
28
|
+
:adapter => "postgresql",
|
29
|
+
:host => "localhost",
|
30
|
+
:database => "postgres"
|
31
|
+
)
|
32
|
+
ActiveRecord::Base.connection.execute "CREATE DATABASE ar_pg_copy_test"
|
33
|
+
retry
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activerecord-postgres-copy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Diogo Biazus
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-09 00:00:00 -02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activerecord
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 3.0.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
description: Now you can use the super fast COPY for import/export data directly from your AR models.
|
54
|
+
email: diogob@gmail.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README.md
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- .gitignore
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- VERSION
|
71
|
+
- activerecord-postgres-copy.gemspec
|
72
|
+
- lib/activerecord-postgres-copy.rb
|
73
|
+
- lib/activerecord-postgres-copy/base.rb
|
74
|
+
- spec/fixtures/extra_field.rb
|
75
|
+
- spec/fixtures/semicolon_with_different_header.csv
|
76
|
+
- spec/fixtures/semicolon_with_header.csv
|
77
|
+
- spec/fixtures/tab_only_data.csv
|
78
|
+
- spec/fixtures/tab_with_different_header.csv
|
79
|
+
- spec/fixtures/tab_with_error.csv
|
80
|
+
- spec/fixtures/tab_with_extra_line.csv
|
81
|
+
- spec/fixtures/tab_with_header.csv
|
82
|
+
- spec/fixtures/test_model.rb
|
83
|
+
- spec/pg_copy_from_spec.rb
|
84
|
+
- spec/pg_copy_to_spec.rb
|
85
|
+
- spec/spec.opts
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
has_rdoc: true
|
88
|
+
homepage: http://github.com/diogob/activerecord-postgres-copy
|
89
|
+
licenses: []
|
90
|
+
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options:
|
93
|
+
- --charset=UTF-8
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.3.7
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Put COPY command functionality in ActiveRecord's model class
|
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
|