prodder 1.8.1 → 1.8.3

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
  SHA256:
3
- metadata.gz: 5e8921f51e1bb936a99eaccc98d04bcd34ff72acbe20cb5547f6e680f8e4106a
4
- data.tar.gz: 0e47795334cfcd4944d877dd5c24ab72e4fa5b082d66400b5c0a318228ba0f5d
3
+ metadata.gz: 7709fb16a2203aee7eee5e75771b3439c5d086490e74fb8be8f5327eb21540ce
4
+ data.tar.gz: a9d397b82cfb40165459ee7a02b221a1cbc43a50e7ad70d6787b0057f61221b6
5
5
  SHA512:
6
- metadata.gz: 12817961230a0fd95776ff3bdf4a95b62fb8b961bbf2db9d93413f8cf93c32a9f11c4e036ffd89b0e4e5c0807ef40cf5d342706b0cd7a1f214c1f9c3a840547b
7
- data.tar.gz: 34c918bd1587a1c055ffd76866028a5cd7e7c371c42cec0381e01294af4f308b5478d59f2406a8d5dea73755e5c16cb0d33b2b206e8a450448cceca6b5a2b748
6
+ metadata.gz: 31168254cb004ace7e020bfd8957b4e6a6a8d50432706b6eef7f1ab32bfaa6d85912fecb855129fc03dacab34175986d05e45ed8a26d00773715ce4f47f2f7b9
7
+ data.tar.gz: 863da359bccf237b5479a6bca29446751841d96469ec68040a10722390ab88d33430b49035f8bcda18baef85981522fdffd8a1307724a87bd027d40d20b8127b
data/.dockerignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ tmp
@@ -14,42 +14,54 @@ jobs:
14
14
  test:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
+ fail-fast: false
17
18
  matrix:
18
19
  ruby-version: [2.6, 2.7, 3.0]
19
20
  services:
20
21
  postgres:
21
- image: postgres:12.1-alpine
22
+ image: postgres:13-alpine
22
23
  ports:
23
24
  - 5432:5432
24
25
  env:
25
26
  POSTGRES_USER: postgres
26
27
  POSTGRES_PASSWORD: postgres
27
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28
+ POSTGRES_HOST_AUTH_METHOD: trust
29
+ options: >-
30
+ --health-cmd pg_isready
31
+ --health-interval 10s
32
+ --health-timeout 5s
33
+ --health-retries 5
28
34
  steps:
29
35
  - name: Checkout Project
30
- uses: actions/checkout@v3
31
-
36
+ uses: actions/checkout@v4
32
37
  - name: Set up Ruby
33
38
  uses: ruby/setup-ruby@v1
34
39
  with:
35
40
  ruby-version: ${{ matrix.ruby-version }}
36
41
  bundler-cache: true
37
-
38
42
  - name: Install Library Dependencies
39
- run: sudo apt-get install libpq-dev
40
-
43
+ run: sudo apt update && sudo apt install -y postgresql-client
41
44
  - name: Setup Database
42
45
  run: |
43
- cp config/database.yml.github-actions config/database.yml
44
- env:
45
- RAILS_ENV: test
46
- POSTGRES_USER: postgres
47
- POSTGRES_PASSWORD: postgres
48
-
46
+ mkdir -p config
47
+ cat <<EOF > config/database.yml
48
+ test:
49
+ adapter: postgresql
50
+ encoding: unicode
51
+ pool: 20
52
+ database: prodder_test
53
+ EOF
49
54
  - name: Test with RSpec
50
55
  env:
51
- RAILS_ENV: "test"
52
- POSTGRES_USER: postgres
53
- POSTGRES_PASSWORD: postgres
54
- run: |
55
- bundle exec rspec
56
+ PGHOST: localhost
57
+ PGPORT: 5432
58
+ PGUSER: postgres
59
+ PGPASSWORD: postgres
60
+ run: bundle exec rspec
61
+ # - name: Test with Cucumber
62
+ # env:
63
+ # PGHOST: localhost
64
+ # PGPORT: 5432
65
+ # PGUSER: postgres
66
+ # PGPASSWORD: postgres
67
+ # run: bundle exec cucumber
data/.gitignore CHANGED
@@ -1,23 +1,3 @@
1
1
  Gemfile.lock
2
- *.gem
3
- *.rbc
4
- .bundle
5
- .config
6
- coverage
7
- InstalledFiles
8
- lib/bundler/man
9
- pkg
10
- rdoc
11
- spec/reports
12
- test/tmp
13
- test/version_tmp
14
2
  tmp
15
-
16
- # YARD artifacts
17
- .yardoc
18
- _yardoc
19
- doc/
20
-
21
- nc.yml
22
- prodder-workspace/
23
- features/support/blog.git
3
+ prodder-*
data/Dockerfile ADDED
@@ -0,0 +1,23 @@
1
+ ARG RUBY_VERSION=3.0
2
+
3
+ FROM ruby:${RUBY_VERSION}
4
+
5
+ WORKDIR /app
6
+
7
+ RUN apt update && \
8
+ apt install -y git postgresql-client && \
9
+ apt clean && \
10
+ rm -rf /var/lib/apt/lists/*
11
+
12
+ ENV BUNDLER_VERSION 2.4.22
13
+
14
+ RUN gem install bundler -v $BUNDLER_VERSION
15
+
16
+ COPY Gemfile ./
17
+
18
+ RUN bundle install -j $(nproc)
19
+
20
+ COPY . .
21
+
22
+ ENTRYPOINT ["entrypoints/entry.sh"]
23
+ CMD ["bin/prodder"]
data/LICENSE.txt CHANGED
@@ -1,6 +1,4 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Enova
1
+ Copyright (c) 2025 Enova International
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
7
  copies of the Software, and to permit persons to whom the Software is
10
8
  furnished to do so, subject to the following conditions:
11
9
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
14
12
 
15
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
- prodder [![Build Status](https://travis-ci.org/enova/prodder.svg?branch=master)](https://travis-ci.org/enova/prodder)
3
- =======
2
+ # Prodder
4
3
 
5
4
  A tool to maintain and load your Rails application's database structure, seed
6
5
  table contents, permissions and database settings based on its migration history
@@ -29,6 +28,7 @@ prior to enforcing foreign key constraints and if you want to develop in an envi
29
28
  with the same permissions setup as production.
30
29
 
31
30
  ### Installation
31
+
32
32
  In your Gemfile:
33
33
 
34
34
  ```ruby
@@ -74,6 +74,7 @@ bundle exec rake db:reset db:migrate
74
74
  ```
75
75
 
76
76
  ### Usage
77
+
77
78
  Things that really matter:
78
79
 
79
80
  1. `rake db:reset` recreates your database, loading `db/structure.sql`, `db/seeds.sql`,
@@ -82,7 +83,7 @@ Things that really matter:
82
83
  created. Those initial seeds should have included your production app's `schema_migrations`
83
84
  table contents. This means only those migrations that have not yet run in production
84
85
  will need to be run locally.
85
- 3. If you configred to have 3 users in your `#config/database.yml` file and have a `permissions.sql` file present,
86
+ 3. If you configured to have 3 users in your `#config/database.yml` file and have a `permissions.sql` file present,
86
87
  all your `db:*` commands will be run in the context of the user it makes the most sense to run as, mimicking
87
88
  our production environment. For instance(s), to reset the database (god forbid we do this in production), it will
88
89
  run as `superuser`, to run a migration, as the `migration_user` and your application will connect to the database
@@ -205,6 +206,7 @@ store:
205
206
  ```
206
207
 
207
208
  ### Quality Checks
209
+
208
210
  In some cases, such as foreign key dependencies and triggers, you may wish to defer
209
211
  loading constraints on your tables until _after_ your seed data has been loaded.
210
212
  `prodder` treats the presence of a `quality_check_file` key in the configuration
@@ -212,6 +214,7 @@ as an indication that it should split `structure_file` into those statements whi
212
214
  create the base structure, and put the constraints into the `quality_check_file`.
213
215
 
214
216
  ### Permissions
217
+
215
218
  We have had multiple cases in the past with deployments failing because some role
216
219
  cannot access something on prod. To fail early and catch these in development, it
217
220
  would be easier to just have these permissions loaded in development environments.
@@ -221,10 +224,9 @@ must configure the 3 users as mentioned before in `#config/database.yml`.
221
224
  ```yaml
222
225
  store:
223
226
  structure_file: db/structure.sql # CREATE TABLE ...
224
- quality_check_file: db/constraints.sql # ALTER TABLE ... ADD FOREIGN KEY ...
227
+ quality_check_file: db/quality_checks.sql # ALTER TABLE ... ADD FOREIGN KEY ...
225
228
  ```
226
229
 
227
-
228
230
  ### Example usage
229
231
 
230
232
  The `-c` option to specify the configuration file is always required. All
@@ -254,12 +256,14 @@ $ prodder push -c prodder.yml
254
256
  ```
255
257
 
256
258
  ## TODO
259
+
257
260
  * Log activity as it is performed.
258
261
  * Support tracking a particular branch instead of master.
259
262
  * Support specifying the options to pass to each pg_dump form.
260
263
  * Select dumping only a subset of a seed table. (pg_dump won't do this ...)
261
264
 
262
265
  ## Previous Contributors
266
+
263
267
  * [Kyle Hargraves](https://github.com/pd)
264
268
  * [Sri Rangarajan](https://github.com/Slania)
265
269
  * [Emmanuel Sambo](https://github.com/esambo)
@@ -269,4 +273,4 @@ $ prodder push -c prodder.yml
269
273
 
270
274
  ## License
271
275
 
272
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
276
+ The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
data/compose.yml ADDED
@@ -0,0 +1,54 @@
1
+ services:
2
+ postgres:
3
+ image: postgres:13-alpine
4
+ volumes:
5
+ - postgres_data:/var/lib/postgresql/data
6
+ ports:
7
+ - 5432:5432
8
+ environment:
9
+ POSTGRES_USER: postgres
10
+ POSTGRES_PASSWORD: postgres
11
+ POSTGRES_HOST_AUTH_METHOD: trust
12
+ healthcheck:
13
+ test: ["CMD", "pg_isready"]
14
+ interval: 10s
15
+ timeout: 5s
16
+ retries: 5
17
+ restart: on-failure:5
18
+
19
+ prodder:
20
+ platform: linux/arm64
21
+ build:
22
+ context: .
23
+ dockerfile: Dockerfile
24
+ args:
25
+ RUBY_VERSION: 3.0
26
+ volumes:
27
+ - .:/app
28
+ - /app/config
29
+ depends_on:
30
+ postgres:
31
+ condition: service_healthy
32
+ environment:
33
+ PGHOST: localhost
34
+ PGPORT: "5432"
35
+ PGUSER: postgres
36
+ PGPASSWORD: postgres
37
+ network_mode: host
38
+
39
+ rspec:
40
+ profiles:
41
+ - test
42
+ extends:
43
+ service: prodder
44
+ command: bundle exec rspec
45
+
46
+ cucumber:
47
+ profiles:
48
+ - test
49
+ extends:
50
+ service: prodder
51
+ command: bundle exec cucumber
52
+
53
+ volumes:
54
+ postgres_data:
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ cmd=("$@")
5
+
6
+ mkdir -p config
7
+ cat <<EOF > config/database.yml
8
+ test:
9
+ adapter: postgresql
10
+ encoding: unicode
11
+ pool: 20
12
+ database: prodder_test
13
+ EOF
14
+
15
+ exec "${cmd[@]}"
data/lib/prodder/pg.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'open3'
2
2
  require 'pg'
3
+ require 'set'
3
4
 
4
5
  module Prodder
5
6
  class PG
@@ -1,3 +1,3 @@
1
1
  module Prodder
2
- VERSION = "1.8.1"
2
+ VERSION = "1.8.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prodder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Hargraves
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
10
+ date: 2025-07-25 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: deject
@@ -32,14 +31,17 @@ executables:
32
31
  extensions: []
33
32
  extra_rdoc_files: []
34
33
  files:
34
+ - ".dockerignore"
35
35
  - ".github/workflows/ci.yml"
36
36
  - ".gitignore"
37
+ - Dockerfile
37
38
  - Gemfile
38
39
  - LICENSE.txt
39
40
  - README.md
40
41
  - Rakefile
41
42
  - bin/prodder
42
- - config/database.yml.github-actions
43
+ - compose.yml
44
+ - entrypoints/entry.sh
43
45
  - features/commit.feature
44
46
  - features/dump.feature
45
47
  - features/init.feature
@@ -67,7 +69,6 @@ homepage: https://github.com/enova/prodder
67
69
  licenses:
68
70
  - MIT
69
71
  metadata: {}
70
- post_install_message:
71
72
  rdoc_options: []
72
73
  require_paths:
73
74
  - lib
@@ -82,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  - !ruby/object:Gem::Version
83
84
  version: '0'
84
85
  requirements: []
85
- rubygems_version: 3.0.3.1
86
- signing_key:
86
+ rubygems_version: 3.6.2
87
87
  specification_version: 4
88
88
  summary: Maintain your Rails apps' structure, seed and quality_checks files using
89
89
  production dumps
@@ -1,8 +0,0 @@
1
- test:
2
- adapter: postgresql
3
- host: localhost
4
- encoding: unicode
5
- database: github-actions
6
- pool: 20
7
- username: <%= ENV["POSTGRES_USER"] %>
8
- password: <%= ENV["POSTGRES_PASSWORD"] %>