foreman 0.37.0.pre2 → 0.37.0.pre3

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,128 +1,121 @@
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: ruby
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
12
+ date: 2012-01-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: term-ansicolor
16
+ requirement: &70153949985080 !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: *70153949985080
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70153949984360 !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: *70153949984360
37
36
  description: Process manager for applications with multiple components
38
37
  email: ddollar@gmail.com
39
- executables:
40
- - foreman
38
+ executables:
39
+ - foreman
41
40
  extensions: []
42
-
43
41
  extra_rdoc_files: []
44
-
45
- files:
46
- - README.markdown
47
- - bin/foreman
48
- - bin/runner
49
- - data/example/error
50
- - data/example/Procfile
51
- - data/example/Procfile.without_colon
52
- - data/example/ticker
53
- - data/example/log/neverdie.log
54
- - data/export/bluepill/master.pill.erb
55
- - data/export/runit/log_run.erb
56
- - data/export/runit/run.erb
57
- - data/export/upstart/master.conf.erb
58
- - data/export/upstart/process.conf.erb
59
- - data/export/upstart/process_master.conf.erb
60
- - lib/foreman.rb
61
- - lib/foreman/cli.rb
62
- - lib/foreman/distribution.rb
63
- - lib/foreman/engine.rb
64
- - lib/foreman/export.rb
65
- - lib/foreman/process.rb
66
- - lib/foreman/procfile.rb
67
- - lib/foreman/procfile_entry.rb
68
- - lib/foreman/utils.rb
69
- - lib/foreman/version.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
- - spec/foreman_spec.rb
76
- - spec/helper_spec.rb
77
- - spec/spec_helper.rb
78
- - spec/foreman/cli_spec.rb
79
- - spec/foreman/engine_spec.rb
80
- - spec/foreman/export_spec.rb
81
- - spec/foreman/process_spec.rb
82
- - spec/foreman/export/bluepill_spec.rb
83
- - spec/foreman/export/runit_spec.rb
84
- - spec/foreman/export/upstart_spec.rb
85
- - spec/resources/export/bluepill/app-concurrency.pill
86
- - spec/resources/export/bluepill/app.pill
87
- - spec/resources/export/runit/app-alpha-1-log-run
88
- - spec/resources/export/runit/app-alpha-1-run
89
- - spec/resources/export/runit/app-alpha-2-log-run
90
- - spec/resources/export/runit/app-alpha-2-run
91
- - spec/resources/export/runit/app-bravo-1-log-run
92
- - spec/resources/export/runit/app-bravo-1-run
93
- - spec/resources/export/upstart/app-alpha-1.conf
94
- - spec/resources/export/upstart/app-alpha-2.conf
95
- - spec/resources/export/upstart/app-alpha.conf
96
- - spec/resources/export/upstart/app-bravo-1.conf
97
- - spec/resources/export/upstart/app-bravo.conf
98
- - spec/resources/export/upstart/app.conf
99
- - man/foreman.1
42
+ files:
43
+ - bin/foreman
44
+ - bin/runner
45
+ - data/example/error
46
+ - data/example/log/neverdie.log
47
+ - data/example/Procfile
48
+ - data/example/Procfile.without_colon
49
+ - data/example/ticker
50
+ - data/export/bluepill/master.pill.erb
51
+ - data/export/runit/log_run.erb
52
+ - data/export/runit/run.erb
53
+ - data/export/upstart/master.conf.erb
54
+ - data/export/upstart/process.conf.erb
55
+ - data/export/upstart/process_master.conf.erb
56
+ - lib/foreman/cli.rb
57
+ - lib/foreman/distribution.rb
58
+ - lib/foreman/engine.rb
59
+ - lib/foreman/export/base.rb
60
+ - lib/foreman/export/bluepill.rb
61
+ - lib/foreman/export/inittab.rb
62
+ - lib/foreman/export/runit.rb
63
+ - lib/foreman/export/upstart.rb
64
+ - lib/foreman/export.rb
65
+ - lib/foreman/process.rb
66
+ - lib/foreman/procfile.rb
67
+ - lib/foreman/procfile_entry.rb
68
+ - lib/foreman/utils.rb
69
+ - lib/foreman/version.rb
70
+ - lib/foreman.rb
71
+ - README.markdown
72
+ - spec/foreman/cli_spec.rb
73
+ - spec/foreman/engine_spec.rb
74
+ - spec/foreman/export/bluepill_spec.rb
75
+ - spec/foreman/export/runit_spec.rb
76
+ - spec/foreman/export/upstart_spec.rb
77
+ - spec/foreman/export_spec.rb
78
+ - spec/foreman/process_spec.rb
79
+ - spec/foreman_spec.rb
80
+ - spec/helper_spec.rb
81
+ - spec/resources/export/bluepill/app-concurrency.pill
82
+ - spec/resources/export/bluepill/app.pill
83
+ - spec/resources/export/runit/app-alpha-1-log-run
84
+ - spec/resources/export/runit/app-alpha-1-run
85
+ - spec/resources/export/runit/app-alpha-2-log-run
86
+ - spec/resources/export/runit/app-alpha-2-run
87
+ - spec/resources/export/runit/app-bravo-1-log-run
88
+ - spec/resources/export/runit/app-bravo-1-run
89
+ - spec/resources/export/upstart/app-alpha-1.conf
90
+ - spec/resources/export/upstart/app-alpha-2.conf
91
+ - spec/resources/export/upstart/app-alpha.conf
92
+ - spec/resources/export/upstart/app-bravo-1.conf
93
+ - spec/resources/export/upstart/app-bravo.conf
94
+ - spec/resources/export/upstart/app.conf
95
+ - spec/spec_helper.rb
96
+ - man/foreman.1
100
97
  homepage: http://github.com/ddollar/foreman
101
98
  licenses: []
102
-
103
99
  post_install_message:
104
100
  rdoc_options: []
105
-
106
- require_paths:
107
- - lib
108
- required_ruby_version: !ruby/object:Gem::Requirement
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
109
104
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: "0"
114
- required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
110
  none: false
116
- requirements:
117
- - - ">"
118
- - !ruby/object:Gem::Version
119
- version: 1.3.1
111
+ requirements:
112
+ - - ! '>'
113
+ - !ruby/object:Gem::Version
114
+ version: 1.3.1
120
115
  requirements: []
121
-
122
116
  rubyforge_project:
123
- rubygems_version: 1.8.9
117
+ rubygems_version: 1.8.10
124
118
  signing_key:
125
119
  specification_version: 3
126
120
  summary: Process manager for applications with multiple components
127
121
  test_files: []
128
-