prodder 1.7.7 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 837adeb9529887b429bbe128bbb9162f29d0ca5001fbd94b28aba2aa105caacb
4
- data.tar.gz: e3b410b12794de3b1a04d55adad8ac789c83658526c4a749b8494878381c7e0a
3
+ metadata.gz: 5e8921f51e1bb936a99eaccc98d04bcd34ff72acbe20cb5547f6e680f8e4106a
4
+ data.tar.gz: 0e47795334cfcd4944d877dd5c24ab72e4fa5b082d66400b5c0a318228ba0f5d
5
5
  SHA512:
6
- metadata.gz: d5982600241c08dc3c623c8c1e6153cfbd10bd6c20f3fa3074f4cf45335f6fd091c58e31e2e26da624c956b6624458ce21ce117568b933ec72aab8f2f30d295d
7
- data.tar.gz: 697799d716ab1bd9a7fbc19b3a346681621ffd8cf3b732ee2eed41acb86b7626fb0eb16f239a307c62c797f890a1cfc9c8e2d6db367fb1542ed174ca14512aee
6
+ metadata.gz: 12817961230a0fd95776ff3bdf4a95b62fb8b961bbf2db9d93413f8cf93c32a9f11c4e036ffd89b0e4e5c0807ef40cf5d342706b0cd7a1f214c1f9c3a840547b
7
+ data.tar.gz: 34c918bd1587a1c055ffd76866028a5cd7e7c371c42cec0381e01294af4f308b5478d59f2406a8d5dea73755e5c16cb0d33b2b206e8a450448cceca6b5a2b748
@@ -0,0 +1,55 @@
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
+ matrix:
18
+ ruby-version: [2.6, 2.7, 3.0]
19
+ services:
20
+ postgres:
21
+ image: postgres:12.1-alpine
22
+ ports:
23
+ - 5432:5432
24
+ env:
25
+ POSTGRES_USER: postgres
26
+ POSTGRES_PASSWORD: postgres
27
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28
+ steps:
29
+ - name: Checkout Project
30
+ uses: actions/checkout@v3
31
+
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true
37
+
38
+ - name: Install Library Dependencies
39
+ run: sudo apt-get install libpq-dev
40
+
41
+ - name: Setup Database
42
+ 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
+
49
+ - name: Test with RSpec
50
+ env:
51
+ RAILS_ENV: "test"
52
+ POSTGRES_USER: postgres
53
+ POSTGRES_PASSWORD: postgres
54
+ run: |
55
+ bundle exec rspec
@@ -0,0 +1,8 @@
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"] %>
@@ -169,7 +169,7 @@ namespace :db do
169
169
  end
170
170
  as("superuser", in: environments) do
171
171
  ActiveRecord::Tasks::DatabaseTasks.create_current
172
- ActiveRecord::Base.configurations.each do |env, config|
172
+ Rails.configuration.database_configuration.each do |env, config|
173
173
  if environments.include?(env) && config["migration_user"] && config['database']
174
174
  set_psql_env config
175
175
  `psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
@@ -182,7 +182,7 @@ namespace :db do
182
182
  task :all => dependencies do
183
183
  as("superuser") do
184
184
  ActiveRecord::Tasks::DatabaseTasks.create_all
185
- ActiveRecord::Base.configurations.each do |env, config|
185
+ Rails.configuration.database_configuration.each do |env, config|
186
186
  if config["migration_user"] && config['database']
187
187
  set_psql_env config
188
188
  `psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
@@ -204,7 +204,7 @@ namespace :db do
204
204
  desc "Load db/structure.sql into the current environment's database"
205
205
  task :load => dependencies do
206
206
  as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
207
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
207
+ config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access
208
208
  set_psql_env config
209
209
  puts "Loading db/structure.sql into database '#{config['database']}'"
210
210
  `psql --no-psqlrc -f db/structure.sql #{Shellwords.escape(config['database'])}`
@@ -217,7 +217,7 @@ namespace :db do
217
217
  task :seed => dependencies do
218
218
  if File.exist?('db/seeds.sql')
219
219
  as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
220
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
220
+ config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access
221
221
  set_psql_env config
222
222
  puts "Loading db/seeds.sql into database '#{config['database']}'"
223
223
  `psql --no-psqlrc -f db/seeds.sql #{Shellwords.escape(config['database'])}`
@@ -232,7 +232,7 @@ namespace :db do
232
232
  task :quality_check => dependencies do
233
233
  if File.exist?('db/quality_checks.sql')
234
234
  as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
235
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
235
+ config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access
236
236
  set_psql_env config
237
237
  puts "Loading db/quality_checks.sql into database '#{config['database']}'"
238
238
  `psql --no-psqlrc -f db/quality_checks.sql #{Shellwords.escape(config['database'])}`
@@ -247,7 +247,7 @@ namespace :db do
247
247
  task :permission => dependencies do
248
248
  if File.exist?('db/permissions.sql')
249
249
  as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
250
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
250
+ config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access
251
251
  set_psql_env config
252
252
  puts "Loading db/permissions.sql into database '#{config['database']}'"
253
253
  result = ActiveRecord::Base.connection.execute(<<-SQL).first
@@ -268,7 +268,7 @@ namespace :db do
268
268
  task :settings => dependencies do
269
269
  if File.exist?('db/settings.sql')
270
270
  as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
271
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
271
+ config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access
272
272
  set_psql_env config
273
273
  puts "Loading db/settings.sql into database '#{config['database']}'"
274
274
  result = ActiveRecord::Base.connection.execute(<<-SQL).first
@@ -362,8 +362,7 @@ namespace :db do
362
362
 
363
363
  def as(user, opts = {}, &block)
364
364
  if File.exist?('db/permissions.sql')
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
365
+ config, config_was = Rails.configuration.database_configuration, ActiveRecord::Base.configurations.deep_dup
367
366
  in_env = Array(opts[:in]) || config.keys
368
367
  if config.all? { |env, config_hash| in_env.include?(env) ? config_hash[user] : true }
369
368
  disconnect
@@ -394,5 +393,5 @@ end
394
393
 
395
394
  # Yes, I really want migrations to run against the test DB.
396
395
  Rake::Task['db:migrate'].actions.unshift(proc {
397
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env])
396
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env].with_indifferent_access)
398
397
  })
@@ -1,3 +1,3 @@
1
1
  module Prodder
2
- VERSION = "1.7.7"
2
+ VERSION = "1.8.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.7
4
+ version: 1.8.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: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deject
@@ -32,13 +32,14 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".github/workflows/ci.yml"
35
36
  - ".gitignore"
36
- - ".travis.yml"
37
37
  - Gemfile
38
38
  - LICENSE.txt
39
39
  - README.md
40
40
  - Rakefile
41
41
  - bin/prodder
42
+ - config/database.yml.github-actions
42
43
  - features/commit.feature
43
44
  - features/dump.feature
44
45
  - features/init.feature
@@ -81,9 +82,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  requirements: []
84
- rubygems_version: 3.0.8
85
+ rubygems_version: 3.0.3.1
85
86
  signing_key:
86
87
  specification_version: 4
87
88
  summary: Maintain your Rails apps' structure, seed and quality_checks files using
88
89
  production dumps
89
- test_files: []
90
+ test_files:
91
+ - features/commit.feature
92
+ - features/dump.feature
93
+ - features/init.feature
94
+ - features/lint.feature
95
+ - features/prodder.feature
96
+ - features/push.feature
97
+ - features/step_definitions/git_steps.rb
98
+ - features/step_definitions/prodder_steps.rb
99
+ - features/support/blog.git.tgz
100
+ - features/support/env.rb
101
+ - features/support/prodder__blog_prod.sql
102
+ - spec/config_spec.rb
103
+ - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,41 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- rvm:
5
- - 2.5.8
6
- - 2.7.2
7
-
8
- env:
9
- matrix:
10
- - PG_VERSION=11
11
-
12
- before_install:
13
- - git config --global user.name "Prodder In Travis-CI"
14
- - git config --global user.email "prodder@example.com"
15
- # install postgres
16
- - sudo apt-get install postgresql-client-$PG_VERSION postgresql-server-dev-$PG_VERSION
17
- # setup pg_dump
18
- - ls -al /usr/lib/postgresql/
19
- - sudo ln -sfn /usr/lib/postgresql/$PG_VERSION/bin/pg_dump /usr/bin/pg_dump
20
- # start up the specific version of PG
21
- - sudo -E sh -c 'service postgresql stop'
22
- - sleep 5s
23
- - sudo -E sh -c 'service postgresql start $PG_VERSION'
24
- - psql -U postgres -d postgres -c 'select setting from pg_settings where name = $m$server_version$m$;'
25
-
26
- script:
27
- - psql --version
28
- - pg_lsclusters
29
- - psql -U postgres -d postgres -c 'select 1;'
30
- - ls -al `which pg_dump`
31
- - bundle exec rake spec
32
- - bundle exec rake cucumber
33
-
34
- deploy:
35
- provider: rubygems
36
- api_key:
37
- secure: "UhUkPFhEuI1dLPa4skTUdOBcGY2SEkRP3N9jLDQad04DflV+GutcjrfN1iQxWk59gVt3zqird5FS8SdwCFuOn8DAU9ACtg73xiPPWRRTdzma4Qw+4thuOHcdwPBz3762YFTRyH7IbRTAlxaD6qPz6US3BnYAkJU7C8c30rHLX6cZutjLV4FsvWonkzxcjyEUViVEdBM0kzI+tdBnQovpcM67a9AfxxBZITJLIfIcah1qc/RANpLkUFJCwNyH9oARWsGIvpIKcQEJBhsl04tvbNRLpiMCk1e1RS1bjMdbbx/rVm3C7dvAjUznbr3ON9abgoe6QDDYr6kXPJbylmxFUzA7ftBWjz2nNruRncsohx08LaM4ADRJWKB3XbP5BXkwUgE672Fi20+Z78LwWfjrr3iRVm7u9Mt9pZHG6Ih8Jy64Uq3647kdVZu9APPfn1NZETFG7vLAMZUtPXv7HBkujlq23XdYXax1XYYbYsM0LOlnG6ol2y6OrBrxWIqC+E8UmLXf/+/MS4j3v2RAe7jXh6fFlw+5MjLr3HXqZ12CrAChp22NRPp1OY4Hac4zzRwGeVOgewknpOK7qQfVFFaQoQksU6VaenSx+TxcYOZYuQdrQjfbO6c+Q/vvZ1RoPOEwH0AelkrW2eGqQTNVWIbH5vvfhys68SA8ov8gNnIzMtU="
38
- gem: prodder
39
- on:
40
- tags: true
41
- repo: enova/prodder