deploy-cli 0.2.6 → 0.2.7

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: e7cf3270481ef86c63b8cfd3f2cac965e6fba3aa
4
- data.tar.gz: 7755eabaa18391a01b05c4dfc2d1925de50fa34f
3
+ metadata.gz: 8fdca0bc0a30fe6a4b98de52c518f3e7ab85778c
4
+ data.tar.gz: d2765b70eeb9d42d6f70a7f05dcb45c5427ba971
5
5
  SHA512:
6
- metadata.gz: 38dd6ff3b78a678ec056af244749ba2ada9c7d16bf014741f711a5ca2b8a2f000cdc035d5771db34c7290fdb6bbc3ba5612d051a6031b654abf0209b86b1880e
7
- data.tar.gz: 41c26213d1b484ba6f5a789436f203e527390997fb2e54a44dc8bcae264b552d7763074ad55d5b1a8230488be0fe4d2b2be9673d37afad675ccd71711d2e2653
6
+ metadata.gz: facfb01b5210a795e564ed0202e1a7fc78005c4a770725f44d1a81fe4cbf4b05d4393ca777edf5ea42bb4c25ef1a0b00a157635adeef0d95edaa1e230bc8cd17
7
+ data.tar.gz: d6475471cb610ba4b56d4c2240645236b73b34894046a0e67ddf88ce3c90f130364aaf9d3bdc52d5e4db69ba1bfe50b042ec160f4657cfa0c3a4b7e5575b7b24
data/app.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ require "sinatra"
3
+
4
+
5
+ get "/" do
6
+ return <<-EOS
7
+ <h1>Deploy</h1>
8
+ <a href="/deploy/live">KMK Live</a>
9
+ <a href="/deploy/stage">KMK Stage</a>
10
+ EOS
11
+ asa
12
+ end
13
+
14
+ get "/deploy/:name" do
15
+ name = params[:name]
16
+ out = `./bin/deploy to #{name} --key ./keys/heroku`
17
+ "<h1>Deploy to #{name}</h1><pre>#{out}</pre>"
18
+ end
data/bin/deploy CHANGED
@@ -8,7 +8,8 @@ require "deploy"
8
8
 
9
9
  module Deploy
10
10
  class Cli < Thor
11
- class_option :file
11
+ class_option :file, :type => :string
12
+ class_option :key, :type => :string
12
13
 
13
14
  desc "version", "Show the current version"
14
15
  def version
@@ -65,6 +66,7 @@ module Deploy
65
66
  def _from_yaml file, stage
66
67
  data = YAML.load_file(file)
67
68
  spec = data[stage.to_s]
69
+ spec[:key] = options[:key] if options[:key]
68
70
  Deploy::Runner.run spec
69
71
  end
70
72
 
@@ -0,0 +1,10 @@
1
+
2
+
3
+ __autocomplete_deploy() {
4
+ COMPREPLY=()
5
+ local current="${COMP_WORDS[COMP_CWORD]}"
6
+ local options="$(deploy ls)"
7
+ COMPREPLY=($(compgen -W "$options" -- "$current"))
8
+ }
9
+
10
+ complete -F __autocomplete_deploy deploy
data/keys/heroku ADDED
@@ -0,0 +1,51 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIJKAIBAAKCAgEA2cdUU6yB5zfmHVPP5yFpZO6k5LilIElfpJ5XpsH+a7JOVHH3
3
+ 5xlra+H13edgZJn0Jwbiut6Wf5TvtoXDauBYmwd4oIG+Kw9b1R3urP4kdjwoIItC
4
+ PCPS6Y2wOaAWyy6Y8fG8RpZmwe6GXF0Lq6QckJYJZIHHBlvhMnL8dvYDROo8qRtA
5
+ zDkx7EY81NBavzP53N/liX88uVFFQhlvT3Qg4CVH7kAth4xoZ6H0iOaghvGbPFTr
6
+ ho3MAXZK/CTeW0IY1dGaUQpvkhsEZEKuha6dBEBC6MkrB8R0tCKDRHIPFk8QenYc
7
+ 2Esf7lI/Q3a16shdoqsbat/BcLF2kPEqk+optEZvaRPOfhp9KYtnU94RTnwDHunV
8
+ /tLz6/Oc1kci0oqb5Dc8TM2Eh0+JJWyQdYH0R2M/xLNLfeTpoRmN92LAMd0hVcPK
9
+ MfGlmgz498VFO3QiIXFbxkgzeLXsIpXuOfRMYdzNYUL4yxG6yNvEEN079ezPw3bJ
10
+ 0bjJR38/pP1iUgCAA9SRrylHC12YUd+EeI/uZPqul6h0YVNR+Y3pMPcbTksbyzZZ
11
+ xOpS8wVJ4kZc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OfAMe6dX+0vPr85zWRyLSipvkNzxMzYSHT4klbJB1gfRHYz/Es0t95OmhGY33YsAx3SFVw8ox8aWaDPj3xUU7dCIhcVvGSDN4tewile459Exh3M1hQvjLEbrI28QQ3Tv17M/DdsnRuMlHfz+k/WJSAIAD1JGvKUcLXZhR34R4j+5k+q6XqHRhU1H5jekw9xtOSxvLNlnE6lLzBUniRlyKMnq2UAQrxeWCpBGWIku9Wju4FkqtIgaGTZfqnLDsYtFdarGod2qNKbIlzBhLspJISkBlKHJ0IBXP3gk6ByKiCqlZutGa9RyP4T2UlVOmA8OUnw== heroku
data/lib/deploy/runner.rb CHANGED
@@ -23,6 +23,8 @@ module Deploy
23
23
  ok = true
24
24
  tasks "BEFORE", @before
25
25
 
26
+ cmd "ssh-add #{@spec[:key]} 2>/dev/null" if @spec[:key]
27
+
26
28
  @spec["servers"].each do |server|
27
29
  log "[Server #{server}]", BLUE
28
30
 
@@ -151,27 +153,27 @@ module Deploy
151
153
  ]
152
154
  }.to_json
153
155
 
154
- # puts "curl -s -X POST --data-urlencode 'payload=#{payload}' #{url}"
155
156
  `curl -s -X POST --data-urlencode 'payload=#{payload}' #{url}`
156
157
  end
157
158
 
158
159
  private
159
160
  def ssh(server, cmd)
160
161
  full = "ssh -A #{@spec['user']}@#{server}"
162
+ full += " -i #{@spec['key']}" if @spec['key']
161
163
  full += " 'cd #{@spec['path']} && #{cmd}'"
162
164
  output = `#{full}`.chomp
165
+ puts full
163
166
  code = $?.exitstatus
164
167
  abort "Command <#{full}> failed with status #{code}." if code != 0
165
168
  output
166
169
  end
167
170
 
168
- # def which_branch
169
- # ssh "git rev-parse --abbrev-ref HEAD"
170
- # end
171
- #
172
- # def which_remote
173
- # ssh "git rev-parse --abbrev-ref HEAD"
174
- # end
171
+ def cmd(cmd)
172
+ output = `#{cmd}`.chomp
173
+ code = $?.exitstatus
174
+ abort "Command <#{full}> failed with status #{code}." if code != 0
175
+ output
176
+ end
175
177
 
176
178
  def log(message, color = BLACK)
177
179
  puts "\033[#{color}m#{message}\033[0m"
@@ -1,5 +1,5 @@
1
1
  module Deploy
2
2
 
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ptdorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -51,8 +51,12 @@ files:
51
51
  - Gemfile.lock
52
52
  - Rakefile
53
53
  - Readme.md
54
+ - app.rb
54
55
  - bin/deploy
55
56
  - deploy-cli.gemspec
57
+ - deploy-completion.bash
58
+ - keys/heroku
59
+ - keys/heroku.pub
56
60
  - lib/deploy.rb
57
61
  - lib/deploy/runner.rb
58
62
  - lib/deploy/version.rb