database_operations 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.7
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "database_operations"
8
- s.version = "0.0.5"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Renewable Funding, LLC"]
@@ -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
- %x{#{cmd} #{args.join(' ')} "#{cfg['database']}"}
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: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Renewable Funding, LLC