ringleader 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ringleader/app.rb +1 -1
- data/lib/ringleader/process.rb +26 -15
- data/lib/ringleader/version.rb +1 -1
- data/ringleader.gemspec +1 -0
- metadata +21 -2
data/lib/ringleader/app.rb
CHANGED
data/lib/ringleader/process.rb
CHANGED
@@ -35,7 +35,12 @@ module Ringleader
|
|
35
35
|
elsif @starting
|
36
36
|
wait :running
|
37
37
|
else
|
38
|
-
|
38
|
+
if already_running?
|
39
|
+
warn "#{config.name} already running on port #{config.app_port}"
|
40
|
+
return true
|
41
|
+
else
|
42
|
+
start_app
|
43
|
+
end
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
@@ -90,25 +95,22 @@ module Ringleader
|
|
90
95
|
#
|
91
96
|
# Returns true if the app started, false if not.
|
92
97
|
def start_app
|
93
|
-
if already_running?
|
94
|
-
warn "#{config.name} already running on port #{config.app_port}"
|
95
|
-
return true
|
96
|
-
end
|
97
|
-
|
98
98
|
@starting = true
|
99
99
|
info "starting process `#{config.command}`"
|
100
100
|
|
101
101
|
# give the child process a terminal so output isn't buffered
|
102
102
|
@master, slave = PTY.open
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
103
|
+
in_clean_environment do
|
104
|
+
@pid = ::Process.spawn(
|
105
|
+
config.env,
|
106
|
+
%Q(bash -c "#{config.command}"),
|
107
|
+
:in => slave,
|
108
|
+
:out => slave,
|
109
|
+
:err => slave,
|
110
|
+
:chdir => config.dir,
|
111
|
+
:pgroup => true
|
112
|
+
)
|
113
|
+
end
|
112
114
|
slave.close
|
113
115
|
proxy_output @master
|
114
116
|
debug "started with pid #{@pid}"
|
@@ -157,6 +159,15 @@ module Ringleader
|
|
157
159
|
end
|
158
160
|
end
|
159
161
|
|
162
|
+
# Private: execute a command in a clean environment (bundler)
|
163
|
+
def in_clean_environment(&block)
|
164
|
+
if Object.const_defined?(:Bundler)
|
165
|
+
::Bundler.with_clean_env(&block)
|
166
|
+
else
|
167
|
+
yield
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
160
171
|
end
|
161
172
|
|
162
173
|
end
|
data/lib/ringleader/version.rb
CHANGED
data/ringleader.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_dependency "rainbow", "~> 1.1.4"
|
24
24
|
gem.add_dependency "color", "~> 1.4.1"
|
25
25
|
|
26
|
+
gem.add_development_dependency "rake"
|
26
27
|
gem.add_development_dependency "rspec", "~> 2.11.0"
|
27
28
|
gem.add_development_dependency "guard-rspec"
|
28
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ringleader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 1.4.1
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
- !ruby/object:Gem::Dependency
|
111
127
|
name: rspec
|
112
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,6 +240,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
240
|
- - ! '>='
|
225
241
|
- !ruby/object:Gem::Version
|
226
242
|
version: '0'
|
243
|
+
segments:
|
244
|
+
- 0
|
245
|
+
hash: -834861029563874532
|
227
246
|
requirements: []
|
228
247
|
rubyforge_project:
|
229
248
|
rubygems_version: 1.8.24
|