prodder 1.8.3 → 1.9.0

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/Gemfile +4 -2
  4. data/Gemfile.lock +122 -0
  5. data/README.md +164 -76
  6. data/compose.yml +2 -2
  7. data/cucumber.yml +1 -0
  8. data/features/step_definitions/git_steps.rb +18 -18
  9. data/features/step_definitions/prodder_steps.rb +26 -26
  10. data/features/support/blog.git/HEAD +1 -0
  11. data/features/support/blog.git/config +7 -0
  12. data/features/support/blog.git/description +1 -0
  13. data/features/support/blog.git/hooks/applypatch-msg.sample +15 -0
  14. data/features/support/blog.git/hooks/commit-msg.sample +24 -0
  15. data/features/support/blog.git/hooks/post-commit.sample +8 -0
  16. data/features/support/blog.git/hooks/post-receive.sample +15 -0
  17. data/features/support/blog.git/hooks/post-update.sample +8 -0
  18. data/features/support/blog.git/hooks/pre-applypatch.sample +14 -0
  19. data/features/support/blog.git/hooks/pre-commit.sample +46 -0
  20. data/features/support/blog.git/hooks/pre-rebase.sample +169 -0
  21. data/features/support/blog.git/hooks/prepare-commit-msg.sample +36 -0
  22. data/features/support/blog.git/hooks/update.sample +128 -0
  23. data/features/support/blog.git/info/exclude +6 -0
  24. data/features/support/blog.git/objects/2c/0dfde112cb834fc1bd166454bf0e23f35aec0b +0 -0
  25. data/features/support/blog.git/objects/5f/344dad802e30fce4f8b84e094a52a0a3c1ef9a +0 -0
  26. data/features/support/blog.git/objects/c0/7cd3c46c7a18b6b2c44f4efea77554d0840056 +0 -0
  27. data/features/support/blog.git/packed-refs +2 -0
  28. data/features/support/env.rb +22 -10
  29. data/lib/prodder/cli.rb +0 -2
  30. data/lib/prodder/pg.rb +8 -6
  31. data/lib/prodder/version.rb +1 -1
  32. data/prodder.gemspec +6 -4
  33. data/rspec_test.log +5 -0
  34. metadata +48 -10
  35. data/.dockerignore +0 -2
  36. data/.github/workflows/ci.yml +0 -67
  37. data/.gitignore +0 -3
  38. data/entrypoints/entry.sh +0 -15
@@ -1,9 +1,16 @@
1
1
  require 'cucumber'
2
2
  require 'aruba/cucumber'
3
3
 
4
- $LOAD_PATH.unshift File.expand_path('../../lib', File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __dir__)
5
5
  require 'prodder'
6
6
 
7
+ # Configure Aruba to find the prodder executable
8
+ Aruba.configure do |config|
9
+ config.command_search_paths << File.expand_path('../../bin', __dir__)
10
+ config.exit_timeout = 10
11
+ config.io_wait_timeout = 10
12
+ end
13
+
7
14
  module ProdderHelpers
8
15
  def strip_leading(string)
9
16
  leading = string.scan(/^\s*/).min_by &:length
@@ -11,21 +18,21 @@ module ProdderHelpers
11
18
  end
12
19
 
13
20
  def in_workspace(name, &block)
14
- in_current_dir { Dir.chdir("prodder-workspace/#{name}", &block) }
21
+ in_current_directory { Dir.chdir("prodder-workspace/#{name}", &block) }
15
22
  end
16
23
 
17
24
  def commit_to_remote(project)
18
25
  @dirs = ['tmp', 'aruba']
19
- run_simple "git clone repos/#{project}.git tmp-extra-commit-#{project}"
26
+ run_command_and_stop "git clone repos/#{project}.git tmp-extra-commit-#{project}"
20
27
  cd "tmp-extra-commit-#{project}"
21
28
 
22
29
  append_to_file "README", 'Also read this!'
23
- run_simple 'git add README'
24
- run_simple 'git commit -m "Second commit"'
25
- run_simple "git push origin master"
30
+ run_command_and_stop 'git add README'
31
+ run_command_and_stop 'git -c user.email="test@example.com" -c user.name="Test User" commit -m "Second commit"'
32
+ run_command_and_stop "git push origin master"
26
33
 
27
34
  cd '..'
28
- run_simple "rm -rf tmp-extra-commit-#{project}"
35
+ run_command_and_stop "rm -rf tmp-extra-commit-#{project}"
29
36
  end
30
37
 
31
38
  def update_config(filename, &block)
@@ -90,7 +97,7 @@ module ProdderHelpers
90
97
  end
91
98
 
92
99
  def self.fixture_dbs
93
- @fixture_dbs ||= Dir[File.join(File.dirname(__FILE__), '*.sql')].map do |sql|
100
+ @fixture_dbs ||= Dir[File.join(__dir__, '*.sql')].map do |sql|
94
101
  db = File.basename(sql).sub('.sql', '')
95
102
  [db, File.read(sql)]
96
103
  end
@@ -100,10 +107,15 @@ end
100
107
  World ProdderHelpers
101
108
 
102
109
  Before do
103
- @prodder_root = File.expand_path('../..', File.dirname(__FILE__))
110
+ @prodder_root = File.expand_path('../..', __dir__)
104
111
  @aruba_root = File.join(@prodder_root, 'tmp', 'aruba')
105
- @aruba_timeout_seconds = 10
106
112
  Dir.chdir @prodder_root
113
+
114
+ # Configure git for tests that create commits
115
+ set_environment_variable 'GIT_AUTHOR_NAME', 'Test User'
116
+ set_environment_variable 'GIT_AUTHOR_EMAIL', 'test@example.com'
117
+ set_environment_variable 'GIT_COMMITTER_NAME', 'Test User'
118
+ set_environment_variable 'GIT_COMMITTER_EMAIL', 'test@example.com'
107
119
  end
108
120
 
109
121
  After('@restore-perms') do
data/lib/prodder/cli.rb CHANGED
@@ -2,8 +2,6 @@ require 'prodder'
2
2
  require 'thor'
3
3
  require 'yaml'
4
4
 
5
- require 'pp' # TODO rm
6
-
7
5
  class Prodder::CLI < Thor
8
6
  include Thor::Actions
9
7
 
data/lib/prodder/pg.rb CHANGED
@@ -70,11 +70,12 @@ module Prodder
70
70
  end
71
71
  end
72
72
 
73
- def dump_structure(db_name, filename, options = {})
73
+ def dump_structure(db_name, filename, **options)
74
74
  arguments = [
75
75
  '--schema-only',
76
76
  '--no-privileges',
77
77
  '--no-owner',
78
+ '--restrict-key', 'prodder',
78
79
  '--host', credentials['host'],
79
80
  '--username', credentials['user']
80
81
  ]
@@ -96,6 +97,7 @@ module Prodder
96
97
  '--no-privileges',
97
98
  '--no-owner',
98
99
  '--disable-triggers',
100
+ '--restrict-key', 'prodder',
99
101
  '--host', credentials['host'],
100
102
  '--username', credentials['user'],
101
103
  *tables.map { |table| ['--table', table] }.flatten,
@@ -103,12 +105,12 @@ module Prodder
103
105
  ]
104
106
  end
105
107
 
106
- def dump_permissions(db_name, filename, options = {})
108
+ def dump_permissions(db_name, filename, **options)
107
109
  perm_out_sql = ""
108
110
  user_list = []
109
111
 
110
- perm_out_sql << dump_db_access_control(db_name, user_list, options)
111
- perm_out_sql.prepend pg_dumpall db_name, user_list, options
112
+ perm_out_sql << dump_db_access_control(db_name, user_list, **options)
113
+ perm_out_sql.prepend pg_dumpall(db_name, user_list, **options)
112
114
 
113
115
  perm_out_sql.prepend(alter_role_function)
114
116
  perm_out_sql.prepend(create_role_function)
@@ -127,7 +129,7 @@ module Prodder
127
129
  DEFAULT_PRIVILEGES = /^ALTER DEFAULT PRIVILEGES /
128
130
  SET_OBJECT_OWNERSHIP = /.* OWNER TO /
129
131
 
130
- def dump_db_access_control(db_name, user_list, options)
132
+ def dump_db_access_control(db_name, user_list, **options)
131
133
  perm_out_sql = ""
132
134
  arguments = [
133
135
  '--schema-only',
@@ -218,7 +220,7 @@ module Prodder
218
220
  end
219
221
  end
220
222
 
221
- def pg_dumpall(db_name, user_list, options)
223
+ def pg_dumpall(db_name, user_list, **options)
222
224
  white_list = options[:included_users] || []
223
225
  irrelevant_login_roles = irrelevant_login_roles(db_name, white_list).map { |user| user['oid'] }
224
226
 
@@ -1,3 +1,3 @@
1
1
  module Prodder
2
- VERSION = "1.8.3"
2
+ VERSION = "1.9.0"
3
3
  end
data/prodder.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(File.expand_path("lib", __dir__))
3
3
  require "prodder/version"
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -12,11 +12,13 @@ Gem::Specification.new do |s|
12
12
  s.summary = "Maintain your Rails apps' structure, seed and quality_checks files using production dumps"
13
13
  s.description = "Migrations suck long-term. Now you can kill them routinely."
14
14
 
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.files = Dir.glob("{lib,bin,features}/**/*") + Dir.glob("*").reject { |f| File.directory?(f) }
16
+ s.test_files = Dir.glob("{test,spec,features}/**/*")
17
+ s.executables = Dir.glob("bin/*").map { |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
+ s.required_ruby_version = ">= 2.7.0"
21
+
20
22
  # These dependencies do not match the Gemfile's for a reason.
21
23
  # These are the only dependencies necessary to satisfy inclusion of this
22
24
  # gem in a Rails application; any dependencies necessary to run prodder
data/rspec_test.log ADDED
@@ -0,0 +1,5 @@
1
+ .............
2
+
3
+ Finished in 0.01093 seconds (files took 0.16398 seconds to load)
4
+ 13 examples, 0 failures
5
+
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prodder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Hargraves
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-07-25 00:00:00.000000000 Z
11
+ date: 2025-12-10 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: deject
@@ -31,17 +32,15 @@ executables:
31
32
  extensions: []
32
33
  extra_rdoc_files: []
33
34
  files:
34
- - ".dockerignore"
35
- - ".github/workflows/ci.yml"
36
- - ".gitignore"
37
35
  - Dockerfile
38
36
  - Gemfile
37
+ - Gemfile.lock
39
38
  - LICENSE.txt
40
39
  - README.md
41
40
  - Rakefile
42
41
  - bin/prodder
43
42
  - compose.yml
44
- - entrypoints/entry.sh
43
+ - cucumber.yml
45
44
  - features/commit.feature
46
45
  - features/dump.feature
47
46
  - features/init.feature
@@ -51,6 +50,24 @@ files:
51
50
  - features/step_definitions/git_steps.rb
52
51
  - features/step_definitions/prodder_steps.rb
53
52
  - features/support/blog.git.tgz
53
+ - features/support/blog.git/HEAD
54
+ - features/support/blog.git/config
55
+ - features/support/blog.git/description
56
+ - features/support/blog.git/hooks/applypatch-msg.sample
57
+ - features/support/blog.git/hooks/commit-msg.sample
58
+ - features/support/blog.git/hooks/post-commit.sample
59
+ - features/support/blog.git/hooks/post-receive.sample
60
+ - features/support/blog.git/hooks/post-update.sample
61
+ - features/support/blog.git/hooks/pre-applypatch.sample
62
+ - features/support/blog.git/hooks/pre-commit.sample
63
+ - features/support/blog.git/hooks/pre-rebase.sample
64
+ - features/support/blog.git/hooks/prepare-commit-msg.sample
65
+ - features/support/blog.git/hooks/update.sample
66
+ - features/support/blog.git/info/exclude
67
+ - features/support/blog.git/objects/2c/0dfde112cb834fc1bd166454bf0e23f35aec0b
68
+ - features/support/blog.git/objects/5f/344dad802e30fce4f8b84e094a52a0a3c1ef9a
69
+ - features/support/blog.git/objects/c0/7cd3c46c7a18b6b2c44f4efea77554d0840056
70
+ - features/support/blog.git/packed-refs
54
71
  - features/support/env.rb
55
72
  - features/support/prodder__blog_prod.sql
56
73
  - lib/prodder.rb
@@ -63,12 +80,14 @@ files:
63
80
  - lib/prodder/railtie.rb
64
81
  - lib/prodder/version.rb
65
82
  - prodder.gemspec
83
+ - rspec_test.log
66
84
  - spec/config_spec.rb
67
85
  - spec/spec_helper.rb
68
86
  homepage: https://github.com/enova/prodder
69
87
  licenses:
70
88
  - MIT
71
89
  metadata: {}
90
+ post_install_message:
72
91
  rdoc_options: []
73
92
  require_paths:
74
93
  - lib
@@ -76,18 +95,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
95
  requirements:
77
96
  - - ">="
78
97
  - !ruby/object:Gem::Version
79
- version: '0'
98
+ version: 2.7.0
80
99
  required_rubygems_version: !ruby/object:Gem::Requirement
81
100
  requirements:
82
101
  - - ">="
83
102
  - !ruby/object:Gem::Version
84
103
  version: '0'
85
104
  requirements: []
86
- rubygems_version: 3.6.2
105
+ rubygems_version: 3.5.22
106
+ signing_key:
87
107
  specification_version: 4
88
108
  summary: Maintain your Rails apps' structure, seed and quality_checks files using
89
109
  production dumps
90
110
  test_files:
111
+ - spec/config_spec.rb
112
+ - spec/spec_helper.rb
91
113
  - features/commit.feature
92
114
  - features/dump.feature
93
115
  - features/init.feature
@@ -96,8 +118,24 @@ test_files:
96
118
  - features/push.feature
97
119
  - features/step_definitions/git_steps.rb
98
120
  - features/step_definitions/prodder_steps.rb
121
+ - features/support/blog.git/HEAD
122
+ - features/support/blog.git/config
123
+ - features/support/blog.git/description
124
+ - features/support/blog.git/hooks/applypatch-msg.sample
125
+ - features/support/blog.git/hooks/commit-msg.sample
126
+ - features/support/blog.git/hooks/post-commit.sample
127
+ - features/support/blog.git/hooks/post-receive.sample
128
+ - features/support/blog.git/hooks/post-update.sample
129
+ - features/support/blog.git/hooks/pre-applypatch.sample
130
+ - features/support/blog.git/hooks/pre-commit.sample
131
+ - features/support/blog.git/hooks/pre-rebase.sample
132
+ - features/support/blog.git/hooks/prepare-commit-msg.sample
133
+ - features/support/blog.git/hooks/update.sample
134
+ - features/support/blog.git/info/exclude
135
+ - features/support/blog.git/objects/2c/0dfde112cb834fc1bd166454bf0e23f35aec0b
136
+ - features/support/blog.git/objects/5f/344dad802e30fce4f8b84e094a52a0a3c1ef9a
137
+ - features/support/blog.git/objects/c0/7cd3c46c7a18b6b2c44f4efea77554d0840056
138
+ - features/support/blog.git/packed-refs
99
139
  - features/support/blog.git.tgz
100
140
  - features/support/env.rb
101
141
  - features/support/prodder__blog_prod.sql
102
- - spec/config_spec.rb
103
- - spec/spec_helper.rb
data/.dockerignore DELETED
@@ -1,2 +0,0 @@
1
- Gemfile.lock
2
- tmp
@@ -1,67 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- branches:
7
- - main
8
- pull_request:
9
-
10
- permissions:
11
- contents: read
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby-version: [2.6, 2.7, 3.0]
20
- services:
21
- postgres:
22
- image: postgres:13-alpine
23
- ports:
24
- - 5432:5432
25
- env:
26
- POSTGRES_USER: postgres
27
- POSTGRES_PASSWORD: postgres
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
34
- steps:
35
- - name: Checkout Project
36
- uses: actions/checkout@v4
37
- - name: Set up Ruby
38
- uses: ruby/setup-ruby@v1
39
- with:
40
- ruby-version: ${{ matrix.ruby-version }}
41
- bundler-cache: true
42
- - name: Install Library Dependencies
43
- run: sudo apt update && sudo apt install -y postgresql-client
44
- - name: Setup Database
45
- run: |
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
54
- - name: Test with RSpec
55
- env:
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 DELETED
@@ -1,3 +0,0 @@
1
- Gemfile.lock
2
- tmp
3
- prodder-*
data/entrypoints/entry.sh DELETED
@@ -1,15 +0,0 @@
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[@]}"