foreman 0.47.0 → 0.48.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/bin/taskman +8 -0
  2. data/data/example/Procfile +4 -3
  3. data/data/example/spawnee +14 -0
  4. data/data/example/spawner +7 -0
  5. data/data/export/bluepill/master.pill.erb +10 -10
  6. data/data/export/launchd/launchd.plist.erb +3 -3
  7. data/data/export/runit/log/run.erb +7 -0
  8. data/data/export/runit/run.erb +2 -2
  9. data/data/export/supervisord/app.conf.erb +12 -12
  10. data/data/export/upstart/master.conf.erb +2 -2
  11. data/data/export/upstart/process.conf.erb +3 -3
  12. data/lib/foreman/cli.rb +49 -21
  13. data/lib/foreman/engine.rb +208 -148
  14. data/lib/foreman/engine/cli.rb +98 -0
  15. data/lib/foreman/env.rb +27 -0
  16. data/lib/foreman/export.rb +0 -1
  17. data/lib/foreman/export/base.rb +58 -35
  18. data/lib/foreman/export/bluepill.rb +3 -17
  19. data/lib/foreman/export/inittab.rb +8 -11
  20. data/lib/foreman/export/launchd.rb +4 -16
  21. data/lib/foreman/export/runit.rb +14 -39
  22. data/lib/foreman/export/supervisord.rb +3 -13
  23. data/lib/foreman/export/upstart.rb +9 -27
  24. data/lib/foreman/process.rb +56 -67
  25. data/lib/foreman/procfile.rb +59 -25
  26. data/lib/foreman/version.rb +1 -1
  27. data/man/foreman.1 +4 -0
  28. data/spec/foreman/cli_spec.rb +38 -152
  29. data/spec/foreman/engine_spec.rb +46 -80
  30. data/spec/foreman/export/base_spec.rb +4 -7
  31. data/spec/foreman/export/bluepill_spec.rb +7 -6
  32. data/spec/foreman/export/inittab_spec.rb +7 -7
  33. data/spec/foreman/export/launchd_spec.rb +4 -7
  34. data/spec/foreman/export/runit_spec.rb +12 -17
  35. data/spec/foreman/export/supervisord_spec.rb +7 -56
  36. data/spec/foreman/export/upstart_spec.rb +18 -23
  37. data/spec/foreman/process_spec.rb +27 -124
  38. data/spec/foreman/procfile_spec.rb +26 -16
  39. data/spec/resources/Procfile +4 -0
  40. data/spec/resources/bin/echo +2 -0
  41. data/spec/resources/bin/env +2 -0
  42. data/spec/resources/bin/test +2 -0
  43. data/spec/resources/export/bluepill/app-concurrency.pill +4 -4
  44. data/spec/resources/export/bluepill/app.pill +4 -4
  45. data/spec/resources/export/runit/{app-alpha-1-log-run → app-alpha-1/log/run} +0 -0
  46. data/spec/resources/export/runit/{app-alpha-1-run → app-alpha-1/run} +0 -0
  47. data/spec/resources/export/runit/{app-alpha-2-log-run → app-alpha-2/log/run} +0 -0
  48. data/spec/resources/export/runit/{app-alpha-2-run → app-alpha-2/run} +0 -0
  49. data/spec/resources/export/runit/{app-bravo-1-log-run → app-bravo-1/log/run} +0 -0
  50. data/spec/resources/export/runit/{app-bravo-1-run → app-bravo-1/run} +0 -0
  51. data/spec/resources/export/supervisord/app-alpha-1.conf +24 -0
  52. data/spec/resources/export/supervisord/app-alpha-2.conf +4 -4
  53. data/spec/spec_helper.rb +58 -6
  54. metadata +24 -22
  55. data/data/export/runit/log_run.erb +0 -7
  56. data/lib/foreman/color.rb +0 -40
  57. data/lib/foreman/procfile_entry.rb +0 -26
  58. data/lib/foreman/utils.rb +0 -18
  59. data/spec/foreman/color_spec.rb +0 -31
  60. data/spec/foreman/procfile_entry_spec.rb +0 -13
  61. data/spec/resources/export/supervisord/app-env-with-comma.conf +0 -24
  62. data/spec/resources/export/supervisord/app-env.conf +0 -21
  63. data/spec/resources/export/supervisord/app.conf +0 -24
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
5
- prerelease:
4
+ version: 0.48.0.pre1
5
+ prerelease: 7
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Dollar
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-08 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70170917701380 !ruby/object:Gem::Requirement
16
+ requirement: &70346306226760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.13.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70170917701380
24
+ version_requirements: *70346306226760
25
25
  description: Process manager for applications with multiple components
26
26
  email: ddollar@gmail.com
27
27
  executables:
@@ -31,24 +31,28 @@ extra_rdoc_files: []
31
31
  files:
32
32
  - bin/foreman
33
33
  - bin/foreman-runner
34
+ - bin/taskman
34
35
  - data/example/error
35
36
  - data/example/log/neverdie.log
36
37
  - data/example/Procfile
37
38
  - data/example/Procfile.without_colon
39
+ - data/example/spawnee
40
+ - data/example/spawner
38
41
  - data/example/ticker
39
42
  - data/example/utf8
40
43
  - data/export/bluepill/master.pill.erb
41
44
  - data/export/launchd/launchd.plist.erb
42
- - data/export/runit/log_run.erb
45
+ - data/export/runit/log/run.erb
43
46
  - data/export/runit/run.erb
44
47
  - data/export/supervisord/app.conf.erb
45
48
  - data/export/upstart/master.conf.erb
46
49
  - data/export/upstart/process.conf.erb
47
50
  - data/export/upstart/process_master.conf.erb
48
51
  - lib/foreman/cli.rb
49
- - lib/foreman/color.rb
50
52
  - lib/foreman/distribution.rb
53
+ - lib/foreman/engine/cli.rb
51
54
  - lib/foreman/engine.rb
55
+ - lib/foreman/env.rb
52
56
  - lib/foreman/export/base.rb
53
57
  - lib/foreman/export/bluepill.rb
54
58
  - lib/foreman/export/inittab.rb
@@ -60,13 +64,10 @@ files:
60
64
  - lib/foreman/helpers.rb
61
65
  - lib/foreman/process.rb
62
66
  - lib/foreman/procfile.rb
63
- - lib/foreman/procfile_entry.rb
64
- - lib/foreman/utils.rb
65
67
  - lib/foreman/version.rb
66
68
  - lib/foreman.rb
67
69
  - README.md
68
70
  - spec/foreman/cli_spec.rb
69
- - spec/foreman/color_spec.rb
70
71
  - spec/foreman/engine_spec.rb
71
72
  - spec/foreman/export/base_spec.rb
72
73
  - spec/foreman/export/bluepill_spec.rb
@@ -78,10 +79,12 @@ files:
78
79
  - spec/foreman/export_spec.rb
79
80
  - spec/foreman/helpers_spec.rb
80
81
  - spec/foreman/process_spec.rb
81
- - spec/foreman/procfile_entry_spec.rb
82
82
  - spec/foreman/procfile_spec.rb
83
83
  - spec/foreman_spec.rb
84
84
  - spec/helper_spec.rb
85
+ - spec/resources/bin/echo
86
+ - spec/resources/bin/env
87
+ - spec/resources/bin/test
85
88
  - spec/resources/bin/utf8
86
89
  - spec/resources/export/bluepill/app-concurrency.pill
87
90
  - spec/resources/export/bluepill/app.pill
@@ -89,22 +92,21 @@ files:
89
92
  - spec/resources/export/inittab/inittab.default
90
93
  - spec/resources/export/launchd/launchd-a.default
91
94
  - spec/resources/export/launchd/launchd-b.default
92
- - spec/resources/export/runit/app-alpha-1-log-run
93
- - spec/resources/export/runit/app-alpha-1-run
94
- - spec/resources/export/runit/app-alpha-2-log-run
95
- - spec/resources/export/runit/app-alpha-2-run
96
- - spec/resources/export/runit/app-bravo-1-log-run
97
- - spec/resources/export/runit/app-bravo-1-run
95
+ - spec/resources/export/runit/app-alpha-1/log/run
96
+ - spec/resources/export/runit/app-alpha-1/run
97
+ - spec/resources/export/runit/app-alpha-2/log/run
98
+ - spec/resources/export/runit/app-alpha-2/run
99
+ - spec/resources/export/runit/app-bravo-1/log/run
100
+ - spec/resources/export/runit/app-bravo-1/run
101
+ - spec/resources/export/supervisord/app-alpha-1.conf
98
102
  - spec/resources/export/supervisord/app-alpha-2.conf
99
- - spec/resources/export/supervisord/app-env-with-comma.conf
100
- - spec/resources/export/supervisord/app-env.conf
101
- - spec/resources/export/supervisord/app.conf
102
103
  - spec/resources/export/upstart/app-alpha-1.conf
103
104
  - spec/resources/export/upstart/app-alpha-2.conf
104
105
  - spec/resources/export/upstart/app-alpha.conf
105
106
  - spec/resources/export/upstart/app-bravo-1.conf
106
107
  - spec/resources/export/upstart/app-bravo.conf
107
108
  - spec/resources/export/upstart/app.conf
109
+ - spec/resources/Procfile
108
110
  - spec/spec_helper.rb
109
111
  - man/foreman.1
110
112
  homepage: http://github.com/ddollar/foreman
@@ -122,9 +124,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
124
  required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  none: false
124
126
  requirements:
125
- - - ! '>='
127
+ - - ! '>'
126
128
  - !ruby/object:Gem::Version
127
- version: '0'
129
+ version: 1.3.1
128
130
  requirements: []
129
131
  rubyforge_project:
130
132
  rubygems_version: 1.8.11
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- LOG=<%= log_root %>/<%= process.name %>-<%= num %>
5
-
6
- test -d "$LOG" || mkdir -p m2750 "$LOG" && chown <%= user %> "$LOG"
7
- exec chpst -u <%= user %> svlogd "$LOG"
data/lib/foreman/color.rb DELETED
@@ -1,40 +0,0 @@
1
- require "foreman"
2
-
3
- module Foreman::Color
4
-
5
- ANSI = {
6
- :reset => 0,
7
- :black => 30,
8
- :red => 31,
9
- :green => 32,
10
- :yellow => 33,
11
- :blue => 34,
12
- :magenta => 35,
13
- :cyan => 36,
14
- :white => 37,
15
- :bright_black => 30,
16
- :bright_red => 31,
17
- :bright_green => 32,
18
- :bright_yellow => 33,
19
- :bright_blue => 34,
20
- :bright_magenta => 35,
21
- :bright_cyan => 36,
22
- :bright_white => 37,
23
- }
24
-
25
- def self.enable(io)
26
- io.extend(self)
27
- end
28
-
29
- def color?
30
- return false unless self.respond_to?(:isatty)
31
- self.isatty && ENV["TERM"]
32
- end
33
-
34
- def color(name)
35
- return "" unless color?
36
- return "" unless ansi = ANSI[name.to_sym]
37
- "\e[#{ansi}m"
38
- end
39
-
40
- end
@@ -1,26 +0,0 @@
1
- require "foreman"
2
-
3
- class Foreman::ProcfileEntry
4
-
5
- attr_reader :name
6
- attr_reader :command
7
- attr_accessor :color
8
-
9
- def initialize(name, command)
10
- @name = name
11
- @command = command
12
- end
13
-
14
- def spawn(num, pipe, basedir, environment, base_port)
15
- (1..num).to_a.map do |n|
16
- process = Foreman::Process.new(self, n, base_port + (n-1))
17
- process.run(pipe, basedir, environment)
18
- process
19
- end
20
- end
21
-
22
- def to_s
23
- "#{name}: #{command}"
24
- end
25
-
26
- end
data/lib/foreman/utils.rb DELETED
@@ -1,18 +0,0 @@
1
- require "foreman"
2
-
3
- class Foreman::Utils
4
-
5
- def self.parse_concurrency(concurrency)
6
- begin
7
- pairs = concurrency.to_s.gsub(/\s/, "").split(",")
8
-
9
- default = concurrency.nil? ? 1 : 0
10
-
11
- pairs.inject(Hash.new(default)) do |hash, pair|
12
- process, amount = pair.split("=")
13
- hash.update(process => amount.to_i)
14
- end
15
- end
16
- end
17
-
18
- end
@@ -1,31 +0,0 @@
1
- require "spec_helper"
2
- require "foreman/color"
3
-
4
- describe Foreman::Color do
5
-
6
- let(:io) { Object.new }
7
-
8
- it "should extend an object with colorization" do
9
- Foreman::Color.enable(io)
10
- io.should respond_to(:color)
11
- end
12
-
13
- it "should not colorize if the object does not respond to isatty" do
14
- mock(io).respond_to?(:isatty) { false }
15
- Foreman::Color.enable(io)
16
- io.color(:white).should == ""
17
- end
18
-
19
- it "should not colorize if the object is not a tty" do
20
- mock(io).isatty { false }
21
- Foreman::Color.enable(io)
22
- io.color(:white).should == ""
23
- end
24
-
25
- it "should colorize if the object is a tty" do
26
- mock(io).isatty { true }
27
- Foreman::Color.enable(io)
28
- io.color(:white).should == "\e[37m"
29
- end
30
-
31
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
- require 'foreman/procfile_entry'
3
- require 'pathname'
4
- require 'tmpdir'
5
-
6
- describe Foreman::ProcfileEntry do
7
- subject { described_class.new('alpha', './alpha') }
8
-
9
- it "stringifies as a Procfile line" do
10
- subject.to_s.should == 'alpha: ./alpha'
11
- end
12
-
13
- end
@@ -1,24 +0,0 @@
1
-
2
- [program:app-alpha]
3
- command=./alpha
4
- autostart=true
5
- autorestart=true
6
- stopsignal=QUIT
7
- stdout_logfile=/var/log/app/alpha-1-out.log
8
- stderr_logfile=/var/log/app/alpha-1-err.log
9
- user=app
10
- directory=/tmp/app
11
- environment=QUEUE="fastqueue,slowqueue",VERBOSE="1",PORT="5000"
12
- [program:app-bravo]
13
- command=./bravo
14
- autostart=true
15
- autorestart=true
16
- stopsignal=QUIT
17
- stdout_logfile=/var/log/app/bravo-1-out.log
18
- stderr_logfile=/var/log/app/bravo-1-err.log
19
- user=app
20
- directory=/tmp/app
21
- environment=QUEUE="fastqueue,slowqueue",VERBOSE="1",PORT="5100"
22
-
23
- [group:app]
24
- programs=app-alpha,app-bravo
@@ -1,21 +0,0 @@
1
-
2
- [program:app-alpha]
3
- command=./alpha
4
- autostart=true
5
- autorestart=true
6
- stopsignal=QUIT
7
- stdout_logfile=/var/log/app/alpha-1-out.log
8
- stderr_logfile=/var/log/app/alpha-1-err.log
9
- user=app
10
- directory=/tmp/app
11
- environment=FOO="bar",PORT="5000"
12
- [program:app-bravo]
13
- command=./bravo
14
- autostart=true
15
- autorestart=true
16
- stopsignal=QUIT
17
- stdout_logfile=/var/log/app/bravo-1-out.log
18
- stderr_logfile=/var/log/app/bravo-1-err.log
19
- user=app
20
- directory=/tmp/app
21
- environment=FOO="bar",PORT="5100"
@@ -1,24 +0,0 @@
1
-
2
- [program:app-alpha]
3
- command=./alpha
4
- autostart=true
5
- autorestart=true
6
- stopsignal=QUIT
7
- stdout_logfile=/var/log/app/alpha-1-out.log
8
- stderr_logfile=/var/log/app/alpha-1-err.log
9
- user=app
10
- directory=/tmp/app
11
- environment=PORT="5000"
12
- [program:app-bravo]
13
- command=./bravo
14
- autostart=true
15
- autorestart=true
16
- stopsignal=QUIT
17
- stdout_logfile=/var/log/app/bravo-1-out.log
18
- stderr_logfile=/var/log/app/bravo-1-err.log
19
- user=app
20
- directory=/tmp/app
21
- environment=PORT="5100"
22
-
23
- [group:app]
24
- programs=app-alpha,app-bravo