parity 3.0.1.beta → 3.4.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.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/bin/pr_app +1 -1
- data/lib/parity.rb +1 -0
- data/lib/parity/backup.rb +8 -5
- data/lib/parity/environment.rb +27 -6
- data/lib/parity/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 848792197642939ee65244b1b52cf46e247aaed2cdd23b7d145f8d0377f6b679
|
4
|
+
data.tar.gz: 96c978c1fbd49f12a4b35951da33ca958115875057a35b5be6c0912d9b252f72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f99f89a6f7d44c1223b699c32d80e6ab1279b34f06f6c2efb83d9e4974cd877d98fb4461768d509afb0010c30be0d58b2d86fa70f3f35032e69c29d188fdb864
|
7
|
+
data.tar.gz: bd98116578f9f6d492ecf99afd170ac0d242ad9c248f370cdc6f77ad957bd91d7a6bcbfb73cd0261edcc854cfe85484064c63d71efacc6a22bef5f0748022e53
|
data/README.md
CHANGED
@@ -61,7 +61,7 @@ Push your local development database backup up to staging:
|
|
61
61
|
|
62
62
|
staging restore development
|
63
63
|
|
64
|
-
Deploy
|
64
|
+
Deploy main to production (note that prior versions of Parity would run
|
65
65
|
database migrations, that's now better handled using [Heroku release phase]):
|
66
66
|
|
67
67
|
production deploy
|
@@ -104,6 +104,12 @@ with `heroku ______ --remote staging` or `heroku ______ --remote production`:
|
|
104
104
|
watch production ps
|
105
105
|
staging open
|
106
106
|
|
107
|
+
You can optionally parallelize a DB restore by passing `--parallelize`
|
108
|
+
as a flag to the `development` or `production` commands:
|
109
|
+
```
|
110
|
+
development restore-from production --parallelize
|
111
|
+
```
|
112
|
+
|
107
113
|
[2]: http://redis.io/commands
|
108
114
|
|
109
115
|
Convention
|
@@ -191,7 +197,7 @@ See guidelines in [`RELEASING.md`](RELEASING.md) for details
|
|
191
197
|
License
|
192
198
|
-------
|
193
199
|
|
194
|
-
Parity is © 2013-
|
200
|
+
Parity is © 2013-2021 thoughtbot, inc.
|
195
201
|
It is free software,
|
196
202
|
and may be redistributed under the terms specified in the [LICENSE] file.
|
197
203
|
|
data/bin/pr_app
CHANGED
@@ -9,7 +9,7 @@ if ARGV.empty?
|
|
9
9
|
else
|
10
10
|
review_app_number = ARGV.first
|
11
11
|
staging_git_remote = Open3.capture3("git remote get-url staging")[0].strip
|
12
|
-
review_app_prefix = staging_git_remote.split("/").last.gsub(/\.git\Z/, "")
|
12
|
+
review_app_prefix = staging_git_remote.split("/").last.gsub(/\.git\Z/, "")[0, 20]
|
13
13
|
|
14
14
|
exit Parity::Environment.new(
|
15
15
|
"#{review_app_prefix}-pr-#{review_app_number}",
|
data/lib/parity.rb
CHANGED
data/lib/parity/backup.rb
CHANGED
@@ -10,6 +10,7 @@ module Parity
|
|
10
10
|
def initialize(args)
|
11
11
|
@from, @to = args.values_at(:from, :to)
|
12
12
|
@additional_args = args[:additional_args] || BLANK_ARGUMENTS
|
13
|
+
@parallelize = args[:parallelize] || false
|
13
14
|
end
|
14
15
|
|
15
16
|
def restore
|
@@ -24,7 +25,9 @@ module Parity
|
|
24
25
|
|
25
26
|
private
|
26
27
|
|
27
|
-
attr_reader :additional_args, :from, :to
|
28
|
+
attr_reader :additional_args, :from, :to, :parallelize
|
29
|
+
|
30
|
+
alias :parallelize? :parallelize
|
28
31
|
|
29
32
|
def restore_from_development
|
30
33
|
reset_remote_database
|
@@ -72,7 +75,7 @@ module Parity
|
|
72
75
|
|
73
76
|
def restore_from_local_temp_backup
|
74
77
|
Kernel.system(
|
75
|
-
"pg_restore tmp/latest.backup --verbose --
|
78
|
+
"pg_restore tmp/latest.backup --verbose --no-acl --no-owner "\
|
76
79
|
"--dbname #{development_db} --jobs=#{processor_cores} "\
|
77
80
|
"#{additional_args}",
|
78
81
|
)
|
@@ -111,14 +114,14 @@ module Parity
|
|
111
114
|
end
|
112
115
|
|
113
116
|
def database_yaml_file
|
114
|
-
IO.read(DATABASE_YML_RELATIVE_PATH)
|
117
|
+
ERB.new(IO.read(DATABASE_YML_RELATIVE_PATH)).result
|
115
118
|
end
|
116
119
|
|
117
120
|
def processor_cores
|
118
|
-
if ruby_version_over_2_2?
|
121
|
+
if parallelize? && ruby_version_over_2_2?
|
119
122
|
Etc.nprocessors
|
120
123
|
else
|
121
|
-
|
124
|
+
1
|
122
125
|
end
|
123
126
|
end
|
124
127
|
|
data/lib/parity/environment.rb
CHANGED
@@ -41,14 +41,27 @@ module Parity
|
|
41
41
|
|
42
42
|
def deploy
|
43
43
|
if production?
|
44
|
-
Kernel.system("git push production
|
44
|
+
Kernel.system("git push production #{branch_ref}")
|
45
45
|
else
|
46
46
|
Kernel.system(
|
47
|
-
"git push #{environment} HEAD
|
47
|
+
"git push #{environment} HEAD:#{branch_ref} --force",
|
48
48
|
)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def branch_ref
|
53
|
+
main_ref_exists = system("git show-ref --verify --quiet refs/heads/main")
|
54
|
+
master_ref_exists = system(
|
55
|
+
"git show-ref --verify --quiet refs/heads/master",
|
56
|
+
)
|
57
|
+
|
58
|
+
if main_ref_exists && !master_ref_exists
|
59
|
+
"main"
|
60
|
+
else
|
61
|
+
"master"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
52
65
|
def restore
|
53
66
|
if production? && !forced?
|
54
67
|
$stdout.puts "Parity does not support restoring backups into your "\
|
@@ -57,6 +70,7 @@ module Parity
|
|
57
70
|
Backup.new(
|
58
71
|
from: arguments.first,
|
59
72
|
to: environment,
|
73
|
+
parallelize: parallelize?,
|
60
74
|
additional_args: additional_restore_arguments,
|
61
75
|
).restore
|
62
76
|
end
|
@@ -72,10 +86,13 @@ module Parity
|
|
72
86
|
arguments.include?("--force")
|
73
87
|
end
|
74
88
|
|
89
|
+
def parallelize?
|
90
|
+
arguments.include?("--parallelize")
|
91
|
+
end
|
92
|
+
|
75
93
|
def additional_restore_arguments
|
76
|
-
(arguments.drop(1) - ["--force"] +
|
77
|
-
compact.
|
78
|
-
join(" ")
|
94
|
+
(arguments.drop(1) - ["--force", "--parallelize"] +
|
95
|
+
[restore_confirmation_argument]).compact.join(" ")
|
79
96
|
end
|
80
97
|
|
81
98
|
def restore_confirmation_argument
|
@@ -89,7 +106,11 @@ module Parity
|
|
89
106
|
end
|
90
107
|
|
91
108
|
def console
|
92
|
-
Kernel.system(
|
109
|
+
Kernel.system(
|
110
|
+
command_for_remote(
|
111
|
+
"run bundle exec rails console #{arguments.join(' ')}",
|
112
|
+
),
|
113
|
+
)
|
93
114
|
end
|
94
115
|
|
95
116
|
def migrate
|
data/lib/parity/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
8
8
|
- Geoff Harcourt
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |2
|
15
15
|
Development/staging/production parity makes it easier for
|
@@ -39,7 +39,7 @@ homepage: https://github.com/thoughtbot/parity
|
|
39
39
|
licenses:
|
40
40
|
- MIT
|
41
41
|
metadata: {}
|
42
|
-
post_install_message:
|
42
|
+
post_install_message:
|
43
43
|
rdoc_options: []
|
44
44
|
require_paths:
|
45
45
|
- lib
|
@@ -50,13 +50,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
50
|
version: 2.2.0
|
51
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: '0'
|
56
56
|
requirements: []
|
57
|
-
|
58
|
-
|
59
|
-
signing_key:
|
57
|
+
rubygems_version: 3.1.6
|
58
|
+
signing_key:
|
60
59
|
specification_version: 4
|
61
60
|
summary: Shell commands for development, staging, and production parity.
|
62
61
|
test_files: []
|