foreplay 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/lib/foreplay/engine/logger.rb +4 -1
- data/lib/foreplay/engine/port.rb +21 -10
- data/lib/foreplay/engine/steps.yml +2 -0
- data/lib/foreplay/engine.rb +10 -9
- data/lib/foreplay/version.rb +1 -1
- data/spec/lib/foreplay/deploy_spec.rb +1 -0
- 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: fd947f263c336b9ee4804c52ef96e2a324185e52
|
4
|
+
data.tar.gz: dba7b672e1ea208a90bfb78b68f3c3f0414a038d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 783a8c5a52cce85e2ea6b595484cabe6c3bb3aceb120df29f0db988bb88be629ab0053318daa224cb1fda219704dff59f5a148165df58429e2555e1b9181c6fc
|
7
|
+
data.tar.gz: 8018019cfd60afde106770c319494e1a1c52e33740cd3fd4e90772ddfd5f521ae6f7e6c715b1c3207e0e74d7b996510d53add7b7385278db04fa04a9ad5bbfca
|
data/.rubocop.yml
CHANGED
@@ -16,7 +16,10 @@ class Foreplay::Engine::Logger
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def formatted_message
|
19
|
-
@formatted_message ||= header + message
|
19
|
+
@formatted_message ||= header + message
|
20
|
+
.gsub(/\A\s*/, '')
|
21
|
+
.gsub(/\s+\z/, '')
|
22
|
+
.gsub(/(\r\n*)/, "\\1#{margin}")
|
20
23
|
end
|
21
24
|
|
22
25
|
def header
|
data/lib/foreplay/engine/port.rb
CHANGED
@@ -40,19 +40,30 @@ module Foreplay::Engine::Port
|
|
40
40
|
]
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
return @
|
43
|
+
def current_port_remote
|
44
|
+
return @current_port_remote if @current_port_remote
|
45
45
|
|
46
|
-
|
46
|
+
@current_port_remote = Foreplay::Engine::Remote
|
47
|
+
.new(server, port_steps, instructions)
|
48
|
+
.__send__(mode)
|
49
|
+
.strip!
|
50
|
+
.to_i
|
47
51
|
|
48
|
-
if
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
message = if @current_port_remote.blank?
|
53
|
+
'No instance is currently deployed'
|
54
|
+
else
|
55
|
+
"Current instance is using port #{@current_port_remote}"
|
56
|
+
end
|
57
|
+
|
58
|
+
log message, host: host
|
59
|
+
@current_port_remote
|
60
|
+
end
|
61
|
+
|
62
|
+
def port_details
|
63
|
+
return @port_details if @port_details
|
53
64
|
|
54
|
-
cp =
|
55
|
-
port = instructions['port']
|
65
|
+
cp = current_port_remote
|
66
|
+
port = instructions['port'].to_i
|
56
67
|
ports = [port + 1000, port]
|
57
68
|
cp, fp = cp == port ? ports : ports.reverse
|
58
69
|
|
@@ -14,6 +14,8 @@
|
|
14
14
|
commentary: 'If you have a .rvmrc file there may be a delay now while we install a new ruby'
|
15
15
|
- command: 'if [ -f .ruby-version ] ; then rvm install `cat .ruby-version` ; else echo "No .ruby-version file found" ; fi'
|
16
16
|
commentary: 'If you have a .ruby-version file there may be a delay now while we install a new ruby'
|
17
|
+
- command: 'rvm info'
|
18
|
+
commentary: 'Showing RVM environment'
|
17
19
|
- key: 'env'
|
18
20
|
delimiter: '='
|
19
21
|
prefix: '.'
|
data/lib/foreplay/engine.rb
CHANGED
@@ -25,26 +25,27 @@ class Foreplay::Engine
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def execute
|
28
|
-
# Explain what we're going to do
|
29
28
|
puts "#{mode.capitalize}ing #{environment.dup.yellow} environment, "\
|
30
29
|
"#{explanatory_text(filters, 'role')}, #{explanatory_text(filters, 'server')}"
|
31
30
|
|
32
|
-
actionable_roles.map
|
33
|
-
Foreplay::Engine::Role.new(
|
34
|
-
environment,
|
35
|
-
mode,
|
36
|
-
build_instructions(role, instructions)
|
37
|
-
).threads
|
38
|
-
end.flatten.each(&:join)
|
31
|
+
actionable_roles.map { |role, instructions| threads(role, instructions) }.flatten.each(&:join)
|
39
32
|
|
40
33
|
puts mode == :deploy ? 'Finished deployment' : 'Deployment configuration check was successful'
|
41
34
|
end
|
42
35
|
|
36
|
+
private
|
37
|
+
|
43
38
|
def actionable_roles
|
44
39
|
roles.select { |role, _i| role != DEFAULTS_KEY && role != filters['role'] }
|
45
40
|
end
|
46
41
|
|
47
|
-
|
42
|
+
def threads(role, instructions)
|
43
|
+
Foreplay::Engine::Role.new(
|
44
|
+
environment,
|
45
|
+
mode,
|
46
|
+
build_instructions(role, instructions)
|
47
|
+
).threads
|
48
|
+
end
|
48
49
|
|
49
50
|
def explanatory_text(hsh, key)
|
50
51
|
hsh.key?(key) ? "#{hsh[key].dup.yellow} #{key}" : "all #{key}s"
|
data/lib/foreplay/version.rb
CHANGED
@@ -137,6 +137,7 @@ describe Foreplay::Launcher do
|
|
137
137
|
'rvm rvmrc warning ignore 50000',
|
138
138
|
'gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys D39DC0E3',
|
139
139
|
'cd 50000 && mkdir -p tmp doc log config',
|
140
|
+
'rvm info',
|
140
141
|
'if [ -f .ruby-version ] ; then rvm install `cat .ruby-version` ; else echo "No .ruby-version file found" ; fi',
|
141
142
|
'echo "RAILS_ENV=production" > .env',
|
142
143
|
'echo "concurrency: web=1,worker=0,scheduler=0" > .foreman',
|