parity 0.3.1 → 0.4.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 +13 -5
- data/lib/parity.rb +5 -3
- data/lib/parity/configuration.rb +6 -2
- data/lib/parity/environment.rb +24 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdaa697d06719099a577cf28328cc475fbe5c5a2
|
4
|
+
data.tar.gz: a37fadcf62aad35a63fe68bf23b9f548260b8f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aff67e5f7607a4321552122edb16a175d0ad3555ed14874460d46ee202c89b60927165669d9c5b63c5d3be634aaca5a5f8bb8fce97d2ea5712636c933f444e6
|
7
|
+
data.tar.gz: 43641dcdd7e571c386eb3ce78ca160d5d0a32bff90516bfa2b395efe3c14e9e1e38dd53ee162b458584d3b7e5b03ca91a48a4edd8e10c40a13f449b12b176d25
|
data/README.md
CHANGED
@@ -12,11 +12,12 @@ Your development machine will need these command-line programs:
|
|
12
12
|
heroku
|
13
13
|
pg_restore
|
14
14
|
|
15
|
-
On a Mac,
|
16
|
-
|
15
|
+
On a Mac,
|
16
|
+
`curl` is installed by default
|
17
|
+
and the other programs can be installed with Homebrew:
|
17
18
|
|
18
19
|
brew install heroku-toolbelt
|
19
|
-
brew install postgres
|
20
|
+
brew install postgres
|
20
21
|
|
21
22
|
Install
|
22
23
|
-------
|
@@ -66,6 +67,11 @@ Tail a log:
|
|
66
67
|
production tail
|
67
68
|
staging tail
|
68
69
|
|
70
|
+
Use [redis-cli][2] with your `REDIS_URL` add-on:
|
71
|
+
|
72
|
+
production redis-cli
|
73
|
+
staging redis-cli
|
74
|
+
|
69
75
|
The scripts also pass through, so you can do anything with them that you can do
|
70
76
|
with `heroku ______ --remote staging` or `heroku ______ --remote production`:
|
71
77
|
|
@@ -91,8 +97,9 @@ Override some of the conventions:
|
|
91
97
|
|
92
98
|
```ruby
|
93
99
|
Parity.configure do |config|
|
94
|
-
config.database_config_path =
|
95
|
-
config.heroku_app_basename =
|
100
|
+
config.database_config_path = "different/path.yml"
|
101
|
+
config.heroku_app_basename = "different-base-name"
|
102
|
+
config.redis_url_env_variable = "DIFFERENT_REDIS_URL"
|
96
103
|
end
|
97
104
|
```
|
98
105
|
|
@@ -130,3 +137,4 @@ Parity is maintained by Dan Croak. It is free software and may be redistributed
|
|
130
137
|
under the terms specified in the LICENSE file.
|
131
138
|
|
132
139
|
[1]: https://blog.heroku.com/archives/2013/3/19/log2viz
|
140
|
+
[2]: http://redis.io/commands
|
data/lib/parity.rb
CHANGED
data/lib/parity/configuration.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Parity
|
2
2
|
class Configuration
|
3
|
-
attr_accessor
|
3
|
+
attr_accessor \
|
4
|
+
:database_config_path,
|
5
|
+
:heroku_app_basename,
|
6
|
+
:redis_url_env_variable
|
4
7
|
|
5
8
|
def initialize
|
6
|
-
@database_config_path =
|
9
|
+
@database_config_path = "config/database.yml"
|
10
|
+
@redis_url_env_variable = "REDIS_URL"
|
7
11
|
end
|
8
12
|
end
|
9
13
|
|
data/lib/parity/environment.rb
CHANGED
@@ -9,7 +9,9 @@ module Parity
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run
|
12
|
-
if
|
12
|
+
if subcommand == "redis-cli"
|
13
|
+
redis_cli
|
14
|
+
elsif self.class.private_method_defined?(subcommand)
|
13
15
|
send(subcommand)
|
14
16
|
else
|
15
17
|
run_via_cli
|
@@ -62,6 +64,27 @@ module Parity
|
|
62
64
|
)
|
63
65
|
end
|
64
66
|
|
67
|
+
def redis_cli
|
68
|
+
url = URI(raw_redis_url)
|
69
|
+
|
70
|
+
Kernel.system(
|
71
|
+
"redis-cli",
|
72
|
+
"-h",
|
73
|
+
url.host,
|
74
|
+
"-p",
|
75
|
+
url.port,
|
76
|
+
"-a",
|
77
|
+
url.password
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
def raw_redis_url
|
82
|
+
@redis_to_go_url ||= Open3.capture3(
|
83
|
+
"heroku config:get #{Parity.config.redis_url_env_variable} "\
|
84
|
+
"--remote #{environment}"
|
85
|
+
)[0].strip
|
86
|
+
end
|
87
|
+
|
65
88
|
def heroku_app_name
|
66
89
|
[basename, environment].join('-')
|
67
90
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Croak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
|
-
|
15
|
-
|
16
|
-
for the same people who wrote the code to deploy it and watch its behavior
|
17
|
-
in production, and reduce the number of tools necessary to manage.
|
14
|
+
Development/staging/production parity makes it easier for
|
15
|
+
those who write the code to deploy the code.
|
18
16
|
email:
|
19
17
|
- dan@thoughtbot.com
|
20
18
|
executables:
|
@@ -53,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
51
|
version: '0'
|
54
52
|
requirements: []
|
55
53
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.2.2
|
57
55
|
signing_key:
|
58
56
|
specification_version: 4
|
59
57
|
summary: Shell commands for development, staging, and production parity.
|