prodder 1.7 → 1.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d5918237e7d482b189ba2649512fcd4d94254e3
4
- data.tar.gz: d717694eea4567462ce9e2b83ee0b3d4e165a085
3
+ metadata.gz: 7f6f4835acc6e6921b002818c3cb4f9dde1547b5
4
+ data.tar.gz: 8b8710f6358a343ec57afa2629c60c48aee99ca7
5
5
  SHA512:
6
- metadata.gz: 389fc841cfcfc4edb3d1605d947f391a61bd069d0f3b36957b61b9a9e53f6671580206d6827307758d43068b6ecc455c3ed672a828455803d29dc7fd5b91fd03
7
- data.tar.gz: 2e521a6654a9092c5eff82ef840322e837e8f4379c3d2faf7ecaa8cd4061d679c52a0817b41b719e7af048f130f3d5edcd1a3f5141a1195beddaddeb37eba9dd
6
+ metadata.gz: 7dda8578941499f02a56e411914ede00f636e4287194f7cc7b0dff4f668577ace27e5b8b8242d9c4360198bca23fe80be5ea9b039029ae16eacb3d6b08942dfa
7
+ data.tar.gz: 67d62816e83f9a0001e48886b46b7bb5fcdf597eff76fa3a9b8a7e36548e1018553aaa55df859c231b8c41bf4f89497f8ea554b4e6682e137bb26be17607b290
@@ -120,9 +120,14 @@ Feature: prodder dump
120
120
  And the workspace file "blog/db/structure.sql" should not match /CREATE TABLE authors/
121
121
 
122
122
  Scenario: Verify settings file contents
123
- Given I add a customer parameter "c.p" with value "v" in the "blog" project's database
123
+ Given I add a custom parameter "c.p" with value "v" in the "blog" project's database
124
124
  When I run `prodder dump -c prodder.yml`
125
- Then the workspace file "blog/db/settings.sql" should match /ALTER DATABASE prodder__blog_prod SET c.p=v/
125
+ Then the workspace file "blog/db/settings.sql" should match /ALTER DATABASE :DBNAME SET c.p=v;/
126
+
127
+ Scenario: Verify empty db setting is quoted
128
+ Given I add a custom parameter "empty.setting" with value "" in the "blog" project's database
129
+ When I run `prodder dump -c prodder.yml`
130
+ Then the workspace file "blog/db/settings.sql" should match /ALTER DATABASE :DBNAME SET empty.setting='';/
126
131
 
127
132
  Scenario: Exclude specified schemas from structure dump
128
133
  Given the prodder config in "prodder.yml" excludes the schema "ads" from the dump of "blog"
@@ -13,8 +13,8 @@ Given 'I add an index to table "$table" on column "$column" in the "$project" pr
13
13
  Prodder::PG.new.psql "prodder__#{project}_prod", "CREATE INDEX test_index ON #{table} (#{column});"
14
14
  end
15
15
 
16
- Given 'I add a customer parameter "$parameter" with value "$value" in the "$project" project\'s database' do |parameter, value, project|
17
- Prodder::PG.new.psql "prodder__#{project}_prod", "ALTER DATABASE prodder__#{project}_prod SET #{parameter} = #{value};"
16
+ Given 'I add a custom parameter "$parameter" with value "$value" in the "$project" project\'s database' do |parameter, value, project|
17
+ Prodder::PG.new.psql "prodder__#{project}_prod", "ALTER DATABASE prodder__#{project}_prod SET #{parameter} = '#{value}';"
18
18
  end
19
19
 
20
20
  Given 'I add a foreign key from table "$table1" and column "$column1" to table "$table2" and column "$column2" in the "$project" project\'s database' do |table1, column1, table2, column2, project|
data/lib/prodder/pg.rb CHANGED
@@ -52,6 +52,8 @@ module Prodder
52
52
  SQL
53
53
 
54
54
  arguments = [
55
+ '--host', credentials['host'],
56
+ '--username', credentials['user'],
55
57
  '-t',
56
58
  '-c', sql
57
59
  ]
@@ -60,7 +62,12 @@ module Prodder
60
62
  raise PGDumpError.new(err) if !success
61
63
  File.open(filename, 'w') do |f|
62
64
  out.each_line do |setting|
63
- f.write "ALTER DATABASE #{db_name} SET #{setting}" unless setting.gsub(/\s+/, '').empty?
65
+ unless setting.gsub(/\s+/, '').empty?
66
+ setting.chomp!
67
+ setting += "''" if setting.match /.*=$/
68
+ # using the magic of psql variables through :DBNAME
69
+ f.puts "ALTER DATABASE :DBNAME SET #{setting};"
70
+ end
64
71
  end
65
72
  end
66
73
  end
@@ -1,3 +1,3 @@
1
1
  module Prodder
2
- VERSION = "1.7"
2
+ VERSION = "1.7.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prodder
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.7'
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Hargraves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deject