Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51eee011ce | ||
|
|
6c8c848f54 | ||
|
|
f60c4cb767 | ||
|
|
4ad49cb058 | ||
|
|
e993af2b20 | ||
|
|
d7000bccfa |
@@ -2,6 +2,10 @@ source "http://rubygems.org"
|
|||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
|
platform :mingw do
|
||||||
|
gem "win32console", "~> 1.3.0"
|
||||||
|
end
|
||||||
|
|
||||||
platform :jruby do
|
platform :jruby do
|
||||||
gem "posix-spawn", "~> 0.3.6"
|
gem "posix-spawn", "~> 0.3.6"
|
||||||
end
|
end
|
||||||
|
|||||||
+4
-1
@@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
foreman (0.37.0.pre2)
|
foreman (0.37.0.pre3)
|
||||||
term-ansicolor (~> 1.0.7)
|
term-ansicolor (~> 1.0.7)
|
||||||
thor (>= 0.13.6)
|
thor (>= 0.13.6)
|
||||||
|
|
||||||
@@ -47,11 +47,13 @@ GEM
|
|||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
term-ansicolor (1.0.7)
|
term-ansicolor (1.0.7)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
|
win32console (1.3.0-x86-mingw32)
|
||||||
xml-simple (1.0.15)
|
xml-simple (1.0.15)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
java
|
java
|
||||||
ruby
|
ruby
|
||||||
|
x86-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
aws-s3
|
aws-s3
|
||||||
@@ -65,3 +67,4 @@ DEPENDENCIES
|
|||||||
rr (~> 1.0.2)
|
rr (~> 1.0.2)
|
||||||
rspec (~> 2.0)
|
rspec (~> 2.0)
|
||||||
rubyzip
|
rubyzip
|
||||||
|
win32console (~> 1.3.0)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
file pkg("foreman-#{version}-jruby.gem") => distribution_files do |t|
|
file pkg("foreman-#{version}-jruby.gem") => distribution_files do |t|
|
||||||
sh "env PLATFORM=jruby gem build foreman.gemspec"
|
sh "env PLATFORM=java gem build foreman.gemspec"
|
||||||
sh "mv foreman-#{version}-java.gem #{t.name}"
|
sh "mv foreman-#{version}-java.gem #{t.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
file pkg("foreman-#{version}-mingw32.gem") => distribution_files do |t|
|
||||||
|
sh "env PLATFORM=mingw32 gem build foreman.gemspec"
|
||||||
|
sh "mv foreman-#{version}-mingw32.gem #{t.name}"
|
||||||
|
end
|
||||||
|
|
||||||
|
task "mingw32:build" => pkg("foreman-#{version}-mingw32.gem")
|
||||||
|
|
||||||
|
task "mingw32:clean" do
|
||||||
|
clean pkg("foreman-#{version}-mingw32.gem")
|
||||||
|
end
|
||||||
|
|
||||||
|
task "mingw32:release" => "mingw32:build" do |t|
|
||||||
|
sh "parka push -f #{pkg("foreman-#{version}-mingw32.gem")}"
|
||||||
|
end
|
||||||
+6
-1
@@ -19,8 +19,13 @@ Gem::Specification.new do |gem|
|
|||||||
gem.add_dependency 'term-ansicolor', '~> 1.0.7'
|
gem.add_dependency 'term-ansicolor', '~> 1.0.7'
|
||||||
gem.add_dependency 'thor', '>= 0.13.6'
|
gem.add_dependency 'thor', '>= 0.13.6'
|
||||||
|
|
||||||
if ENV["PLATFORM"] == "jruby"
|
if ENV["PLATFORM"] == "java"
|
||||||
gem.add_dependency "posix-spawn", "~> 0.3.6"
|
gem.add_dependency "posix-spawn", "~> 0.3.6"
|
||||||
gem.platform = Gem::Platform.new("java")
|
gem.platform = Gem::Platform.new("java")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV["PLATFORM"] == "mingw32"
|
||||||
|
gem.add_dependency "win32console", "~> 1.3.0"
|
||||||
|
gem.platform = Gem::Platform.new("mingw32")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+8
-1
@@ -14,5 +14,12 @@ module Foreman
|
|||||||
File.expand_path("../../bin/runner", __FILE__)
|
File.expand_path("../../bin/runner", __FILE__)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def self.jruby?
|
||||||
|
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.windows?
|
||||||
|
defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ require "foreman"
|
|||||||
require "foreman/process"
|
require "foreman/process"
|
||||||
require "foreman/procfile"
|
require "foreman/procfile"
|
||||||
require "foreman/utils"
|
require "foreman/utils"
|
||||||
require "pty"
|
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
require "timeout"
|
require "timeout"
|
||||||
require "term/ansicolor"
|
require "term/ansicolor"
|
||||||
@@ -89,6 +88,7 @@ private ######################################################################
|
|||||||
|
|
||||||
def watch_for_output
|
def watch_for_output
|
||||||
Thread.new do
|
Thread.new do
|
||||||
|
require "win32console" if Foreman.windows?
|
||||||
begin
|
begin
|
||||||
loop do
|
loop do
|
||||||
rs, ws = IO.select(readers.values, [], [], 1)
|
rs, ws = IO.select(readers.values, [], [], 1)
|
||||||
@@ -156,7 +156,7 @@ private ######################################################################
|
|||||||
end
|
end
|
||||||
|
|
||||||
def termtitle(title)
|
def termtitle(title)
|
||||||
printf("\033]0;#{title}\007")
|
printf("\033]0;#{title}\007") unless Foreman.windows?
|
||||||
end
|
end
|
||||||
|
|
||||||
def running_processes
|
def running_processes
|
||||||
|
|||||||
@@ -26,27 +26,26 @@ class Foreman::Process
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def jruby?
|
|
||||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
|
||||||
end
|
|
||||||
|
|
||||||
def fork_with_io(command, basedir)
|
def fork_with_io(command, basedir)
|
||||||
reader, writer = IO.pipe
|
reader, writer = IO.pipe
|
||||||
command = replace_command_env(command)
|
command = replace_command_env(command)
|
||||||
pid = if jruby?
|
pid = if Foreman.windows?
|
||||||
|
Dir.chdir(basedir) do
|
||||||
|
Process.spawn command, :out => writer, :err => writer
|
||||||
|
end
|
||||||
|
elsif Foreman.jruby?
|
||||||
require "posix/spawn"
|
require "posix/spawn"
|
||||||
POSIX::Spawn.spawn(Foreman.runner, "-d", basedir, command, {
|
POSIX::Spawn.spawn(Foreman.runner, "-d", basedir, command, {
|
||||||
:out => writer, :err => writer
|
:out => writer, :err => writer
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
fork do
|
fork do
|
||||||
trap("INT", "IGNORE")
|
|
||||||
writer.sync = true
|
writer.sync = true
|
||||||
$stdout.reopen writer
|
$stdout.reopen writer
|
||||||
$stderr.reopen writer
|
$stderr.reopen writer
|
||||||
reader.close
|
reader.close
|
||||||
exec Foreman.runner, "-d", basedir, command
|
exec Foreman.runner, "-d", basedir, command
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
[ reader, pid ]
|
[ reader, pid ]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Foreman
|
module Foreman
|
||||||
|
|
||||||
VERSION = "0.37.0.pre2"
|
VERSION = "0.37.0.pre3"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ describe "Foreman::Engine" do
|
|||||||
describe "start" do
|
describe "start" do
|
||||||
it "forks the processes" do
|
it "forks the processes" do
|
||||||
write_procfile
|
write_procfile
|
||||||
mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO))
|
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO))
|
||||||
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
|
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO))
|
||||||
mock(subject).watch_for_output
|
mock(subject).watch_for_output
|
||||||
mock(subject).watch_for_termination
|
mock(subject).watch_for_termination
|
||||||
subject.start
|
subject.start
|
||||||
@@ -34,8 +34,8 @@ describe "Foreman::Engine" do
|
|||||||
it "handles concurrency" do
|
it "handles concurrency" do
|
||||||
write_procfile
|
write_procfile
|
||||||
engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
|
engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
|
||||||
mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice
|
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO)).twice
|
||||||
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)).never
|
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO)).never
|
||||||
mock(engine).watch_for_output
|
mock(engine).watch_for_output
|
||||||
mock(engine).watch_for_termination
|
mock(engine).watch_for_termination
|
||||||
engine.start
|
engine.start
|
||||||
|
|||||||
Reference in New Issue
Block a user