ringleader 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,7 +107,7 @@ module Ringleader
107
107
 
108
108
  def reset_activity_timer
109
109
  start_activity_timer
110
- @activity_timer.reset
110
+ @activity_timer.reset if @activity_timer
111
111
  end
112
112
 
113
113
  def stop_activity_timer
@@ -35,7 +35,12 @@ module Ringleader
35
35
  elsif @starting
36
36
  wait :running
37
37
  else
38
- start_app
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
- @pid = ::Process.spawn(
104
- config.env,
105
- %Q(bash -c "#{config.command}"),
106
- :in => slave,
107
- :out => slave,
108
- :err => slave,
109
- :chdir => config.dir,
110
- :pgroup => true
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
@@ -1,3 +1,3 @@
1
1
  module Ringleader
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
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-09 00:00:00.000000000 Z
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