foreman 0.37.0.pre2-java → 0.37.0.pre3-java

Sign up to get free protection for your applications and to get access to all the features.
data/lib/foreman.rb CHANGED
@@ -14,5 +14,12 @@ module Foreman
14
14
  File.expand_path("../../bin/runner", __FILE__)
15
15
  end
16
16
 
17
- end
17
+ def self.jruby?
18
+ defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
19
+ end
18
20
 
21
+ def self.windows?
22
+ defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
23
+ end
24
+
25
+ end
@@ -2,7 +2,6 @@ require "foreman"
2
2
  require "foreman/process"
3
3
  require "foreman/procfile"
4
4
  require "foreman/utils"
5
- require "pty"
6
5
  require "tempfile"
7
6
  require "timeout"
8
7
  require "term/ansicolor"
@@ -89,6 +88,7 @@ private ######################################################################
89
88
 
90
89
  def watch_for_output
91
90
  Thread.new do
91
+ require "win32console" if Foreman.windows?
92
92
  begin
93
93
  loop do
94
94
  rs, ws = IO.select(readers.values, [], [], 1)
@@ -156,7 +156,7 @@ private ######################################################################
156
156
  end
157
157
 
158
158
  def termtitle(title)
159
- printf("\033]0;#{title}\007")
159
+ printf("\033]0;#{title}\007") unless Foreman.windows?
160
160
  end
161
161
 
162
162
  def running_processes
@@ -26,27 +26,26 @@ class Foreman::Process
26
26
 
27
27
  private
28
28
 
29
- def jruby?
30
- defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
31
- end
32
-
33
29
  def fork_with_io(command, basedir)
34
30
  reader, writer = IO.pipe
35
31
  command = replace_command_env(command)
36
- pid = if jruby?
32
+ pid = if Foreman.windows?
33
+ Dir.chdir(basedir) do
34
+ Process.spawn command, :out => writer, :err => writer
35
+ end
36
+ elsif Foreman.jruby?
37
37
  require "posix/spawn"
38
38
  POSIX::Spawn.spawn(Foreman.runner, "-d", basedir, command, {
39
39
  :out => writer, :err => writer
40
40
  })
41
41
  else
42
42
  fork do
43
- trap("INT", "IGNORE")
44
43
  writer.sync = true
45
44
  $stdout.reopen writer
46
45
  $stderr.reopen writer
47
46
  reader.close
48
47
  exec Foreman.runner, "-d", basedir, command
49
- end
48
+ end
50
49
  end
51
50
  [ reader, pid ]
52
51
  end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.37.0.pre2"
3
+ VERSION = "0.37.0.pre3"
4
4
 
5
5
  end
@@ -24,8 +24,8 @@ describe "Foreman::Engine" do
24
24
  describe "start" do
25
25
  it "forks the processes" do
26
26
  write_procfile
27
- mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO))
28
- mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
27
+ mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO))
28
+ mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO))
29
29
  mock(subject).watch_for_output
30
30
  mock(subject).watch_for_termination
31
31
  subject.start
@@ -34,8 +34,8 @@ describe "Foreman::Engine" do
34
34
  it "handles concurrency" do
35
35
  write_procfile
36
36
  engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
37
- mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice
38
- mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)).never
37
+ mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO)).twice
38
+ mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO)).never
39
39
  mock(engine).watch_for_output
40
40
  mock(engine).watch_for_termination
41
41
  engine.start
metadata CHANGED
@@ -1,139 +1,132 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.37.0.pre3
4
5
  prerelease: 7
5
- version: 0.37.0.pre2
6
6
  platform: java
7
- authors:
8
- - David Dollar
7
+ authors:
8
+ - David Dollar
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-01-23 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: term-ansicolor
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
23
- version: 1.0.7
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: thor
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 0.13.6
35
- type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: posix-spawn
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 0.3.6
46
- type: :runtime
47
- version_requirements: *id003
12
+ date: 2012-01-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: term-ansicolor
16
+ requirement: &70363556093680 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.7
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70363556093680
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70363556092880 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.13.6
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70363556092880
36
+ - !ruby/object:Gem::Dependency
37
+ name: posix-spawn
38
+ requirement: &70363556092120 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.3.6
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70363556092120
48
47
  description: Process manager for applications with multiple components
49
48
  email: ddollar@gmail.com
50
- executables:
51
- - foreman
49
+ executables:
50
+ - foreman
52
51
  extensions: []
53
-
54
52
  extra_rdoc_files: []
55
-
56
- files:
57
- - README.markdown
58
- - bin/foreman
59
- - bin/runner
60
- - data/example/error
61
- - data/example/Procfile
62
- - data/example/Procfile.without_colon
63
- - data/example/ticker
64
- - data/example/log/neverdie.log
65
- - data/export/bluepill/master.pill.erb
66
- - data/export/runit/log_run.erb
67
- - data/export/runit/run.erb
68
- - data/export/upstart/master.conf.erb
69
- - data/export/upstart/process.conf.erb
70
- - data/export/upstart/process_master.conf.erb
71
- - lib/foreman.rb
72
- - lib/foreman/cli.rb
73
- - lib/foreman/distribution.rb
74
- - lib/foreman/engine.rb
75
- - lib/foreman/export.rb
76
- - lib/foreman/process.rb
77
- - lib/foreman/procfile.rb
78
- - lib/foreman/procfile_entry.rb
79
- - lib/foreman/utils.rb
80
- - lib/foreman/version.rb
81
- - lib/foreman/export/base.rb
82
- - lib/foreman/export/bluepill.rb
83
- - lib/foreman/export/inittab.rb
84
- - lib/foreman/export/runit.rb
85
- - lib/foreman/export/upstart.rb
86
- - spec/foreman_spec.rb
87
- - spec/helper_spec.rb
88
- - spec/spec_helper.rb
89
- - spec/foreman/cli_spec.rb
90
- - spec/foreman/engine_spec.rb
91
- - spec/foreman/export_spec.rb
92
- - spec/foreman/process_spec.rb
93
- - spec/foreman/export/bluepill_spec.rb
94
- - spec/foreman/export/runit_spec.rb
95
- - spec/foreman/export/upstart_spec.rb
96
- - spec/resources/export/bluepill/app-concurrency.pill
97
- - spec/resources/export/bluepill/app.pill
98
- - spec/resources/export/runit/app-alpha-1-log-run
99
- - spec/resources/export/runit/app-alpha-1-run
100
- - spec/resources/export/runit/app-alpha-2-log-run
101
- - spec/resources/export/runit/app-alpha-2-run
102
- - spec/resources/export/runit/app-bravo-1-log-run
103
- - spec/resources/export/runit/app-bravo-1-run
104
- - spec/resources/export/upstart/app-alpha-1.conf
105
- - spec/resources/export/upstart/app-alpha-2.conf
106
- - spec/resources/export/upstart/app-alpha.conf
107
- - spec/resources/export/upstart/app-bravo-1.conf
108
- - spec/resources/export/upstart/app-bravo.conf
109
- - spec/resources/export/upstart/app.conf
110
- - man/foreman.1
53
+ files:
54
+ - bin/foreman
55
+ - bin/runner
56
+ - data/example/error
57
+ - data/example/log/neverdie.log
58
+ - data/example/Procfile
59
+ - data/example/Procfile.without_colon
60
+ - data/example/ticker
61
+ - data/export/bluepill/master.pill.erb
62
+ - data/export/runit/log_run.erb
63
+ - data/export/runit/run.erb
64
+ - data/export/upstart/master.conf.erb
65
+ - data/export/upstart/process.conf.erb
66
+ - data/export/upstart/process_master.conf.erb
67
+ - lib/foreman/cli.rb
68
+ - lib/foreman/distribution.rb
69
+ - lib/foreman/engine.rb
70
+ - lib/foreman/export/base.rb
71
+ - lib/foreman/export/bluepill.rb
72
+ - lib/foreman/export/inittab.rb
73
+ - lib/foreman/export/runit.rb
74
+ - lib/foreman/export/upstart.rb
75
+ - lib/foreman/export.rb
76
+ - lib/foreman/process.rb
77
+ - lib/foreman/procfile.rb
78
+ - lib/foreman/procfile_entry.rb
79
+ - lib/foreman/utils.rb
80
+ - lib/foreman/version.rb
81
+ - lib/foreman.rb
82
+ - README.markdown
83
+ - spec/foreman/cli_spec.rb
84
+ - spec/foreman/engine_spec.rb
85
+ - spec/foreman/export/bluepill_spec.rb
86
+ - spec/foreman/export/runit_spec.rb
87
+ - spec/foreman/export/upstart_spec.rb
88
+ - spec/foreman/export_spec.rb
89
+ - spec/foreman/process_spec.rb
90
+ - spec/foreman_spec.rb
91
+ - spec/helper_spec.rb
92
+ - spec/resources/export/bluepill/app-concurrency.pill
93
+ - spec/resources/export/bluepill/app.pill
94
+ - spec/resources/export/runit/app-alpha-1-log-run
95
+ - spec/resources/export/runit/app-alpha-1-run
96
+ - spec/resources/export/runit/app-alpha-2-log-run
97
+ - spec/resources/export/runit/app-alpha-2-run
98
+ - spec/resources/export/runit/app-bravo-1-log-run
99
+ - spec/resources/export/runit/app-bravo-1-run
100
+ - spec/resources/export/upstart/app-alpha-1.conf
101
+ - spec/resources/export/upstart/app-alpha-2.conf
102
+ - spec/resources/export/upstart/app-alpha.conf
103
+ - spec/resources/export/upstart/app-bravo-1.conf
104
+ - spec/resources/export/upstart/app-bravo.conf
105
+ - spec/resources/export/upstart/app.conf
106
+ - spec/spec_helper.rb
107
+ - man/foreman.1
111
108
  homepage: http://github.com/ddollar/foreman
112
109
  licenses: []
113
-
114
110
  post_install_message:
115
111
  rdoc_options: []
116
-
117
- require_paths:
118
- - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
120
115
  none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
121
  none: false
127
- requirements:
128
- - - ">"
129
- - !ruby/object:Gem::Version
130
- version: 1.3.1
122
+ requirements:
123
+ - - ! '>'
124
+ - !ruby/object:Gem::Version
125
+ version: 1.3.1
131
126
  requirements: []
132
-
133
127
  rubyforge_project:
134
- rubygems_version: 1.8.9
128
+ rubygems_version: 1.8.10
135
129
  signing_key:
136
130
  specification_version: 3
137
131
  summary: Process manager for applications with multiple components
138
132
  test_files: []
139
-