prodder 1.7.6 → 1.7.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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -10
- data/features/commit.feature +3 -3
- data/features/dump.feature +7 -7
- data/features/support/prodder__blog_prod.sql +1 -0
- data/lib/prodder/pg.rb +1 -3
- data/lib/prodder/prodder.rake +2 -1
- data/lib/prodder/project.rb +1 -4
- data/lib/prodder/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837adeb9529887b429bbe128bbb9162f29d0ca5001fbd94b28aba2aa105caacb
|
4
|
+
data.tar.gz: e3b410b12794de3b1a04d55adad8ac789c83658526c4a749b8494878381c7e0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5982600241c08dc3c623c8c1e6153cfbd10bd6c20f3fa3074f4cf45335f6fd091c58e31e2e26da624c956b6624458ce21ce117568b933ec72aab8f2f30d295d
|
7
|
+
data.tar.gz: 697799d716ab1bd9a7fbc19b3a346681621ffd8cf3b732ee2eed41acb86b7626fb0eb16f239a307c62c797f890a1cfc9c8e2d6db367fb1542ed174ca14512aee
|
data/.travis.yml
CHANGED
@@ -2,24 +2,20 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
|
4
4
|
rvm:
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.2.8
|
5
|
+
- 2.5.8
|
6
|
+
- 2.7.2
|
8
7
|
|
9
8
|
env:
|
10
9
|
matrix:
|
11
|
-
- PG_VERSION=
|
12
|
-
- PG_VERSION=9.4
|
13
|
-
- PG_VERSION=9.5
|
10
|
+
- PG_VERSION=11
|
14
11
|
|
15
12
|
before_install:
|
16
13
|
- git config --global user.name "Prodder In Travis-CI"
|
17
14
|
- git config --global user.email "prodder@example.com"
|
18
|
-
# install
|
19
|
-
-
|
20
|
-
# setup travis user
|
21
|
-
- if [[ "$PG_VERSION" = "9.5" ]]; then echo "setting up users for pg9.5"; PGUSER=postgres createuser --superuser travis || echo role travis already exists.; fi
|
15
|
+
# install postgres
|
16
|
+
- sudo apt-get install postgresql-client-$PG_VERSION postgresql-server-dev-$PG_VERSION
|
22
17
|
# setup pg_dump
|
18
|
+
- ls -al /usr/lib/postgresql/
|
23
19
|
- sudo ln -sfn /usr/lib/postgresql/$PG_VERSION/bin/pg_dump /usr/bin/pg_dump
|
24
20
|
# start up the specific version of PG
|
25
21
|
- sudo -E sh -c 'service postgresql stop'
|
data/features/commit.feature
CHANGED
@@ -29,7 +29,7 @@ Feature: Commiting updated dumps to a project's repository
|
|
29
29
|
And I run `prodder dump -c prodder.yml`
|
30
30
|
And I run `prodder commit -c prodder.yml`
|
31
31
|
And 2 commits by "prodder auto-commit" should be in the "blog" repository
|
32
|
-
And the latest commit should have changed "db/structure.sql" to contain "CREATE TABLE linkbacks"
|
32
|
+
And the latest commit should have changed "db/structure.sql" to contain "CREATE TABLE public.linkbacks"
|
33
33
|
And the latest commit should not have changed "db/seeds.sql"
|
34
34
|
And the latest commit should not have changed "db/quality_checks.sql"
|
35
35
|
|
@@ -52,7 +52,7 @@ Feature: Commiting updated dumps to a project's repository
|
|
52
52
|
And I run `prodder dump -c prodder.yml`
|
53
53
|
And I run `prodder commit -c prodder.yml`
|
54
54
|
Then 2 commits by "prodder auto-commit" should be in the "blog" repository
|
55
|
-
And the latest commit should have changed "db/structure.sql" to contain "CREATE TABLE captchas"
|
55
|
+
And the latest commit should have changed "db/structure.sql" to contain "CREATE TABLE public.captchas"
|
56
56
|
And the latest commit should have changed "db/seeds.sql" to contain "Bob McBobbington"
|
57
57
|
And the latest commit should not have changed "db/quality_checks.sql"
|
58
58
|
|
@@ -64,6 +64,6 @@ Feature: Commiting updated dumps to a project's repository
|
|
64
64
|
And I run `prodder dump -c prodder.yml`
|
65
65
|
And I run `prodder commit -c prodder.yml`
|
66
66
|
And 2 commits by "prodder auto-commit" should be in the "blog" repository
|
67
|
-
And the latest commit should have changed "db/permissions.sql" to contain "GRANT ALL ON TABLE gotchas TO prodder"
|
67
|
+
And the latest commit should have changed "db/permissions.sql" to contain "GRANT ALL ON TABLE public.gotchas TO prodder"
|
68
68
|
And the latest commit should not have changed "db/seeds.sql"
|
69
69
|
And the latest commit should not have changed "db/quality_checks.sql"
|
data/features/dump.feature
CHANGED
@@ -6,11 +6,10 @@ Feature: prodder dump
|
|
6
6
|
Scenario: Happy path: dump structure.sql, listed seed tables, quality_checks.sql, permissions.sql and settings.sql
|
7
7
|
When I run `prodder dump -c prodder.yml`
|
8
8
|
Then the exit status should be 0
|
9
|
-
And the workspace file "blog/db/structure.sql" should match /CREATE TABLE posts/
|
10
|
-
And the workspace file "blog/db/structure.sql" should match /CREATE TABLE authors/
|
11
|
-
And the workspace file "blog/db/seeds.sql" should match /COPY posts/
|
12
|
-
And the workspace file "blog/db/seeds.sql" should match /COPY authors/
|
13
|
-
And the workspace file "blog/db/quality_checks.sql" should match /SET search_path/
|
9
|
+
And the workspace file "blog/db/structure.sql" should match /CREATE TABLE public.posts/
|
10
|
+
And the workspace file "blog/db/structure.sql" should match /CREATE TABLE public.authors/
|
11
|
+
And the workspace file "blog/db/seeds.sql" should match /COPY public.posts/
|
12
|
+
And the workspace file "blog/db/seeds.sql" should match /COPY public.authors/
|
14
13
|
And the workspace file "blog/db/quality_checks.sql" should match /CREATE TRIGGER /
|
15
14
|
And the workspace file "blog/db/permissions.sql" should match /GRANT /
|
16
15
|
And the workspace file "blog/db/settings.sql" should match /ALTER DATABASE /
|
@@ -123,6 +122,7 @@ Feature: prodder dump
|
|
123
122
|
Given I add a custom parameter "c.p" with value "v" in the "blog" project's database
|
124
123
|
When I run `prodder dump -c prodder.yml`
|
125
124
|
Then the workspace file "blog/db/settings.sql" should match /ALTER DATABASE :DBNAME SET c.p=v;/
|
125
|
+
And the workspace file "blog/db/settings.sql" should match /ALTER DATABASE :DBNAME SET search_path=foo,bar,public;/
|
126
126
|
|
127
127
|
Scenario: Verify empty db setting is quoted
|
128
128
|
Given I add a custom parameter "empty.setting" with value "" in the "blog" project's database
|
@@ -184,8 +184,8 @@ Feature: prodder dump
|
|
184
184
|
"""
|
185
185
|
When I run `prodder dump -c prodder.yml`
|
186
186
|
Then the exit status should be 0
|
187
|
-
And the workspace file "blog/db/seeds.sql" should match /COPY posts/
|
188
|
-
But the workspace file "blog/db/seeds.sql" should not match /COPY authors/
|
187
|
+
And the workspace file "blog/db/seeds.sql" should match /COPY public.posts/
|
188
|
+
But the workspace file "blog/db/seeds.sql" should not match /COPY public.authors/
|
189
189
|
|
190
190
|
Scenario: YAML file listing seed tables does not exist
|
191
191
|
Given the prodder config in "prodder.yml" says to read the "blog" seed tables from "db/seeds.yml"
|
data/lib/prodder/pg.rb
CHANGED
@@ -125,7 +125,6 @@ module Prodder
|
|
125
125
|
ACL_REVOKE = /^REVOKE /
|
126
126
|
DEFAULT_PRIVILEGES = /^ALTER DEFAULT PRIVILEGES /
|
127
127
|
SET_OBJECT_OWNERSHIP = /.* OWNER TO /
|
128
|
-
SEARCH_PATH = /SET search_path = .*/
|
129
128
|
|
130
129
|
def dump_db_access_control(db_name, user_list, options)
|
131
130
|
perm_out_sql = ""
|
@@ -153,8 +152,7 @@ module Prodder
|
|
153
152
|
if line.match(ACL_GRANT) ||
|
154
153
|
line.match(ACL_REVOKE) ||
|
155
154
|
line.match(DEFAULT_PRIVILEGES) ||
|
156
|
-
line.match(SET_OBJECT_OWNERSHIP)
|
157
|
-
line.match(SEARCH_PATH)
|
155
|
+
line.match(SET_OBJECT_OWNERSHIP)
|
158
156
|
|
159
157
|
unless irrelevant_login_roles.include?(line.match(/ (\S*);$/)[1])
|
160
158
|
perm_out_sql << line
|
data/lib/prodder/prodder.rake
CHANGED
@@ -362,7 +362,8 @@ namespace :db do
|
|
362
362
|
|
363
363
|
def as(user, opts = {}, &block)
|
364
364
|
if File.exist?('db/permissions.sql')
|
365
|
-
|
365
|
+
# `ActiveRecord::Base.configurations` in Rails 6 now returns an object instead of a hash
|
366
|
+
config, config_was = ActiveRecord::Base.configurations.deep_dup.to_h, ActiveRecord::Base.configurations.deep_dup
|
366
367
|
in_env = Array(opts[:in]) || config.keys
|
367
368
|
if config.all? { |env, config_hash| in_env.include?(env) ? config_hash[user] : true }
|
368
369
|
disconnect
|
data/lib/prodder/project.rb
CHANGED
@@ -45,11 +45,8 @@ module Prodder
|
|
45
45
|
contents = File.readlines(structure_file_name)
|
46
46
|
rgx = /^\-\- .* Type: INDEX; |^\-\- .* Type: TRIGGER; |^\-\- .* Type: FK CONSTRAINT; /
|
47
47
|
structure, *quality = contents.slice_before(rgx).to_a
|
48
|
-
# the first search path setting for constraints gets left over
|
49
|
-
# in the structure, so we need to *attempt* to grab that
|
50
|
-
quality_checks = (structure.grep(/SET search_path/).last || '') + quality.join
|
51
48
|
|
52
|
-
File.open(quality_check_file_name, 'w') { |f| f.write(
|
49
|
+
File.open(quality_check_file_name, 'w') { |f| f.write(quality.join) }
|
53
50
|
File.open(structure_file_name, 'w') { |f| f.write(structure.join) }
|
54
51
|
end
|
55
52
|
|
data/lib/prodder/version.rb
CHANGED
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Hargraves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deject
|
@@ -81,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
85
|
-
rubygems_version: 2.7.7
|
84
|
+
rubygems_version: 3.0.8
|
86
85
|
signing_key:
|
87
86
|
specification_version: 4
|
88
87
|
summary: Maintain your Rails apps' structure, seed and quality_checks files using
|