letsencrypt_heroku 0.2.12 → 0.2.13

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: 2d5bd387cafb45b279e06f220f6870491972db79
4
- data.tar.gz: c2b3138b060f3787c2773c662d34def92ef279e4
3
+ metadata.gz: 8eb284598baf493d90c746fc8e02e35b651876b6
4
+ data.tar.gz: 4c5ccbfee1f1acc8b41ad2a26fd3b7829592cd23
5
5
  SHA512:
6
- metadata.gz: 68383095bfa7caebdbcb16067dfe269023ad6165f896555d76abe56bec75bb38f397ff8c8f607784b6dcf4979cc4922e73b8713fecddbc9e054417314ca2d047
7
- data.tar.gz: cd545ffbd89bb3713a89323964131d39bd2ea320cb2277be03852835cf0d69c57fd5ec9f10a312cc8633886e4ba9fc1e509a19dd8618671987c8350f20035980
6
+ metadata.gz: 4a82db26f2f7c8f2bbb7b8c1831cdf9f964a0749a7e39d61c2fbbcf4597e7c796afba7a1f8475a65f51f1734a550291a7acbf8558d7f183dd6f2a21bf17a9875
7
+ data.tar.gz: 1f0923bdbd8a2036a1e59790e87d051d08d71d1bee4993d5cca2295e06b18d62be3c3852eece560d564fd15aa0fe844cce73c89a7bbd6eeac018f0e8fcf61273
data/README.md CHANGED
@@ -39,6 +39,14 @@ To perform SSL certificate setup and renewal a command line tool is used: `letse
39
39
 
40
40
  `letsencrypt_rack` contains a tiny rack middleware, that answers challenge request at the following path: `/.well-known/acme-challenge`. It serves the contents of the `LETSENCRYPT_RESPONSE` environment variable.
41
41
 
42
+ #### For non rails apps
43
+
44
+ You need to add `LetsencryptRack::Middleware` to your rack stack:
45
+
46
+ ```ruby
47
+ # in config.ru
48
+ use LetsencryptRack::Middleware
49
+ ```
42
50
 
43
51
  ### Configuration
44
52
 
@@ -85,6 +93,17 @@ Once the process ran through the renewal is as simple as: run `letsencrypt_herok
85
93
  You'll receive emails from letsencrypt from time to time to remind you to renew your certificates.
86
94
 
87
95
 
96
+ ### CLI options
97
+
98
+
99
+ ```ruby
100
+ # Use a custom config file location
101
+ $ letsencrypt_heroku --config=another.yml
102
+
103
+ # Restrict for which domains the process should be run
104
+ $ letsencrypt_heroku --limit=foobar
105
+ ```
106
+
88
107
  ## Useful links and information
89
108
 
90
109
  * https://www.ssllabs.com/ssltest
@@ -1,40 +1,26 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
+ require 'slop'
4
5
  require 'letsencrypt_heroku'
5
- require 'optparse'
6
6
 
7
- class Parser
8
- def self.parse(options)
9
- args = {}
7
+ opts = Slop.parse do |o|
8
+ o.string '-c', '--config',
9
+ 'path to config file (default: config/letsencrypt_heroku.yml)',
10
+ default: 'config/letsencrypt_heroku.yml'
10
11
 
11
- opt_parser = OptionParser.new do |opts|
12
- opts.banner = "Usage: letsencrypt_heroku [options]"
12
+ o.string '-l', '--limit',
13
+ 'include only hosts that match the given string'
13
14
 
14
- # opts.on("-rNAME", "--restriction=NAME", "Restrict process to config entries where at least one domain matches the given value") do |restriction|
15
- # args[:restriction] = restriction
16
- # end
15
+ o.bool '-h', '--help',
16
+ 'print this helpful information'
17
17
 
18
- # opts.on("-s", "--setup", "Generate config and put it into config/letsencrypt_heroku.yml") do |n|
19
- # LetsencryptHeroku::ConfigBuilder.new.perform
20
- # exit
21
- # end
22
-
23
- # opts.on("-c", "--check", "Parse config and print problems") do |n|
24
- # puts "perform check"
25
- # exit
26
- # end
27
-
28
- opts.on("-h", "--help", "Prints this help") do
29
- puts opts
30
- exit
31
- end
32
- end
18
+ o.on('-v', '--version', 'print the version') { puts LetsencryptHeroku::VERSION ; exit }
19
+ end
33
20
 
34
- opt_parser.parse!(options)
35
- return args
36
- end
21
+ if opts.help?
22
+ puts opts
23
+ exit
37
24
  end
38
- options = Parser.parse ARGV
39
25
 
40
- LetsencryptHeroku::CLI.run
26
+ LetsencryptHeroku::CLI.run(opts)
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'rainbow'
22
22
  spec.add_dependency 'acme-client'
23
23
  spec.add_dependency 'tty-spinner'
24
+ spec.add_dependency 'slop'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.12'
26
27
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -6,6 +6,7 @@ require 'openssl'
6
6
  require 'logger'
7
7
  require 'ostruct'
8
8
  require 'open3'
9
+ require 'fileutils'
9
10
  require 'letsencrypt_heroku/version'
10
11
  require 'letsencrypt_heroku/tools'
11
12
  require 'letsencrypt_heroku/process'
@@ -19,16 +20,23 @@ module LetsencryptHeroku
19
20
  class CLI
20
21
  CONFIG_FILE = 'config/letsencrypt_heroku.yml'
21
22
 
22
- # generate config?
23
+ def self.run(opts)
24
+ entries = read_config_file(opts[:config])
25
+ entries = limit_entries(entries, opts[:limit])
26
+ entries.each { |entry| Process.new(entry).perform }
27
+ end
23
28
 
24
- # limit to domain, skip other configs
29
+ def self.limit_entries(entries, limit)
30
+ return entries if limit.nil?
31
+ puts "Restrict to domains including: #{Rainbow(limit).yellow}"
32
+ entries.select { |c| c.domains.include?(limit) }
33
+ end
25
34
 
26
- def self.run
27
- if File.exist?(CONFIG_FILE)
28
- configs = Array(YAML.load(File.read(CONFIG_FILE))).map { |c| OpenStruct.new(c) }
29
- configs.each { |config| Process.new(config).perform }
35
+ def self.read_config_file(file)
36
+ if File.exist?(file)
37
+ Array(YAML.load(File.read(file))).map { |c| OpenStruct.new(c) }
30
38
  else
31
- puts Rainbow("Missing config: #{CONFIG_FILE}").red
39
+ abort "Config file not found: #{Rainbow(file).red}"
32
40
  end
33
41
  end
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module LetsencryptHeroku
2
- VERSION = "0.2.12"
2
+ VERSION = "0.2.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letsencrypt_heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Opper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: slop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement