database_operations 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/database_operations.gemspec +1 -1
- data/lib/database_operations.rb +5 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/database_operations.gemspec
CHANGED
data/lib/database_operations.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'open3'
|
2
2
|
require 'tempfile'
|
3
3
|
class DatabaseOperations
|
4
|
-
def self.pg(cfg, cmd)
|
4
|
+
def self.pg(cfg, cmd, opts = {})
|
5
5
|
ENV['PGPASSWORD'] = cfg["password"]
|
6
6
|
|
7
7
|
args = []
|
@@ -10,7 +10,9 @@ class DatabaseOperations
|
|
10
10
|
args << %{-p "#{cfg["port"]}"} if cfg["port"]
|
11
11
|
args << %{-w}
|
12
12
|
|
13
|
-
|
13
|
+
pipe = opts[:pipe] ? " | #{opts[:pipe]}" : ""
|
14
|
+
|
15
|
+
%x{#{cmd} #{args.join(' ')} "#{cfg['database']}"#{pipe}}
|
14
16
|
ensure
|
15
17
|
ENV.delete('PGPASSWORD')
|
16
18
|
end
|
@@ -33,7 +35,7 @@ class DatabaseOperations
|
|
33
35
|
|
34
36
|
File.open(Rails.root.join(file), "w") { |f|
|
35
37
|
f.puts "begin;"
|
36
|
-
f.write pg(cfg, %{pg_dump -s})
|
38
|
+
f.write pg(cfg, %{pg_dump -s}, :pipe => %{perl -ne 'print unless /COPY.*spatial_ref_sys/ .. /\\x5c\\x2e/'})
|
37
39
|
f.write pg(cfg, %{pg_dump -a -t schema_migrations})
|
38
40
|
f.puts "commit;"
|
39
41
|
}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_operations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Renewable Funding, LLC
|