parity 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/parity.rb +1 -0
- data/lib/parity/backup.rb +14 -3
- data/lib/parity/environment.rb +6 -5
- data/lib/parity/heroku_app_name.rb +18 -0
- data/lib/parity/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f04e5261a33b79ce3469c1622e031c9e6754ad
|
4
|
+
data.tar.gz: ed3aef4363acc66e30d6c39bed3163594a34a583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b967730a15f8b0cfc8d0c2c8b694560ee0e0da9488efa9aa70420bb743a8cc4a51b8f485bc64c7105c625263aa1e5893452f77260af3c276af3b3e66839ccd00
|
7
|
+
data.tar.gz: 27a93789ecf6fb18956c5a0b9357806877df2a72be4fa79eae0861edcb3dbc767abe53bdd922ff2806ca33394735b6be5fb738d3d9135379efa93b66ec9ccf9a
|
data/README.md
CHANGED
@@ -11,6 +11,13 @@ On OS X, this installs everything you need:
|
|
11
11
|
brew tap thoughtbot/formulae
|
12
12
|
brew install parity
|
13
13
|
|
14
|
+
On Debian:
|
15
|
+
|
16
|
+
wget -qO - https://apt.thoughtbot.com/thoughtbot.gpg.key | sudo apt-key add -
|
17
|
+
echo "deb http://apt.thoughtbot.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/thoughtbot.list
|
18
|
+
sudo apt-get update
|
19
|
+
sudo apt-get install parity
|
20
|
+
|
14
21
|
On other systems you can:
|
15
22
|
|
16
23
|
1. Download the package for your system from the [releases page][releases]
|
data/lib/parity.rb
CHANGED
data/lib/parity/backup.rb
CHANGED
@@ -22,13 +22,12 @@ module Parity
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
private
|
26
26
|
|
27
27
|
attr_reader :additional_args, :from, :to
|
28
28
|
|
29
|
-
private
|
30
|
-
|
31
29
|
def restore_from_development
|
30
|
+
reset_remote_database
|
32
31
|
Kernel.system(
|
33
32
|
"heroku pg:push #{development_db} DATABASE_URL --remote #{to} "\
|
34
33
|
"#{additional_args}",
|
@@ -46,6 +45,17 @@ module Parity
|
|
46
45
|
Kernel.system("dropdb #{development_db} && createdb #{development_db}")
|
47
46
|
end
|
48
47
|
|
48
|
+
def reset_remote_database
|
49
|
+
Kernel.system(
|
50
|
+
"heroku pg:reset --remote #{to} #{additional_args} "\
|
51
|
+
"--confirm #{heroku_app_name}",
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def heroku_app_name
|
56
|
+
HerokuAppName.new(to).to_s
|
57
|
+
end
|
58
|
+
|
49
59
|
def download_remote_backup
|
50
60
|
Kernel.system(
|
51
61
|
"curl -o tmp/latest.backup \"$(heroku pg:backups:url --remote #{from})\"",
|
@@ -65,6 +75,7 @@ module Parity
|
|
65
75
|
end
|
66
76
|
|
67
77
|
def restore_to_remote_environment
|
78
|
+
reset_remote_database
|
68
79
|
Kernel.system(
|
69
80
|
"heroku pg:backups:restore #{backup_from} --remote #{to} "\
|
70
81
|
"#{additional_args}",
|
data/lib/parity/environment.rb
CHANGED
@@ -86,11 +86,15 @@ module Parity
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def restore_confirmation_argument
|
89
|
-
unless PROTECTED_ENVIRONMENTS.include?(environment)
|
89
|
+
unless PROTECTED_ENVIRONMENTS.include?(environment) || from_development?
|
90
90
|
"--confirm #{heroku_app_name}"
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
def from_development?
|
95
|
+
arguments.first == "development"
|
96
|
+
end
|
97
|
+
|
94
98
|
def console
|
95
99
|
Kernel.system(command_for_remote("run rails console"))
|
96
100
|
end
|
@@ -129,10 +133,7 @@ module Parity
|
|
129
133
|
end
|
130
134
|
|
131
135
|
def heroku_app_name
|
132
|
-
|
133
|
-
capture3(command_for_remote("info"))[0].
|
134
|
-
split("\n")[0].
|
135
|
-
gsub(/(\s|=)+/, "")
|
136
|
+
HerokuAppName.new(environment).to_s
|
136
137
|
end
|
137
138
|
|
138
139
|
def command_for_remote(command)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Parity
|
2
|
+
class HerokuAppName
|
3
|
+
def initialize(environment)
|
4
|
+
@environment = environment
|
5
|
+
end
|
6
|
+
|
7
|
+
def to_s
|
8
|
+
@heroku_app_name ||= Open3.
|
9
|
+
capture3("heroku info --remote #{environment}")[0].
|
10
|
+
split("\n")[0].
|
11
|
+
gsub(/(\s|=)+/, "")
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :environment
|
17
|
+
end
|
18
|
+
end
|
data/lib/parity/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |2
|
15
15
|
Development/staging/production parity makes it easier for
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/parity.rb
|
31
31
|
- lib/parity/backup.rb
|
32
32
|
- lib/parity/environment.rb
|
33
|
+
- lib/parity/heroku_app_name.rb
|
33
34
|
- lib/parity/usage.rb
|
34
35
|
- lib/parity/version.rb
|
35
36
|
homepage: https://github.com/thoughtbot/parity
|
@@ -52,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
53
|
version: '0'
|
53
54
|
requirements: []
|
54
55
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.4.5
|
56
57
|
signing_key:
|
57
58
|
specification_version: 4
|
58
59
|
summary: Shell commands for development, staging, and production parity.
|