Compare commits

..

13 Commits

Author SHA1 Message Date
David Dollar
7535f1d3d8 0.38.0 2012-02-02 17:26:42 -05:00
David Dollar
3af0dfb4ae bring back single process starting 2012-02-02 17:26:25 -05:00
David Dollar
78547b8175 foreman + jruby + travis = nope 2012-02-01 13:24:43 -05:00
David Dollar
976fbc0bb0 stub out proctitle/termtitle 2012-02-01 10:19:33 -05:00
David Dollar
28a9aa774f try ci on jruby 2012-02-01 10:06:25 -05:00
David Dollar
51f5ff3842 latest jruby fixed non-excutable to raise EACCESS 2012-01-31 18:01:53 -05:00
David Dollar
e1e18f62bb remove jruby until we figure out what's going on with travis 2012-01-30 11:42:41 -05:00
David Dollar
0a09117328 set JRUBY_OPTS for travis 2012-01-29 23:02:48 -05:00
David Dollar
c3df12746f ignore .rbenv-version 2012-01-29 23:02:40 -05:00
David Dollar
2ec6a23fb3 force to binary encoding if supported 2012-01-29 23:02:20 -05:00
David Dollar
0d6b784de1 disable test in jruby 2012-01-29 23:02:10 -05:00
David Dollar
2dcd2c03db wait for process termination instead of sleeping 2012-01-29 23:02:03 -05:00
David Dollar
9d6d0bbb7d add bundler setup to rakefile 2012-01-29 22:45:50 -05:00
9 changed files with 29 additions and 9 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
/.bundle
/.rbenv-version
/coverage
/example/log/*
/man/*.html

View File

@@ -1,12 +1,9 @@
script: bundle exec rake spec
env: JRUBY_OPTS="--debug -X+O"
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- jruby-head
notifications:
email: false

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
foreman (0.37.2)
foreman (0.38.0)
term-ansicolor (~> 1.0.7)
thor (>= 0.13.6)

View File

@@ -1,6 +1,8 @@
$:.unshift File.expand_path("../lib", __FILE__)
require "foreman"
require "bundler/setup"
Dir[File.expand_path("../tasks/*.rake", __FILE__)].each do |task|
load task
end

View File

@@ -10,7 +10,7 @@ class Foreman::CLI < Thor
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
desc "start", "Start the application"
desc "start [PROCESS]", "Start the application (or a specific PROCESS)"
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
class_option :app_root, :type => :string, :aliases => "-d", :desc => "Default: Procfile directory"
@@ -27,8 +27,9 @@ class Foreman::CLI < Thor
end
end
def start
def start(process=nil)
check_procfile!
engine.options[:concurrency] = "#{process}=1" if process
engine.start
end

View File

@@ -23,7 +23,7 @@ class Foreman::Engine
def initialize(procfile, options={})
@procfile = Foreman::Procfile.new(procfile)
@directory = options[:app_root] || File.expand_path(File.dirname(procfile))
@options = options
@options = options.dup
@environment = read_environment_files(options[:env])
@output_mutex = Mutex.new
end
@@ -99,6 +99,7 @@ private ######################################################################
(rs || []).each do |r|
data = r.gets
next unless data
data.force_encoding("BINARY") if data.respond_to?(:force_encoding)
ps, message = data.split(",", 2)
color = colors[ps.split(".").first]
info message, ps, color

View File

@@ -1,5 +1,5 @@
module Foreman
VERSION = "0.37.2"
VERSION = "0.38.0"
end

View File

@@ -3,6 +3,8 @@ require "foreman/cli"
describe "Foreman::CLI", :fakefs do
subject { Foreman::CLI.new }
let(:engine) { subject.send(:engine) }
let(:entries) { engine.procfile.entries.inject({}) { |h,e| h.update(e.name => e) } }
describe "start" do
describe "with a non-existent Procfile" do
@@ -22,6 +24,15 @@ describe "Foreman::CLI", :fakefs do
mock.instance_of(Foreman::Engine).start
subject.start
end
it "can run a single process" do
dont_allow(subject).error
stub(engine).watch_for_output
stub(engine).watch_for_termination
mock(entries["alpha"]).spawn(1, is_a(IO), engine.directory, {}, 5000) { [] }
mock(entries["bravo"]).spawn(0, is_a(IO), engine.directory, {}, 5100) { [] }
subject.start("alpha")
end
end
end

View File

@@ -4,6 +4,13 @@ require "foreman/engine"
describe "Foreman::Engine", :fakefs do
subject { Foreman::Engine.new("Procfile", {}) }
before do
any_instance_of(Foreman::Engine) do |engine|
stub(engine).proctitle
stub(engine).termtitle
end
end
describe "initialize" do
describe "without an existing Procfile" do
it "raises an error" do
@@ -95,7 +102,7 @@ describe "Foreman::Engine", :fakefs do
stub(subject).watch_for_output
stub(subject).watch_for_termination
subject.start
sleep 1
Process.waitall
mock(subject).info(/started with pid \d+/, "utf8.1", anything)
mock(subject).info("\xff\x03\n", "utf8.1", anything)
subject.send(:poll_readers)