parity 0.3.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29a05bf7ce1d570b73899bafe1d42d87112350b6
4
- data.tar.gz: 6499bc99345cdbe6290eb4c9369aacf6f7fbb664
3
+ metadata.gz: bdaa697d06719099a577cf28328cc475fbe5c5a2
4
+ data.tar.gz: a37fadcf62aad35a63fe68bf23b9f548260b8f2e
5
5
  SHA512:
6
- metadata.gz: bc9623c964307a7e940a2c91ecaac530fabe70ab25ba13a769eeee608327279e50bc6cdb030bb72f6a27ca75e8f1ce5fd56abcabe54a334f58ac296dd507ced2
7
- data.tar.gz: b5c885e1f50b58f24abf9b2fdfefdb24520d36332176a904ac96e92f84fccb28be6f5a67fe1da07451ced05122e82d99d492516f4e5891a6db54d719b82f9058
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, `curl` is installed by default and the other programs can be installed
16
- with Homebrew:
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 --no-python
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 = 'different/path.yml'
95
- config.heroku_app_basename = 'different-base-name'
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
@@ -1,5 +1,7 @@
1
- require 'parity/configuration'
2
- require 'parity/environment'
3
- require 'parity/usage'
1
+ require "parity/configuration"
2
+ require "parity/environment"
3
+ require "parity/usage"
4
+ require "open3"
5
+ require "uri"
4
6
 
5
7
  Parity.configure
@@ -1,9 +1,13 @@
1
1
  module Parity
2
2
  class Configuration
3
- attr_accessor :database_config_path, :heroku_app_basename
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 = 'config/database.yml'
9
+ @database_config_path = "config/database.yml"
10
+ @redis_url_env_variable = "REDIS_URL"
7
11
  end
8
12
  end
9
13
 
@@ -9,7 +9,9 @@ module Parity
9
9
  end
10
10
 
11
11
  def run
12
- if self.class.private_method_defined?(subcommand)
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.3.1
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-10-24 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
- Devevelopment/staging/production parity is intended to decrease the time
15
- between a developer writing code and having it deployed, make it possible
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.4.1
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.