pg_csv 0.1.8 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3b49169c6d5e9601a21b8da94f6894c82b86aedc
4
- data.tar.gz: 5977fc12efe086311c4203ba259b4bb31ad60b9c
2
+ SHA256:
3
+ metadata.gz: 88e1d29a5270587b750a05a8c3b620907988d0b4e8942ddc0dec4f8f14423d7e
4
+ data.tar.gz: 66d1d47569da691d87fba379cf223a10a8c405d20663375a75dc6fdb9068ffd2
5
5
  SHA512:
6
- metadata.gz: 4d2bc55b716a156cb155216912b09ae920764463142207aad4aa9bbe8d6014a31633213af308273706b4e4ca854b739b61f2f54df30f70b8eaa7d7b70f15253e
7
- data.tar.gz: b2a33e4e655978b64b9b4bdc7157ccd165ec6f1578a4a29f57dc582c913271be207b0fcf440af097577b700da676ccf09a51befd969c64adab579e23b62cd96f
6
+ metadata.gz: 575ef7200517a797d4b625c7dddc7e704ffa8719d1c7e6b4f19bbf0807204ea789317892bdd46ec07a6e698e86afb4282c2c5cfce60d0c1117527f8e1e3c22d3
7
+ data.tar.gz: f392c817d176ddc268c82b0f9f4aad2642ea60b93437602732a143526e36477837f12f3a879c663ef60ee24d0e0953c2b974036e973069a69a4ac61e03cb3457
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  PgCsv
2
2
  =====
3
3
 
4
- Fast AR/PostgreSQL csv export. Uses pg function 'copy to csv'. Effective on millions rows.
4
+ Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows.
5
5
 
6
6
  Gemfile:
7
7
  ``` ruby
@@ -17,48 +17,49 @@ PgCsv.new(opts).export(to, opts)
17
17
 
18
18
  Options:
19
19
  ``` ruby
20
- :sql => "select p.* from users u, projects p where p.user_id = u.id order by email limit 10"
21
- :connection => AR.connection
22
- :delimiter => ["\t", ",", ]
23
- :header => boolean, use pg header for fields?
24
- :logger => logger
25
- :columns => array of column names, ignore :header option
26
- :encoding => encoding (default is pg_default), list of encodings: http://www.postgresql.org/docs/8.4/static/multibyte.html#CHARSET-TABLE
20
+ :sql => plain sql ("select id, name from users")
21
+ :connection => ActiveRecord::Base.connection or PG::Connection(gem pg)
22
+ :delimiter => ["\t", ",", ]
23
+ :header => boolean, use pg header for fields?
24
+ :logger => logger
25
+ :columns => array of column names, ignore :header option
26
+ :encoding => encoding (default is pg_default), list of encodings: http://www.postgresql.org/docs/8.4/static/multibyte.html#CHARSET-TABLE
27
+ :force_quote => boolean, force quotes around all non-NULL data?
27
28
 
28
- :temp_file => boolean, generate throught temp file? final file appears by mv
29
- :temp_dir => for :temp_file, ex: '/tmp'
29
+ :temp_file => boolean, generate throught temp file? final file appears by mv
30
+ :temp_dir => for :temp_file, ex: '/tmp'
30
31
 
31
- :type => :plain - return full string
32
- => :gzip - save file to gzip
33
- => :stream - save to stream
34
- => :file - just save to file = default
35
- => :yield - return each row to block
32
+ :type => :plain - return full string
33
+ => :gzip - save file to gzip
34
+ => :stream - save to stream
35
+ => :file - just save to file = default
36
+ => :yield - return each row to block
36
37
  ```
37
38
 
38
39
  Examples:
39
40
  ``` ruby
40
- PgCsv.new(:sql => User.good.to_sql).export('a1.csv')
41
- PgCsv.new(:sql => sql).export('a2.gz', :type => :gzip)
42
- PgCsv.new(:sql => sql).export('a3.csv', :temp_file => true)
43
- PgCsv.new(:sql => sql, :type => :plain).export
44
- File.open("a4.csv", 'a'){|f| PgCsv.new(:sql => "select * from users").\
45
- export(f, :type => :stream) }
46
- PgCsv.new(:sql => sql).export('a5.csv', :delimiter => "\t")
47
- PgCsv.new(:sql => sql).export('a6.csv', :header => true)
48
- PgCsv.new(:sql => sql).export('a7.csv', :columns => %w{id a b c})
49
- PgCsv.new(:sql => sql, :connection => SomeDb.connection, :columns => %w{id a b c}, :delimiter => "|").\
50
- export('a8.gz', :type => :gzip, :temp_file => true)
41
+ PgCsv.new(sql: sql).export('a1.csv')
42
+ PgCsv.new(sql: sql).export('a2.gz', type: :gzip)
43
+ PgCsv.new(sql: sql).export('a3.csv', temp_file: true)
44
+ PgCsv.new(sql: sql, type: :plain).export
45
+ File.open("a4.csv", 'a'){ |f| PgCsv.new(sql: "select * from users").\
46
+ export(f, type: :stream) }
47
+ PgCsv.new(sql: sql).export('a5.csv', delimiter: "\t")
48
+ PgCsv.new(sql: sql).export('a6.csv', header: true)
49
+ PgCsv.new(sql: sql).export('a7.csv', columns: %w(id a b c))
50
+ PgCsv.new(sql: sql, connection: SomeDb.connection, columns: %w(id a b c), delimiter: "|").\
51
+ export('a8.gz', type: :gzip, temp_file: true)
51
52
 
52
53
  # example collect from shards
53
54
  Zlib::GzipWriter.open('some.gz') do |stream|
54
- e = PgCsv.new(:sql => sql, :type => :stream)
55
+ e = PgCsv.new(sql: sql, type: :stream)
55
56
  ConnectionPool.each_shard do |connection|
56
- e.export(stream, :connection => connection)
57
+ e.export(stream, connection: connection)
57
58
  end
58
59
  end
59
60
 
60
61
  # yield example
61
- PgCsv.new(:sql => sql, :type => :yield).export do |row|
62
+ PgCsv.new(sql: sql, type: :yield).export do |row|
62
63
  puts row
63
64
  end
64
65
  ```
@@ -1,3 +1,3 @@
1
1
  class PgCsv
2
- VERSION = "0.1.8"
2
+ VERSION = "0.3"
3
3
  end
data/lib/pg_csv.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'active_record'
1
+ require 'pg'
2
2
  require File.expand_path(File.join(File.dirname(__FILE__), 'pg_csv/version'))
3
3
 
4
4
  class PgCsv
@@ -6,13 +6,13 @@ class PgCsv
6
6
  module Base
7
7
 
8
8
  def initialize(opts = {})
9
- @options = opts.symbolize_keys
9
+ @options = opts
10
10
  end
11
11
 
12
12
  # do export :to - filename or stream
13
13
  def export(to = nil, opts = {}, &row_proc)
14
14
  @row_proc = row_proc
15
- @local_options = opts.symbolize_keys
15
+ @local_options = opts
16
16
 
17
17
  raise ":connection should be" unless connection
18
18
  raise ":sql should be" unless sql
@@ -97,7 +97,7 @@ class PgCsv
97
97
 
98
98
  def load_data
99
99
  info "#{query}"
100
- raw = connection.raw_connection
100
+ raw = connection.respond_to?(:raw_connection) ? connection.raw_connection : connection
101
101
  count = 0
102
102
 
103
103
  info "=> query"
@@ -133,7 +133,7 @@ class PgCsv
133
133
  ) TO STDOUT
134
134
  WITH CSV
135
135
  DELIMITER '#{delimiter}'
136
- #{use_pg_header? ? 'HEADER' : ''} #{encoding ? "ENCODING '#{encoding}'" : ''}
136
+ #{use_pg_header? ? 'HEADER' : ''} #{encoding ? "ENCODING '#{encoding}'" : ''} #{force_quote ? "FORCE QUOTE *" : ''}
137
137
  SQL
138
138
  end
139
139
 
@@ -193,6 +193,10 @@ class PgCsv
193
193
  def encoding
194
194
  o(:encoding)
195
195
  end
196
+
197
+ def force_quote
198
+ o(:force_quote)
199
+ end
196
200
  end
197
201
 
198
202
  include Base
data/pg_csv.gemspec CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.authors = ["Makarchev Konstantin"]
11
11
  s.email = ["kostya27@gmail.com"]
12
12
  s.homepage = "http://github.com/kostya/pg_csv"
13
- s.summary = "Fast AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective on millions rows."
14
- s.description = "Fast AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective on millions rows."
13
+ s.summary = "Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows."
14
+ s.description = "Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions rows."
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
  s.license = "MIT"
21
21
 
22
- s.add_dependency "pg", '~> 0.17'
23
- s.add_dependency "activerecord"
24
- s.add_development_dependency "rspec", '<3'
22
+ s.add_dependency "pg"
23
+ s.add_development_dependency "rspec"
25
24
  s.add_development_dependency "rake"
26
-
25
+ s.add_development_dependency "activerecord"
26
+ s.add_development_dependency "byebug"
27
27
  end
data/spec/pg_csv_spec.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.dirname(__FILE__) + '/spec_helper'
3
4
 
4
5
  describe PgCsv do
5
6
 
6
7
  before :each do
7
8
  Test.delete_all
8
- Test.create :a => 1, :b => 2, :c => 3
9
- Test.create :a => 4, :b => 5, :c => 6
9
+ Test.create a: 1, b: 2, c: 3
10
+ Test.create a: 4, b: 5, c: 6
10
11
 
11
12
  @name = tmp_dir + "1.csv"
12
13
  FileUtils.rm(@name) rescue nil
@@ -22,159 +23,173 @@ describe PgCsv do
22
23
  describe "simple export" do
23
24
 
24
25
  it "1" do
25
- PgCsv.new(:sql => @sql0).export(@name)
26
- with_file(@name){|d| d.should == "1,2,3\n4,5,6\n" }
26
+ PgCsv.new(sql: @sql0).export(@name)
27
+ with_file(@name){ |d| expect(d).to eq("1,2,3\n4,5,6\n")}
27
28
  end
28
29
 
29
30
  it "2" do
30
- PgCsv.new(:sql => @sql).export(@name)
31
- with_file(@name){|d| d.should == "4,5,6\n1,2,3\n" }
31
+ PgCsv.new(sql: @sql).export(@name)
32
+ with_file(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n") }
32
33
  end
33
34
 
34
35
  it "delimiter" do
35
- PgCsv.new(:sql => @sql).export(@name, :delimiter => "|")
36
- with_file(@name){|d| d.should == "4|5|6\n1|2|3\n" }
36
+ PgCsv.new(sql: @sql).export(@name, delimiter: "|")
37
+ with_file(@name){ |d| expect(d).to eq("4|5|6\n1|2|3\n") }
37
38
  end
38
39
 
39
40
  it "encoding" do
40
- Test.create! :a => 2, :b => 3, :c => 4, :d => "абсд"
41
+ Test.create!(a: 2, b: 3, c: 4, d: "абсд")
41
42
 
42
- PgCsv.new(:sql => "select d from tests where a = 2").export(@name, :encoding => "WIN1251")
43
- with_file(@name){|d| d.force_encoding('cp1251').should == "абсд\n".encode('cp1251') }
43
+ PgCsv.new(sql: "select d from tests where a = 2").export(@name, encoding: "WIN1251")
44
+ with_file(@name){ |d| expect(d.force_encoding('cp1251')).to eq("абсд\n".encode('cp1251')) }
44
45
  end
45
46
 
46
47
  describe "headers" do
47
48
  it "header" do
48
- PgCsv.new(:sql => @sql).export(@name, :header => true)
49
- with_file(@name){|d| d.should == "a,b,c\n4,5,6\n1,2,3\n" }
49
+ PgCsv.new(sql: @sql).export(@name, header: true)
50
+ with_file(@name){ |d| expect(d).to eq("a,b,c\n4,5,6\n1,2,3\n") }
50
51
  end
51
52
 
52
53
  it "columns" do
53
- PgCsv.new(:sql => @sql).export(@name, :columns => %w(q w e))
54
- with_file(@name){|d| d.should == "q,w,e\n4,5,6\n1,2,3\n" }
54
+ PgCsv.new(sql: @sql).export(@name, columns: %w(q w e))
55
+ with_file(@name){ |d| expect(d).to eq("q,w,e\n4,5,6\n1,2,3\n") }
55
56
  end
56
57
 
57
58
  it "columns with header" do
58
- PgCsv.new(:sql => @sql).export(@name, :header => true, :columns => %w(q w e))
59
+ PgCsv.new(sql: @sql).export(@name, header: true, columns: %w(q w e))
59
60
 
60
61
  with_file(@name) do |d|
61
- d.should == "q,w,e\n4,5,6\n1,2,3\n"
62
+ expect(d).to eq("q,w,e\n4,5,6\n1,2,3\n")
62
63
  end
63
64
  end
64
65
  end
65
66
 
67
+ describe "force_quote" do
68
+ it "force_quote" do
69
+ PgCsv.new(sql: @sql).export(@name, force_quote: true)
70
+ with_file(@name){ |d| expect(d).to eq("\"4\",\"5\",\"6\"\n\"1\",\"2\",\"3\"\n") }
71
+ end
72
+
73
+ it "with headers" do
74
+ PgCsv.new(sql: @sql).export(@name, header: true, force_quote: true)
75
+ with_file(@name){ |d| expect(d).to eq("a,b,c\n\"4\",\"5\",\"6\"\n\"1\",\"2\",\"3\"\n") }
76
+ end
77
+ end
66
78
  end
67
79
 
68
80
  describe "moving options no matter" do
69
81
  it "1" do
70
- PgCsv.new(:sql => @sql).export(@name, :delimiter => "|")
71
- with_file(@name){|d| d.should == "4|5|6\n1|2|3\n" }
82
+ PgCsv.new(sql: @sql).export(@name, delimiter: "|")
83
+ with_file(@name){ |d| expect(d).to eq("4|5|6\n1|2|3\n") }
72
84
  end
73
85
 
74
86
  it "2" do
75
- PgCsv.new(:delimiter => "|").export(@name, :sql => @sql)
76
- with_file(@name){|d| d.should == "4|5|6\n1|2|3\n"}
87
+ PgCsv.new(delimiter: "|").export(@name, sql: @sql)
88
+ with_file(@name){ |d| expect(d).to eq("4|5|6\n1|2|3\n") }
77
89
  end
78
90
  end
79
91
 
80
92
  describe "local options dont recover global" do
81
93
  it "test" do
82
- e = PgCsv.new(:sql => @sql, :delimiter => "*")
83
- e.export(@name, :delimiter => "|")
84
- with_file(@name){|d| d.should == "4|5|6\n1|2|3\n" }
94
+ e = PgCsv.new(sql: @sql, delimiter: "*")
95
+ e.export(@name, delimiter: "|")
96
+ with_file(@name){ |d| expect(d).to eq("4|5|6\n1|2|3\n") }
85
97
 
86
98
  e.export(@name)
87
- with_file(@name){|d| d.should == "4*5*6\n1*2*3\n" }
99
+ with_file(@name){ |d| expect(d).to eq("4*5*6\n1*2*3\n") }
88
100
  end
89
101
  end
90
102
 
91
103
  describe "using temp file" do
92
104
  it "at least file should return to target and set correct chmod" do
93
- File.exists?(@name).should == false
94
- PgCsv.new(:sql => @sql, :temp_file => true, :temp_dir => tmp_dir).export(@name)
95
- with_file(@name){|d| d.should == "4,5,6\n1,2,3\n" }
96
- sprintf("%o", File.stat(@name).mode).to_i.should >= 100660
105
+ expect(File).not_to exist(@name)
106
+ PgCsv.new(sql: @sql, temp_file: true, temp_dir: tmp_dir).export(@name)
107
+ with_file(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n") }
108
+ expect(sprintf("%o", File.stat(@name).mode).to_i).to eq(100644)
97
109
  end
98
110
 
99
111
  it "same with gzip" do
100
- File.exists?(@name).should == false
101
- PgCsv.new(:sql => @sql, :temp_file => true, :temp_dir => tmp_dir, :type => :gzip).export(@name)
102
- with_gzfile(@name){|d| d.should == "4,5,6\n1,2,3\n" }
103
- sprintf("%o", File.stat(@name).mode).to_i.should >= 100660
112
+ expect(File).not_to exist(@name)
113
+ PgCsv.new(sql: @sql, temp_file: true, temp_dir: tmp_dir, type: :gzip).export(@name)
114
+ with_gzfile(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n") }
115
+ expect(sprintf("%o", File.stat(@name).mode).to_i).to eq(100644)
104
116
  end
105
117
  end
106
118
 
107
119
  describe "different types of export" do
108
120
  it "gzip export" do
109
- File.exists?(@name).should == false
110
- PgCsv.new(:sql => @sql, :type => :gzip).export(@name)
111
- with_gzfile(@name){|d| d.should == "4,5,6\n1,2,3\n" }
112
- sprintf("%o", File.stat(@name).mode).to_i.should >= 100660
121
+ expect(File).not_to exist(@name)
122
+ PgCsv.new(sql: @sql, type: :gzip).export(@name)
123
+ with_gzfile(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n") }
124
+ expect(sprintf("%o", File.stat(@name).mode).to_i).to eq(100644)
113
125
  end
114
126
 
115
127
  it "plain export" do
116
- PgCsv.new(:sql => @sql, :type => :plain).export.should == "4,5,6\n1,2,3\n"
128
+ expect(PgCsv.new(sql: @sql, type: :plain).export).to eq("4,5,6\n1,2,3\n")
117
129
  end
118
130
 
119
131
  it "custom stream" do
120
- ex = PgCsv.new(:sql => @sql, :type => :stream)
132
+ ex = PgCsv.new(sql: @sql, type: :stream)
121
133
  File.open(@name, 'w') do |stream|
122
134
  ex.export(stream)
123
- ex.export(stream, :sql => @sql0)
135
+ ex.export(stream, sql: @sql0)
124
136
  end
125
137
 
126
- with_file(@name){|d| d.should == "4,5,6\n1,2,3\n1,2,3\n4,5,6\n" }
138
+ with_file(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n1,2,3\n4,5,6\n") }
127
139
  end
128
140
 
129
141
  it "file as default" do
130
- PgCsv.new(:sql => @sql, :type => :file).export(@name)
131
- with_file(@name){|d| d.should == "4,5,6\n1,2,3\n" }
132
- sprintf("%o", File.stat(@name).mode).to_i.should >= 100660
142
+ PgCsv.new(sql: @sql, type: :file).export(@name)
143
+ with_file(@name){ |d| expect(d).to eq("4,5,6\n1,2,3\n") }
144
+ expect(sprintf("%o", File.stat(@name).mode).to_i).to eq(100644)
133
145
  end
134
146
 
135
147
  it "yield export" do
136
148
  rows = []
137
- PgCsv.new(:sql => @sql, :type => :yield).export do |row|
138
- rows << row
139
- end.should == 2
149
+ expect(
150
+ PgCsv.new(sql: @sql, type: :yield).export { |row| rows << row }
151
+ ).to eq(2)
140
152
 
141
- rows.should == ["4,5,6\n", "1,2,3\n"]
153
+ expect(rows).to eq(["4,5,6\n", "1,2,3\n"])
142
154
  end
143
155
  end
144
156
 
145
157
  describe "integration specs" do
146
158
  it "1" do
147
- File.exists?(@name).should == false
148
- PgCsv.new(:sql => @sql, :type => :gzip).export(@name, :delimiter => "|", :columns => %w{q w e}, :temp_file => true, :temp_dir => tmp_dir)
149
- with_gzfile(@name){|d| d.should == "q|w|e\n4|5|6\n1|2|3\n" }
159
+ expect(File).not_to exist(@name)
160
+ PgCsv.new(sql: @sql, type: :gzip).export(
161
+ @name, delimiter: "|", columns: %w(q w e), temp_file: true, temp_dir: tmp_dir
162
+ )
163
+ with_gzfile(@name){ |d| expect(d).to eq("q|w|e\n4|5|6\n1|2|3\n") }
150
164
  end
151
165
 
152
166
  it "2" do
153
167
  Zlib::GzipWriter.open(@name) do |gz|
154
- e = PgCsv.new(:sql => @sql, :type => :stream)
168
+ e = PgCsv.new(sql: @sql, type: :stream)
155
169
 
156
- e.export(gz, :delimiter => "|", :columns => %w{q w e} )
157
- e.export(gz, :delimiter => "*", :sql => @sql0)
170
+ e.export(gz, delimiter: "|", columns: %w(q w e) )
171
+ e.export(gz, delimiter: "*", sql: @sql0)
158
172
  end
159
173
 
160
- with_gzfile(@name){|d| d.should == "q|w|e\n4|5|6\n1|2|3\n1*2*3\n4*5*6\n" }
174
+ with_gzfile(@name){ |d| expect(d).to eq("q|w|e\n4|5|6\n1|2|3\n1*2*3\n4*5*6\n") }
161
175
  end
162
176
 
163
177
  it "gzip with empty content" do
164
- File.exists?(@name).should == false
165
- PgCsv.new(:sql => "select a,b,c from tests where a = -1", :type => :gzip).export(@name, :temp_file => true, :temp_dir => tmp_dir)
166
- with_gzfile(@name){|d| d.should == "" }
178
+ expect(File).not_to exist(@name)
179
+ PgCsv.new(sql: "select a,b,c from tests where a = -1", type: :gzip).export(
180
+ @name, temp_file: true, temp_dir: tmp_dir
181
+ )
182
+ with_gzfile(@name){ |d| expect(d).to be_empty }
167
183
  end
168
184
  end
169
185
 
170
186
  it "custom row proc" do
171
- e = PgCsv.new(:sql => @sql)
187
+ e = PgCsv.new(sql: @sql)
172
188
 
173
189
  e.export(@name) do |row|
174
190
  row.split(",").join("-|-")
175
191
  end
176
192
 
177
- with_file(@name){|d| d.should == "4-|-5-|-6\n1-|-2-|-3\n" }
193
+ with_file(@name){ |d| expect(d).to eq("4-|-5-|-6\n1-|-2-|-3\n") }
178
194
  end
179
-
180
195
  end
data/spec/spec_support.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'fileutils'
2
+ require 'active_record'
2
3
 
3
- conn = {'adapter' => 'postgresql', 'database' => 'pgcsv_test', :encoding => "unicode"}
4
+ conn = {
5
+ adapter: 'postgresql',
6
+ database: 'pgcsv_test',
7
+ encoding: "unicode"
8
+ }
4
9
  ActiveRecord::Base.establish_connection conn
5
10
 
6
11
  class Test < ActiveRecord::Base
@@ -28,7 +33,7 @@ def tmp_dir
28
33
  end
29
34
 
30
35
  def with_file(name)
31
- File.exists?(name).should == true
36
+ expect(File).to exist(name)
32
37
  q = 1
33
38
  File.open(name) do |file|
34
39
  data = file.read
@@ -36,16 +41,17 @@ def with_file(name)
36
41
  q = 2
37
42
  end
38
43
 
39
- q.should == 2
44
+ expect(q).to eq(2)
40
45
  end
41
46
 
42
47
  def with_gzfile(name)
43
- File.exist?(name).should == true
48
+ expect(File).to exist(name)
44
49
  q = 1
45
50
  Zlib::GzipReader.open(name) do |gz|
46
51
  data = gz.read
47
52
  yield data
48
53
  q = 2
49
54
  end
50
- q.should == 2
55
+
56
+ expect(q).to eq(2)
51
57
  end
metadata CHANGED
@@ -1,37 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makarchev Konstantin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.17'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activerecord
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :runtime
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -39,21 +39,35 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "<"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "<"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: activerecord
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -66,8 +80,8 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
- description: Fast AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective
70
- on millions rows.
83
+ description: Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on
84
+ millions rows.
71
85
  email:
72
86
  - kostya27@gmail.com
73
87
  executables: []
@@ -107,10 +121,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
121
  - !ruby/object:Gem::Version
108
122
  version: '0'
109
123
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.2.2
124
+ rubygems_version: 3.1.2
112
125
  signing_key:
113
126
  specification_version: 4
114
- summary: Fast AR/PostgreSQL csv export. Used pg function 'copy to csv'. Effective
115
- on millions rows.
127
+ summary: Fast Ruby PG csv export. Uses pg function 'copy to csv'. Effective on millions
128
+ rows.
116
129
  test_files: []