parity 0.9.3 → 0.10.0

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
  SHA1:
3
- metadata.gz: 331cbe343c824b3978907fb5665003940850b368
4
- data.tar.gz: 95dc1ca2d1586f7c8cf4568c2d1b49bb7a6a449d
3
+ metadata.gz: 3a4ad8a985dadd893a7202086e0da85996ae8558
4
+ data.tar.gz: 78c75fddf7df2acb61d2be2315a9cafab9997098
5
5
  SHA512:
6
- metadata.gz: 9429db240b7ce85573c890b9948c6dbf19e6444fa6e2f729f25f05e75ec6775dec877c07b70bcde7302cd45f83ec58f6adc7ccb23dff77c9ffabdfcc048416bd
7
- data.tar.gz: d7f40e0980b6ee4816e4e5a19bb6b95f41eb2f8020c81919c3280a3cdac8316503b8404619c6a018e4cffcc60aac67f4394d35db4e0971d46e5a9524ecc33942
6
+ metadata.gz: cca9f7f38b992e9f446ec0e5ad0b1eb745b89dd0b797c8c3ca2fb228872861eaadbb2efdbde051c22c8653f482ae4a3cd2b24b3166c475806d23b1676e06764f
7
+ data.tar.gz: 309b8d8009b6b51a354f71253d1ca5b83fa2cf158d7f17c129d0a2bc315719b84bbba8e36c5d71c7d61decb67802b75aee91ab0a2617e636165eaa7eda7f21b1
data/README.md CHANGED
@@ -97,9 +97,14 @@ Parity expects:
97
97
 
98
98
  * A `staging` remote pointing to the staging Heroku app.
99
99
  * A `production` remote pointing to the production Heroku app.
100
+ ```
101
+ heroku git:remote -r staging -a your-staging-app
102
+ heroku git:remote -r production -a your-production-app
103
+ ```
100
104
  * There is a `config/database.yml` file that can be parsed as YAML for
101
105
  `['development']['database']`.
102
106
 
107
+
103
108
  Customization
104
109
  -------------
105
110
 
data/lib/parity.rb CHANGED
@@ -3,9 +3,6 @@ $LOAD_PATH << File.expand_path("..", __FILE__)
3
3
  require "parity/version"
4
4
  require "parity/environment"
5
5
  require "parity/usage"
6
- require "erb"
7
- require "git"
8
- require "dotenv"
9
6
  require "open3"
10
7
  require "pathname"
11
8
  require "uri"
data/lib/parity/backup.rb CHANGED
@@ -65,15 +65,13 @@ module Parity
65
65
  end
66
66
 
67
67
  def development_db
68
- YAML.load(parsed_database_yml).
68
+ YAML.load(database_yaml_file).
69
69
  fetch(DEVELOPMENT_ENVIRONMENT_KEY_NAME).
70
70
  fetch(DATABASE_KEY_NAME)
71
71
  end
72
72
 
73
- def parsed_database_yml
74
- Dotenv.load
75
- yaml_file = IO.read(DATABASE_YML_RELATIVE_PATH)
76
- ERB.new(yaml_file).result
73
+ def database_yaml_file
74
+ IO.read(DATABASE_YML_RELATIVE_PATH)
77
75
  end
78
76
  end
79
77
  end
@@ -31,7 +31,7 @@ module Parity
31
31
  end
32
32
 
33
33
  def run_via_cli
34
- Kernel.system("heroku", subcommand, *arguments, "--remote", environment)
34
+ Kernel.exec("heroku", subcommand, *arguments, "--remote", environment)
35
35
  end
36
36
 
37
37
  def backup
@@ -57,9 +57,9 @@ module Parity
57
57
  end
58
58
 
59
59
  def restore
60
- if production?
60
+ if production? && !forced?
61
61
  $stdout.puts "Parity does not support restoring backups into your "\
62
- "production environment."
62
+ "production environment. Use `--force` to override."
63
63
  else
64
64
  Backup.new(
65
65
  from: arguments.first,
@@ -75,6 +75,10 @@ module Parity
75
75
  environment == "production"
76
76
  end
77
77
 
78
+ def forced?
79
+ arguments.include?("--force")
80
+ end
81
+
78
82
  def additional_restore_arguments
79
83
  (arguments.drop(1) + [restore_confirmation_argument]).
80
84
  compact.
@@ -88,19 +92,19 @@ module Parity
88
92
  end
89
93
 
90
94
  def console
91
- Kernel.system("heroku run rails console --remote #{environment}")
95
+ Kernel.system(command_for_remote("run rails console"))
92
96
  end
93
97
 
94
98
  def migrate
95
99
  Kernel.system(%{
96
- heroku run rake db:migrate --remote #{environment} &&
97
- heroku restart --remote #{environment}
100
+ #{command_for_remote('run rake db:migrate')} &&
101
+ #{command_for_remote('restart')}
98
102
  })
99
103
  end
100
104
 
101
105
  def tail
102
106
  Kernel.system(
103
- "heroku logs --tail #{arguments.join(" ")} --remote #{environment}"
107
+ command_for_remote("logs --tail #{arguments.join(' ')}"),
104
108
  )
105
109
  end
106
110
 
@@ -119,18 +123,20 @@ module Parity
119
123
  end
120
124
 
121
125
  def raw_redis_url
122
- @redis_to_go_url ||= Open3.capture3(
123
- "heroku config:get REDIS_URL "\
124
- "--remote #{environment}"
125
- )[0].strip
126
+ @redis_to_go_url ||= Open3.
127
+ capture3(command_for_remote("config:get REDIS_URL"))[0].
128
+ strip
126
129
  end
127
130
 
128
- def git_remote
129
- Git.init.remote(environment).url
131
+ def heroku_app_name
132
+ @heroku_app_name ||= Open3.
133
+ capture3(command_for_remote("info"))[0].
134
+ split("\n")[0].
135
+ gsub(/(\s|=)+/, "")
130
136
  end
131
137
 
132
- def heroku_app_name
133
- git_remote.split(":").last.split(".").first
138
+ def command_for_remote(command)
139
+ "heroku #{command} --remote #{environment}"
134
140
  end
135
141
 
136
142
  def run_migrations?
@@ -1,3 +1,3 @@
1
1
  module Parity
2
- VERSION = "0.9.3".freeze
2
+ VERSION = "0.10.0".freeze
3
3
  end
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: 0.9.3
4
+ version: 0.10.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: 2016-04-15 00:00:00.000000000 Z
12
+ date: 2016-07-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |2
15
15
  Development/staging/production parity makes it easier for
@@ -52,8 +52,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  requirements: []
54
54
  rubyforge_project:
55
- rubygems_version: 2.4.5
55
+ rubygems_version: 2.5.0
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Shell commands for development, staging, and production parity.
59
59
  test_files: []
60
+ has_rdoc: