heroku_ssl 0.6.1 → 0.6.2

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: 6b2f9d8f3eac58664d6b0ef978806f6e1ddce126
4
- data.tar.gz: 2951332ed2adb95c02f06b0907b7f643449a6c81
3
+ metadata.gz: f1a74a4481afa7aeafe4b7d91bbeaeeeecd2ea0d
4
+ data.tar.gz: dadf4785d8616d78d91ed5f3302a656e8c5ad7ed
5
5
  SHA512:
6
- metadata.gz: a9486a38ce0485a6e4f5b3385976148d06201a69f3bb17a6d165d8dfe22e5c3eabfa21652dd59cb41204c1c7652dcfd0350410401b9ec8339d475a1f8cff63a4
7
- data.tar.gz: 9e447c5d91c2d925f831f3e234deae1a9e44a3cc7c635c55b2c6dc64cd4e024bd1f0d6187d3e348463371367987b8a34cf529f9c67114374858f6d67a0de0b5f
6
+ metadata.gz: 3055a5f62f7f7118de9cfa2a22801748ec3ae0e1e769a726c914697e792b99a4880e21160d39f6ce1c971e36270ed269db13f3940f00a925bfb2af505629cb04
7
+ data.tar.gz: 00d3881faaa14834ca195334cf7caefd7b678aa43a5a0be988e37a5e800d2e74340c22132b0686ecc9ac89222dcef5cadcd285fca3c0fc7c554021c4c4cedbba
data/README.md CHANGED
@@ -21,12 +21,7 @@ and add them to your own servers and configure the DNS yourself.
21
21
  Add this line to your application's Gemfile:
22
22
 
23
23
  ```ruby
24
- gem 'heroku-ssl'
25
- ```
26
-
27
- Or, to test the bleeding edge version:
28
- ```ruby
29
- gem 'heroku_ssl', git: 'https://github.com/KMarshland/heroku-ssl.git'
24
+ gem 'heroku_ssl'
30
25
  ```
31
26
 
32
27
  And then execute:
@@ -39,6 +34,8 @@ It also requires one of the following:
39
34
  - The environment variable `REDIS_URL` is set
40
35
  - The environment variable `HEROKU_REDIS_URL` is set
41
36
 
37
+ Note that this means you need to have a live version of redis; on Heroku the free tier will work: https://elements.heroku.com/addons/heroku-redis.
38
+
42
39
  ## Contributing
43
40
  Submit a pull request!
44
41
 
@@ -64,7 +61,7 @@ If your site is already pointed to your Heroku app, there will already be a CNAM
64
61
  you just need to change where it points to.
65
62
  If not, you'll need to add a new line:
66
63
  ```
67
- [subdomain] [TTL] IN CNAME [yourdomain].herokudns.com
64
+ [subdomain] [TTL] IN CNAME [yourdomain].herokudns.com.
68
65
  ```
69
66
 
70
67
  For example, I have
@@ -1,3 +1,3 @@
1
1
  module HerokuSsl
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
@@ -13,7 +13,7 @@ namespace :heroku_ssl do
13
13
  puts "Attempting to generate ssl certificates for #{app} (registering #{domains} to #{email})"
14
14
 
15
15
  #generate the certs on the server
16
- output = `unset RUBYOPT; heroku run rake heroku_ssl:generate_certs #{email} #{domains} --app #{app}`
16
+ output = heroku_run("run rake heroku_ssl:generate_certs #{email} #{domains} --app #{app}")
17
17
 
18
18
  #read out the certs to temporary files
19
19
  if output.include? '~~ GENERATED CERTIFICATES START ~~'
@@ -32,14 +32,13 @@ namespace :heroku_ssl do
32
32
  end
33
33
 
34
34
  # update heroku certs
35
- # RUBYOPT breaks the heroku command for some reason, so you have to unset it
36
- `unset RUBYOPT; heroku certs:update fullchain.pem privkey.pem --app #{get_app} --confirm #{get_app}`
35
+ heroku_run("certs:update fullchain.pem privkey.pem --app #{get_app} --confirm #{get_app}")
37
36
 
38
37
  # clean up
39
38
  File.delete('fullchain.pem', 'privkey.pem')
40
39
 
41
40
  puts 'Successfully updated Heroku SSL certificates! Now you just need to make sure your DNS is configured to point as follows: '
42
- puts `unset RUBYOPT; heroku domains`.split("\n")[4..-1].join("\n")
41
+ puts heroku_run('domains').split("\n")[4..-1].join("\n")
43
42
  else
44
43
  puts 'Full log: '
45
44
  puts output
@@ -95,10 +94,32 @@ namespace :heroku_ssl do
95
94
  @email = new_email
96
95
  end
97
96
 
97
+ def heroku_run(command)
98
+ # RUBYOPT breaks the heroku command for some reason, so you have to unset it
99
+ result = `unset RUBYOPT; heroku #{command}`
100
+
101
+ if result =~ /rake\saborted/i
102
+ puts "Don't know how to build task -- make sure you have deployed a version with this gem installed to heroku"
103
+ end
104
+
105
+ if result =~ /No\ssuch\sfile\sor\sdirectory/i || result =~ /command\snot\sfound/i
106
+ puts 'Cannot run command heroku -- are you sure you have it installed?'
107
+ end
108
+
109
+ if result =~ /Bundler::GemNotFound/i
110
+ puts 'Please log in to heroku by running `heroku login`'
111
+ end
112
+
113
+ result
114
+ end
115
+
98
116
  def get_domains
99
117
  return @domain if @domain.present?
100
118
 
101
- domains = `unset RUBYOPT; heroku domains`.split("\n").select(&:present?)[5..-1]
119
+ domains = heroku_run('domains').split("\n").select(&:present?)[5..-1]
120
+ if domains.blank?
121
+ raise 'Could not load domains'
122
+ end
102
123
  domains.map! do |domain|
103
124
  domain.split(/\s+/).first
104
125
  end
@@ -125,7 +146,7 @@ namespace :heroku_ssl do
125
146
  def get_app
126
147
  return @app if @app.present?
127
148
 
128
- @apps = @apps || `unset RUBYOPT; heroku apps`.split("\n")
149
+ @apps = @apps || heroku_run('apps').split("\n")
129
150
  remotes = `git remote -v`.split("\n").map do |r|
130
151
  r.split("\t").last
131
152
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_ssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kai Marshland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails