foreman 0.41.0 → 0.42.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,15 @@
1
1
  <%
2
+ app_names = []
2
3
  engine.procfile.entries.each do |process|
3
4
  next if (conc = self.concurrency[process.name]) < 1
4
5
  1.upto(self.concurrency[process.name]) do |num|
5
6
  port = engine.port_for(process, num, self.port)
6
7
  name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
7
- environment = (engine.environment.each_pair { |var,env| "#{var.upcase}=#{env}" }.to_a << "PORT=#{port}")
8
+ environment = (engine.environment.map{ |var,env| "#{var.upcase}=#{env}" } + ["PORT=#{port}"])
9
+ app_name = "#{app}-#{name}"
10
+ app_names << app_name
8
11
  %>
9
- [program:<%= app %>-<%= name %>]
12
+ [program:<%= app_name %>]
10
13
  command=<%= process.command %>
11
14
  autostart=true
12
15
  autorestart=true
@@ -18,4 +21,7 @@ directory=<%= engine.directory %>
18
21
  environment=<%= environment.join(',') %><%
19
22
  end
20
23
  end
21
- %>
24
+ %>
25
+
26
+ [group:<%= app %>]
27
+ programs=<%= app_names.join(',') %>
@@ -51,6 +51,22 @@ class Foreman::Engine
51
51
  environment.each { |k,v| ENV[k] = v }
52
52
  end
53
53
 
54
+ def self.read_environment(filename)
55
+ return {} unless File.exists?(filename)
56
+
57
+ File.read(filename).split("\n").inject({}) do |hash, line|
58
+ if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
59
+ key, val = [$1, $2]
60
+ case val
61
+ when /\A'(.*)'\z/ then hash[key] = $1
62
+ when /\A"(.*)"\z/ then hash[key] = $1.gsub(/\\(.)/, '\1')
63
+ else hash[key] = val
64
+ end
65
+ end
66
+ hash
67
+ end
68
+ end
69
+
54
70
  private ######################################################################
55
71
 
56
72
  def spawn_processes
@@ -195,26 +211,10 @@ private ######################################################################
195
211
 
196
212
  (filenames || "").split(",").map(&:strip).each do |filename|
197
213
  error "No such file: #{filename}" unless File.exists?(filename)
198
- environment.merge!(read_environment(filename))
214
+ environment.merge!(Foreman::Engine.read_environment(filename))
199
215
  end
200
216
 
201
- environment.merge!(read_environment(".env")) unless filenames
217
+ environment.merge!(Foreman::Engine.read_environment(".env")) unless filenames
202
218
  environment
203
219
  end
204
-
205
- def read_environment(filename)
206
- return {} unless File.exists?(filename)
207
-
208
- File.read(filename).split("\n").inject({}) do |hash, line|
209
- if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
210
- key, val = [$1, $2]
211
- case val
212
- when /\A'(.*)'\z/ then hash[key] = $1
213
- when /\A"(.*)"\z/ then hash[key] = $1.gsub(/\\(.)/, '\1')
214
- else hash[key] = val
215
- end
216
- end
217
- hash
218
- end
219
- end
220
220
  end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.41.0"
3
+ VERSION = "0.42.0"
4
4
 
5
5
  end
@@ -30,7 +30,7 @@ describe Foreman::Export::Supervisord, :fakefs do
30
30
 
31
31
  it "exports to the filesystem with concurrency" do
32
32
  supervisord.export
33
-
33
+
34
34
  File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-alpha-2.conf")
35
35
  end
36
36
  end
@@ -46,7 +46,7 @@ describe Foreman::Export::Supervisord, :fakefs do
46
46
 
47
47
  it "can export with alternate template files" do
48
48
  supervisord.export
49
-
49
+
50
50
  File.read("/tmp/init/app.conf").should == "alternate_template\n"
51
51
  end
52
52
  end
@@ -19,3 +19,6 @@ stderr_logfile=/var/log/app/alpha-2-err.log
19
19
  user=app
20
20
  directory=/tmp/app
21
21
  environment=PORT=5001
22
+
23
+ [group:app]
24
+ programs=app-alpha-1,app-alpha-2
@@ -19,3 +19,6 @@ stderr_logfile=/var/log/app/bravo-1-err.log
19
19
  user=app
20
20
  directory=/tmp/app
21
21
  environment=PORT=5100
22
+
23
+ [group:app]
24
+ programs=app-alpha,app-bravo
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.42.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-16 00:00:00.000000000 Z
12
+ date: 2012-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70166560574240 !ruby/object:Gem::Requirement
16
+ requirement: &70264218748020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.13.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70166560574240
24
+ version_requirements: *70264218748020
25
25
  description: Process manager for applications with multiple components
26
26
  email: ddollar@gmail.com
27
27
  executables:
@@ -110,18 +110,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  - - ! '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
- segments:
114
- - 0
115
- hash: 4054055636504419796
116
113
  required_rubygems_version: !ruby/object:Gem::Requirement
117
114
  none: false
118
115
  requirements:
119
116
  - - ! '>='
120
117
  - !ruby/object:Gem::Version
121
118
  version: '0'
122
- segments:
123
- - 0
124
- hash: 4054055636504419796
125
119
  requirements: []
126
120
  rubyforge_project:
127
121
  rubygems_version: 1.8.11