Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa46a605bb | ||
|
|
3077857ab7 | ||
|
|
08aa8f9d5d | ||
|
|
771489dec9 | ||
|
|
053ae8f0be | ||
|
|
af58af1c60 | ||
|
|
9075d93370 | ||
|
|
0c2e9df722 | ||
|
|
91a87049db |
@@ -1,3 +1,8 @@
|
|||||||
|
## 0.45.0 (2012-04-26)
|
||||||
|
|
||||||
|
* create and chown log dir in upstart export. [Phil Hagelberg]
|
||||||
|
* remove parka from dist files [David Dollar]
|
||||||
|
|
||||||
## 0.44.0 (2012-04-23)
|
## 0.44.0 (2012-04-23)
|
||||||
|
|
||||||
* make var output order repeatable in supervisord export [David Dollar]
|
* make var output order repeatable in supervisord export [David Dollar]
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Foreman::Engine
|
|||||||
Foreman::Color.enable($stdout)
|
Foreman::Color.enable($stdout)
|
||||||
|
|
||||||
def initialize(procfile, options={})
|
def initialize(procfile, options={})
|
||||||
@procfile = Foreman::Procfile.new(procfile)
|
@procfile = Foreman::Procfile.new(procfile) if File.exists?(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
|
||||||
@output_mutex = Mutex.new
|
@output_mutex = Mutex.new
|
||||||
|
|||||||
+24
-4
@@ -13,8 +13,9 @@ class Foreman::Procfile
|
|||||||
|
|
||||||
attr_reader :entries
|
attr_reader :entries
|
||||||
|
|
||||||
def initialize(filename)
|
def initialize(filename=nil)
|
||||||
@entries = parse_procfile(filename)
|
@entries = []
|
||||||
|
load(filename) if filename
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
@@ -25,12 +26,31 @@ class Foreman::Procfile
|
|||||||
entries.map(&:name)
|
entries.map(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def load(filename)
|
||||||
|
entries.clear
|
||||||
|
parse_procfile(filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
def write(filename)
|
||||||
|
File.open(filename, 'w') do |io|
|
||||||
|
entries.each do |ent|
|
||||||
|
io.puts(ent)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def <<(entry)
|
||||||
|
entries << Foreman::ProcfileEntry.new(*entry)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
def parse_procfile(filename)
|
def parse_procfile(filename)
|
||||||
File.read(filename).split("\n").map do |line|
|
File.read(filename).split("\n").map do |line|
|
||||||
if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/
|
if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/
|
||||||
Foreman::ProcfileEntry.new($1, $2)
|
self << [ $1, $2 ]
|
||||||
end
|
end
|
||||||
end.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,4 +19,8 @@ class Foreman::ProcfileEntry
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
"#{name}: #{command}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Foreman
|
module Foreman
|
||||||
|
|
||||||
VERSION = "0.45.0"
|
VERSION = "0.46.0"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -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" "April 2012" "Foreman 0.44.0" "Foreman Manual"
|
.TH "FOREMAN" "1" "April 2012" "Foreman 0.45.0" "Foreman Manual"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBforeman\fR \- manage Procfile\-based applications
|
\fBforeman\fR \- manage Procfile\-based applications
|
||||||
|
|||||||
@@ -12,12 +12,6 @@ describe "Foreman::Engine", :fakefs do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "initialize" do
|
describe "initialize" do
|
||||||
describe "without an existing Procfile" do
|
|
||||||
it "raises an error" do
|
|
||||||
lambda { subject }.should raise_error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "with a Procfile" do
|
describe "with a Procfile" do
|
||||||
before { write_procfile }
|
before { write_procfile }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
require 'foreman/procfile_entry'
|
||||||
|
require 'pathname'
|
||||||
|
require 'tmpdir'
|
||||||
|
|
||||||
|
describe Foreman::ProcfileEntry do
|
||||||
|
subject { described_class.new('alpha', './alpha') }
|
||||||
|
|
||||||
|
it "stringifies as a Procfile line" do
|
||||||
|
subject.to_s.should == 'alpha: ./alpha'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
require 'foreman/procfile'
|
||||||
|
require 'pathname'
|
||||||
|
require 'tmpdir'
|
||||||
|
|
||||||
|
describe Foreman::Procfile do
|
||||||
|
subject { described_class.new }
|
||||||
|
|
||||||
|
let(:testdir) { Pathname(Dir.tmpdir) }
|
||||||
|
let(:procfile) { testdir + 'Procfile' }
|
||||||
|
|
||||||
|
it "can have a process appended to it" do
|
||||||
|
subject << ['alpha', './alpha']
|
||||||
|
subject['alpha'].should be_a(Foreman::ProcfileEntry)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can write itself out to a file" do
|
||||||
|
subject << ['alpha', './alpha']
|
||||||
|
subject.write(procfile)
|
||||||
|
procfile.read.should == "alpha: ./alpha\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can re-read entries from a file" do
|
||||||
|
procfile.open('w') { |io| io.puts "gamma: ./radiation", "theta: ./rate" }
|
||||||
|
subject << ['alpha', './alpha']
|
||||||
|
subject.load(procfile)
|
||||||
|
subject.process_names.should have(2).members
|
||||||
|
subject.process_names.should include('gamma', 'theta')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user