dokku-installer-cli 0.0.9.3 → 0.1.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: efdbbf29a6689ac47ae2789202110a8e53ef1217
4
- data.tar.gz: 7d40bd2280a82dda73ed896f8d824fe034e0a7b0
3
+ metadata.gz: bb69b1d5b49e5ec10f762a35e86f9c96dd0d3265
4
+ data.tar.gz: 1a00ea3628b1602afee769f3ad7732dcf37ff8f7
5
5
  SHA512:
6
- metadata.gz: 73d9b44e5313b70c54ec8019bb3f75c0f3c13dc773a29337db9eb1dbdcf07cd303a15022ffd8cbc3bbac16ce526573c11e3c7bf040c3ab4b8f806e9d6860d37a
7
- data.tar.gz: 200f2d17a313e5ecc85b52e61cd03f4b8a72fb1a136b4a38f8e944b45d3e0536d8ec0043ebe8a5c76157e24c415da749714de67e8040b96b90dd7a24662b5943
6
+ metadata.gz: b0278f0567b864c9df21593471c987f459c9d243b9b3e26a43eed04a8fa5570764670eaa9506a49e7edfa901c7b33790a73c70c684d8c24bf62ca47bbc5c3c27
7
+ data.tar.gz: fefdcc7ca36f849629a4cf176b8f67e035d7e9829efbd5e10cb0aa928891a2b352b18a1e2eb593ff000b10c48054a9cd032ef3a1db8ff77a0504550700c946fc
@@ -1,24 +1,66 @@
1
1
  module DokkuInstaller
2
2
  class Cli < Thor
3
3
 
4
- desc "ssl:certificate <file path>", "Add a signed certificate for SSL (server.crt)"
5
- def ssl_certificate(*args)
6
- file_path = args.first
7
- file_contents = File.read(file_path)
8
- command = "echo \"#{file_contents}\" | ssh dokku@#{domain} ssl:certificate #{app_name}"
4
+ # certs:add CRT KEY # Add an ssl endpoint to an app.
5
+ # certs:chain CRT [CRT ...] # Print the ordered and complete chain for the given certificate.
6
+ # certs:info # Show certificate information for an ssl endpoint.
7
+ # certs:key CRT KEY [KEY ...] # Print the correct key for the given certificate.
8
+ # certs:remove # Remove an SSL Endpoint from an app.
9
+ # certs:rollback # Rollback an SSL Endpoint for an app.
10
+ # certs:update CRT KEY # Update an SSL Endpoint on an app.
9
11
 
10
- puts "Running #{command}..."
12
+ desc "ssl:add CRT KEY", "Add an SSL endpoint."
13
+ def ssl_add(*args)
14
+ key = nil
15
+ certificate = nil
16
+ intermediate_certificates = []
17
+
18
+ args.each do |arg|
19
+ file_contents = File.read(arg)
20
+ if file_contents.include?("KEY")
21
+ key = file_contents
22
+ elsif file_contents.include?("BEGIN CERTIFICATE")
23
+ certificate = file_contents
24
+ elsif file_contents.include?("NEW CERTIFICATE REQUEST")
25
+ intermediate_certificates << file_contents
26
+ end
27
+ end
28
+
29
+ if key.nil?
30
+ puts "Missing SSL private key.\nSpecify the key, certificate, and any intermediate certificates."
31
+ exit
32
+ elsif certificate.nil?
33
+ puts "Missing SSL certificate.\nSpecify the key, certificate, and any intermediate certificates."
34
+ exit
35
+ end
36
+
37
+ puts "Adding SSL private key..."
38
+ command = "echo \"#{key}\" | ssh dokku@#{domain} ssl:key #{app_name}"
39
+ result = `#{command}`
40
+
41
+ puts "Adding SSL certificate..."
42
+ combined_certificate = certificate
43
+ if intermediate_certificates.length > 0
44
+ combined_certificate += "#{intermediate_certificates.join("\n")}\n"
45
+ end
46
+ command = "echo \"#{combined_certificate}\" | ssh dokku@#{domain} ssl:certificate #{app_name}"
11
47
  exec(command)
12
48
  end
13
49
 
14
- desc "ssl:key <file path>", "Add a private key for SSL (server.key)"
15
- def ssl_key(*args)
16
- file_path = args.first
17
- file_contents = File.read(file_path)
18
- command = "echo \"#{file_contents}\" | ssh dokku@#{domain} ssl:key #{app_name}"
50
+ desc "ssl:force DOMAIN", "Force SSL on the given domain."
51
+ def ssl_force(*args)
52
+ domain = args.first
53
+ if domain.nil?
54
+ puts "Specify a domain to force SSL."
55
+ exit
56
+ end
19
57
 
20
- puts "Running #{command}..."
21
- exec(command)
58
+ run_command "ssl:force #{app_name} #{domain}"
59
+ end
60
+
61
+ desc "ssl:remove", "Remove an SSL endpoint."
62
+ def ssl_remove
63
+ run_command "ssl:delete #{domain} #{app_name}"
22
64
  end
23
65
 
24
66
  end
@@ -1,3 +1,3 @@
1
1
  module DokkuInstaller
2
- VERSION = "0.0.9.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dokku-installer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-26 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor