Compare commits

...
15 Commits
Author SHA1 Message Date
David Dollar 047f1ff5c4 0.45.0 2012-04-26 17:49:35 -04:00
David Dollar 26b54a62c5 Merge pull request #188 from technomancy/upstart-log-dir
Create and chown log dir in upstart export.
2012-04-24 17:50:42 -07:00
Phil Hagelberg 7b85ad7c1a Create and chown log dir in upstart export. 2012-04-24 17:24:53 -07:00
David Dollar f46408e8be remove parka from dist files 2012-04-23 16:00:27 -04:00
David Dollar 93f04e42ac update docs 2012-04-23 15:57:06 -04:00
David Dollar 97c4582acc changelog 2012-04-23 15:57:00 -04:00
David Dollar 5689d75a87 0.44.0 2012-04-23 15:55:56 -04:00
David Dollar 1325b6750e make var output order repeatable 2012-04-23 15:53:59 -04:00
David Dollar 638005403f clean up file/directory interaction, add some tests 2012-04-23 15:50:23 -04:00
David Dollar 55f274532f Merge pull request #183 from technomancy/app_root
Look for .env and app_root in the same dir as the Procfile.
2012-04-23 12:20:10 -07:00
Phil Hagelberg 66f76c2036 Look for .env and app_root in the same dir as the Procfile. 2012-04-20 20:59:37 -07:00
David Dollar 865cabb525 update docs 2012-04-20 19:33:14 -04:00
David Dollar 7c3c4bc58f add more options to the start docs 2012-04-20 19:33:11 -04:00
David Dollar 2dbe8c733b update docs 2012-04-20 17:42:47 -04:00
David Dollar 84352b82cc changelog 2012-04-20 17:42:33 -04:00
14 changed files with 74 additions and 11 deletions
+10
View File
@@ -1,3 +1,13 @@
## 0.44.0 (2012-04-23)
* make var output order repeatable in supervisord export [David Dollar]
* make --procfile and --app-root influence each other in a more intuitive way [David Dollar]
* Look for .env and app_root in the same dir as the Procfile. [Phil Hagelberg]
## 0.43.0 (2012-04-20)
* wrap supervisord env vars in quotes [Raphael Randschau]
## 0.42.0 (2012-04-18) ## 0.42.0 (2012-04-18)
* Move read_environment to a public class method. [Phil Hagelberg] * Move read_environment to a public class method. [Phil Hagelberg]
+1 -1
View File
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
foreman (0.43.0) foreman (0.45.0)
thor (>= 0.13.6) thor (>= 0.13.6)
GEM GEM
+1 -1
View File
@@ -5,7 +5,7 @@ engine.procfile.entries.each do |process|
1.upto(self.concurrency[process.name]) do |num| 1.upto(self.concurrency[process.name]) do |num|
port = engine.port_for(process, num, self.port) port = engine.port_for(process, num, self.port)
name = if (conc > 1); "#{process.name}-#{num}" else process.name; end name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
environment = (engine.environment.map{ |var,env| %{#{var.upcase}="#{env}"} } + [%{PORT="#{port}"}]) environment = (engine.environment.keys.sort.map{ |var| %{#{var.upcase}="#{engine.environment[var]}"} } + [%{PORT="#{port}"}])
app_name = "#{app}-#{name}" app_name = "#{app}-#{name}"
app_names << app_name app_names << app_name
%> %>
+1 -1
View File
@@ -10,5 +10,5 @@ task "gem:clean" do
end end
task "gem:release" => "gem:build" do |t| task "gem:release" => "gem:build" do |t|
sh "parka push -f #{pkg("foreman-#{version}.gem")}" sh "gem push #{pkg("foreman-#{version}.gem")} || echo 'error'"
end end
+1 -1
View File
@@ -12,5 +12,5 @@ task "jruby:clean" do
end end
task "jruby:release" => "jruby:build" do |t| task "jruby:release" => "jruby:build" do |t|
sh "parka push -f #{pkg("foreman-#{version}-jruby.gem")}" sh "gem push #{pkg("foreman-#{version}-jruby.gem")} || echo 'error'"
end end
+1 -1
View File
@@ -12,5 +12,5 @@ task "mingw32:clean" do
end end
task "mingw32:release" => "mingw32:build" do |t| task "mingw32:release" => "mingw32:build" do |t|
sh "parka push -f #{pkg("foreman-#{version}-mingw32.gem")}" sh "gem push #{pkg("foreman-#{version}-mingw32.gem")} || echo 'error'"
end end
+5 -1
View File
@@ -83,7 +83,11 @@ private ######################################################################
end end
def procfile def procfile
options[:procfile] || "Procfile" case
when options[:procfile] then options[:procfile]
when options[:app_root] then File.expand_path(File.join(options[:app_root], "Procfile"))
else "Procfile"
end
end end
def error(message) def error(message)
+9 -2
View File
@@ -24,8 +24,10 @@ class Foreman::Engine
@procfile = Foreman::Procfile.new(procfile) @procfile = Foreman::Procfile.new(procfile)
@directory = options[:app_root] || File.expand_path(File.dirname(procfile)) @directory = options[:app_root] || File.expand_path(File.dirname(procfile))
@options = options.dup @options = options.dup
@environment = read_environment_files(options[:env])
@output_mutex = Mutex.new @output_mutex = Mutex.new
@options[:env] ||= default_env
@environment = read_environment_files(@options[:env])
end end
def start def start
@@ -214,7 +216,12 @@ private ######################################################################
environment.merge!(Foreman::Engine.read_environment(filename)) environment.merge!(Foreman::Engine.read_environment(filename))
end end
environment.merge!(Foreman::Engine.read_environment(".env")) unless filenames
environment environment
end end
def default_env
env = File.join(directory, ".env")
File.exists?(env) ? env : ""
end
end end
+3 -1
View File
@@ -36,6 +36,8 @@ class Foreman::Export::Upstart < Foreman::Export::Base
write_file "#{location}/#{app}-#{process.name}-#{num}.conf", process_config write_file "#{location}/#{app}-#{process.name}-#{num}.conf", process_config
end end
end end
end
FileUtils.mkdir_p(log_root) rescue error "could not create #{log_root}"
FileUtils.chown(user, nil, log_root) rescue error "could not chown #{log_root} to #{user}"
end
end end
+1 -1
View File
@@ -1,5 +1,5 @@
module Foreman module Foreman
VERSION = "0.43.0" VERSION = "0.45.0"
end end
+9 -1
View File
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "FOREMAN" "1" "February 2012" "Foreman 0.42.0" "Foreman Manual" .TH "FOREMAN" "1" "April 2012" "Foreman 0.44.0" "Foreman Manual"
. .
.SH "NAME" .SH "NAME"
\fBforeman\fR \- manage Procfile\-based applications \fBforeman\fR \- manage Procfile\-based applications
@@ -35,6 +35,14 @@ The following options control how the application is run:
Specify the number of each process type to run\. The value passed in should be in the format \fBprocess=num,process=num\fR Specify the number of each process type to run\. The value passed in should be in the format \fBprocess=num,process=num\fR
. .
.TP .TP
\fB\-e\fR, \fB\-\-env\fR
Specify one or more \.env files to load
.
.TP
\fB\-f\fR, \fB\-\-procfile\fR
Specify an alternate Procfile to load, implies \fB\-d\fR at the Procfile root\.
.
.TP
\fB\-p\fR, \fB\-\-port\fR \fB\-p\fR, \fB\-\-port\fR
Specify which port to use as the base for this application\. Should be a multiple of 1000\. Specify which port to use as the base for this application\. Should be a multiple of 1000\.
. .
+6
View File
@@ -30,6 +30,12 @@ The following options control how the application is run:
Specify the number of each process type to run. The value passed in Specify the number of each process type to run. The value passed in
should be in the format `process=num,process=num` should be in the format `process=num,process=num`
* `-e`, `--env`:
Specify one or more .env files to load
* `-f`, `--procfile`:
Specify an alternate Procfile to load, implies `-d` at the Procfile root.
* `-p`, `--port`: * `-p`, `--port`:
Specify which port to use as the base for this application. Should be Specify which port to use as the base for this application. Should be
a multiple of 1000. a multiple of 1000.
+9
View File
@@ -34,6 +34,15 @@ describe "Foreman::CLI", :fakefs do
subject.start("alpha") subject.start("alpha")
end end
end end
describe "with an alternate root" do
it "reads the Procfile from that root" do
write_procfile "/some/app/Procfile"
mock(Foreman::Procfile).new("/some/app/Procfile")
mock.instance_of(Foreman::Engine).start
foreman %{ start -d /some/app }
end
end
end end
describe "export" do describe "export" do
+17
View File
@@ -49,6 +49,14 @@ describe "Foreman::Engine", :fakefs do
end end
end end
describe "directories" do
it "has the directory default relative to the Procfile" do
write_procfile "/some/app/Procfile"
engine = Foreman::Engine.new("/some/app/Procfile")
engine.directory.should == "/some/app"
end
end
describe "environment" do describe "environment" do
before(:each) do before(:each) do
write_procfile write_procfile
@@ -97,6 +105,15 @@ describe "Foreman::Engine", :fakefs do
engine.environment.should == {"FOO"=>"qoo"} engine.environment.should == {"FOO"=>"qoo"}
engine.start engine.start
end end
it "should be loaded relative to the Procfile" do
FileUtils.mkdir_p "/some/app"
File.open("/some/app/.env", "w") { |f| f.puts("FOO=qoo") }
write_procfile "/some/app/Procfile"
engine = Foreman::Engine.new("/some/app/Procfile")
engine.environment.should == {"FOO"=>"qoo"}
engine.start
end
end end
describe "utf8" do describe "utf8" do