foreplay 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +2 -16
- data/lib/foreplay/deploy.rb +9 -5
- data/lib/foreplay/version.rb +1 -1
- data/spec/lib/foreplay/deploy_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40ecad41c642ecdf2e8d7065abd53ecbfbdeff89
|
|
4
|
+
data.tar.gz: 3b799e936ea62c6a037142d03b239cdf1888108e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd8f8adc7ca2f3645ae6f6d0fed910524a60343909bd6f97d8ffeaf3d5ef648ca775161625c5ae5011e76e5f60361ce56c4c44ac93da83ad5a9390ce1ac4e9db
|
|
7
|
+
data.tar.gz: 5b718a0c95491f62035a6a3665cb11029ba5e3e03c4f5fc132a85de1141dca528b935d970d49fa77aa83707ed06afda40ec6d8ed20fa01ec8057ec20adb902c3
|
data/README.md
CHANGED
|
@@ -12,15 +12,12 @@ I noticed with surprise on [RubyGems](https://rubygems.org/gems/foreplay) that m
|
|
|
12
12
|
There's now a CLI for the gem so you can use it as follows. To check what it's going to do:
|
|
13
13
|
|
|
14
14
|
foreplay check production
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
...and if you're brave enough to try it for real:
|
|
17
17
|
|
|
18
18
|
foreplay deploy production
|
|
19
|
-
|
|
20
|
-
...after you've set it up by creating a `config/foreplay.yml` file.
|
|
21
|
-
|
|
22
|
-
Don't read any further. It's all rubbish below here :-)
|
|
23
19
|
|
|
20
|
+
...after you've set it up by creating a `config/foreplay.yml` file.
|
|
24
21
|
|
|
25
22
|
## Installation
|
|
26
23
|
|
|
@@ -36,17 +33,6 @@ Or install it yourself as:
|
|
|
36
33
|
|
|
37
34
|
$ gem install foreplay
|
|
38
35
|
|
|
39
|
-
## Usage
|
|
40
|
-
|
|
41
|
-
ENV=production rake foreplay:push
|
|
42
|
-
|
|
43
|
-
or
|
|
44
|
-
|
|
45
|
-
ENV=production ROLE=web rake foreplay:push
|
|
46
|
-
|
|
47
|
-
You can set the environment variables `ENV` and `ROLE` elsewhere if you wish.
|
|
48
|
-
If `ROLE` is not defined then we deploy all roles.
|
|
49
|
-
|
|
50
36
|
### How it works
|
|
51
37
|
|
|
52
38
|
Foreplay does this:
|
data/lib/foreplay/deploy.rb
CHANGED
|
@@ -199,7 +199,7 @@ module Foreplay
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
def execute_on_server steps, instructions
|
|
202
|
-
|
|
202
|
+
server_port = instructions[:server]
|
|
203
203
|
user = instructions[:user]
|
|
204
204
|
password = instructions[:password]
|
|
205
205
|
keyfile = instructions[:keyfile]
|
|
@@ -207,8 +207,12 @@ module Foreplay
|
|
|
207
207
|
|
|
208
208
|
keyfile.sub! '~', ENV['HOME'] || '/' unless keyfile.blank? # Remote shell won't expand this for us
|
|
209
209
|
|
|
210
|
+
# Parse server + port
|
|
211
|
+
server, port = server_port.split(':')
|
|
212
|
+
port ||= 22
|
|
213
|
+
|
|
210
214
|
# SSH authentication methods
|
|
211
|
-
options = { :verbose => :warn }
|
|
215
|
+
options = { :verbose => :warn, :port => port }
|
|
212
216
|
|
|
213
217
|
if password.blank?
|
|
214
218
|
# If there's no password we must supply a private key
|
|
@@ -231,12 +235,12 @@ module Foreplay
|
|
|
231
235
|
output = ''
|
|
232
236
|
|
|
233
237
|
if mode == :deploy
|
|
234
|
-
puts "#{INDENT}Connecting to #{server}"
|
|
238
|
+
puts "#{INDENT}Connecting to #{server} on port #{port}"
|
|
235
239
|
|
|
236
240
|
# SSH connection
|
|
237
241
|
begin
|
|
238
242
|
Net::SSH.start(server, user, options) do |session|
|
|
239
|
-
puts "#{INDENT}Successfully connected to #{server}"
|
|
243
|
+
puts "#{INDENT}Successfully connected to #{server} on port #{port}"
|
|
240
244
|
|
|
241
245
|
session.shell do |sh|
|
|
242
246
|
steps.each do |step|
|
|
@@ -265,7 +269,7 @@ module Foreplay
|
|
|
265
269
|
end
|
|
266
270
|
end
|
|
267
271
|
rescue SocketError => e
|
|
268
|
-
terminate "There was a problem starting an ssh session on #{
|
|
272
|
+
terminate "There was a problem starting an ssh session on #{server_port}:\n#{e.message}"
|
|
269
273
|
end
|
|
270
274
|
else
|
|
271
275
|
# Deployment check: just say what we would have done
|
data/lib/foreplay/version.rb
CHANGED
|
@@ -60,7 +60,7 @@ describe Foreplay::Deploy do
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it "should deploy to the environment" do
|
|
63
|
-
Net::SSH.should_receive(:start).with('web.example.com', 'fred', { :verbose => :warn, :password => 'trollope' }).and_yield(session)
|
|
63
|
+
Net::SSH.should_receive(:start).with('web.example.com', 'fred', { :verbose => :warn, :port => 22, :password => 'trollope' }).and_yield(session)
|
|
64
64
|
|
|
65
65
|
[
|
|
66
66
|
'mkdir -p .foreplay && touch .foreplay/foreplay/current_port && cat .foreplay/foreplay/current_port',
|