foreman 0.62.0-mingw32 → 0.63.0-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -43,4 +43,6 @@ David Dollar
43
43
 
44
44
  ## License
45
45
 
46
- MIT
46
+ Foreman is licensed under the MIT license.
47
+
48
+ See LICENSE for the full license text.
@@ -34,7 +34,7 @@ shift $((OPTIND-1))
34
34
 
35
35
  if [ "$read_profile" = "1" ]; then
36
36
  if [ -f .profile ]; then
37
- . .profile
37
+ . ./.profile
38
38
  fi
39
39
  fi
40
40
 
@@ -7,10 +7,6 @@ EOF
7
7
 
8
8
  end script
9
9
 
10
- start on (started network-interface
11
- or started network-manager
12
- or started networking)
10
+ start on runlevel [2345]
13
11
 
14
- stop on (stopping network-interface
15
- or stopping network-manager
16
- or stopping networking)
12
+ stop on runlevel [016]
@@ -1,7 +1,7 @@
1
1
  require "foreman"
2
- require "foreman/env"
3
2
  require "foreman/process"
4
3
  require "foreman/procfile"
4
+ require "dotenv"
5
5
  require "tempfile"
6
6
  require "timeout"
7
7
  require "fileutils"
@@ -52,9 +52,6 @@ class Foreman::Engine
52
52
  # Start the processes registered to this +Engine+
53
53
  #
54
54
  def start
55
- # Make sure foreman is the process group leader.
56
- Process.setpgrp unless Foreman.windows?
57
-
58
55
  register_signal_handlers
59
56
  startup
60
57
  spawn_processes
@@ -172,9 +169,7 @@ class Foreman::Engine
172
169
  # @param [String] filename A .env file to load into the environment
173
170
  #
174
171
  def load_env(filename)
175
- Foreman::Env.new(filename).entries do |name, value|
176
- @env[name] = value
177
- end
172
+ @env.update Dotenv::Environment.new(filename)
178
173
  end
179
174
 
180
175
  # Send a signal to all processes started by this +Engine+
@@ -207,7 +202,7 @@ class Foreman::Engine
207
202
  kill_children(signal)
208
203
  else
209
204
  begin
210
- Process.kill "-#{signal}", Process.getpgrp
205
+ Process.kill "-#{signal}", Process.pid
211
206
  rescue Errno::ESRCH, Errno::EPERM
212
207
  end
213
208
  end
@@ -6,7 +6,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base
6
6
  def export
7
7
  super
8
8
 
9
- Dir["#{location}/#{app}*.conf"].each do |file|
9
+ (Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
10
10
  clean file
11
11
  end
12
12
 
@@ -83,7 +83,7 @@ private
83
83
 
84
84
  def parse(filename)
85
85
  File.read(filename).gsub("\r\n","\n").split("\n").map do |line|
86
- if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/
86
+ if line =~ /^([A-Za-z0-9_-]+):\s*(.+)$/
87
87
  [$1, $2]
88
88
  end
89
89
  end.compact
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.62.0"
3
+ VERSION = "0.63.0"
4
4
 
5
5
  end
@@ -46,10 +46,6 @@ Specify an alternate Procfile to load, implies \fB\-d\fR at the Procfile root\.
46
46
  \fB\-p\fR, \fB\-\-port\fR
47
47
  Specify which port to use as the base for this application\. Should be a multiple of 1000\.
48
48
  .
49
- .TP
50
- \fB\-t\fR, \fB\-\-tmux\fR
51
- Runs the processes in a tmux session\. Creates one window for each process and an extra window containing the output of each window (requires gawk)\.
52
- .
53
49
  .P
54
50
  \fBforeman run\fR is used to run one\-off commands using the same environment as your defined processes\.
55
51
  .
@@ -234,7 +230,7 @@ Run one process type from the application defined in a specific Procfile:
234
230
  .
235
231
  .nf
236
232
 
237
- $ foreman start alpha \-p ~/myapp/Procfile
233
+ $ foreman start alpha \-f ~/myapp/Procfile
238
234
  .
239
235
  .fi
240
236
  .
@@ -50,7 +50,7 @@ describe "Foreman::CLI", :fakefs do
50
50
  describe "check" do
51
51
  it "with a valid Procfile displays the jobs" do
52
52
  write_procfile
53
- foreman("check").should == "valid procfile detected (alpha, bravo)\n"
53
+ foreman("check").should == "valid procfile detected (alpha, bravo, foo_bar, foo-bar)\n"
54
54
  end
55
55
 
56
56
  it "with a blank Procfile displays an error" do
@@ -29,11 +29,27 @@ describe Foreman::Export::Upstart, :fakefs do
29
29
  mock(FileUtils).rm("/tmp/init/app-alpha-1.conf")
30
30
  mock(FileUtils).rm("/tmp/init/app-bravo.conf")
31
31
  mock(FileUtils).rm("/tmp/init/app-bravo-1.conf")
32
+ mock(FileUtils).rm("/tmp/init/app-foo-bar.conf")
33
+ mock(FileUtils).rm("/tmp/init/app-foo-bar-1.conf")
34
+ mock(FileUtils).rm("/tmp/init/app-foo_bar.conf")
35
+ mock(FileUtils).rm("/tmp/init/app-foo_bar-1.conf")
32
36
 
33
37
  upstart.export
34
38
  upstart.export
35
39
  end
36
40
 
41
+ it "does not delete exported files for similarly named applications" do
42
+ FileUtils.mkdir_p "/tmp/init"
43
+
44
+ ["app2", "app2-alpha", "app2-alpha-1"].each do |name|
45
+ path = "/tmp/init/#{name}.conf"
46
+ FileUtils.touch(path)
47
+ dont_allow(FileUtils).rm(path)
48
+ end
49
+
50
+ upstart.export
51
+ end
52
+
37
53
  it "quotes and escapes environment variables" do
38
54
  engine.env['KEY'] = 'd"\|d'
39
55
  upstart.export
@@ -16,8 +16,10 @@ describe Foreman::Procfile, :fakefs do
16
16
  it "loads a passed-in Procfile" do
17
17
  write_procfile
18
18
  procfile = Foreman::Procfile.new("Procfile")
19
- procfile["alpha"].should == "./alpha"
20
- procfile["bravo"].should == "./bravo"
19
+ procfile["alpha"].should == "./alpha"
20
+ procfile["bravo"].should == "./bravo"
21
+ procfile["foo-bar"].should == "./foo-bar"
22
+ procfile["foo_bar"].should == "./foo_bar"
21
23
  end
22
24
 
23
25
  it "can have a process appended to it" do
@@ -42,5 +42,40 @@ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepil
42
42
  process.group = "app-bravo"
43
43
  end
44
44
 
45
+ app.process("foo_bar-1") do |process|
46
+ process.start_command = "./foo_bar"
45
47
 
48
+ process.working_dir = "/tmp/app"
49
+ process.daemonize = true
50
+ process.environment = {"PORT"=>"5200"}
51
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
52
+ process.stop_grace_time = 45.seconds
53
+
54
+ process.stdout = process.stderr = "/var/log/app/app-foo_bar-1.log"
55
+
56
+ process.monitor_children do |children|
57
+ children.stop_command "kill {{PID}}"
58
+ end
59
+
60
+ process.group = "app-foo_bar"
61
+ end
62
+
63
+ app.process("foo-bar-1") do |process|
64
+ process.start_command = "./foo-bar"
65
+
66
+ process.working_dir = "/tmp/app"
67
+ process.daemonize = true
68
+ process.environment = {"PORT"=>"5300"}
69
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
70
+ process.stop_grace_time = 45.seconds
71
+
72
+ process.stdout = process.stderr = "/var/log/app/app-foo-bar-1.log"
73
+
74
+ process.monitor_children do |children|
75
+
76
+ children.stop_command "kill {{PID}}"
77
+ end
78
+
79
+ process.group = "app-foo-bar"
80
+ end
46
81
  end
@@ -1,4 +1,6 @@
1
1
  # ----- foreman app processes -----
2
2
  AP01:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5000;./alpha >> /var/log/app/alpha-1.log 2>&1'
3
3
  AP02:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5100;./bravo >> /var/log/app/bravo-1.log 2>&1'
4
+ AP03:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5200;./foo_bar >> /var/log/app/foo_bar-1.log 2>&1'
5
+ AP04:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5300;./foo-bar >> /var/log/app/foo-bar-1.log 2>&1'
4
6
  # ----- end foreman app processes -----
@@ -19,6 +19,26 @@ stderr_logfile=/var/log/app/bravo-1.error.log
19
19
  user=app
20
20
  directory=/tmp/app
21
21
  environment=PORT=5100
22
+ [program:app-foo_bar-1]
23
+ command=./foo_bar
24
+ autostart=true
25
+ autorestart=true
26
+ stopsignal=QUIT
27
+ stdout_logfile=/var/log/app/foo_bar-1.log
28
+ stderr_logfile=/var/log/app/foo_bar-1.error.log
29
+ user=app
30
+ directory=/tmp/app
31
+ environment=PORT=5200
32
+ [program:app-foo-bar-1]
33
+ command=./foo-bar
34
+ autostart=true
35
+ autorestart=true
36
+ stopsignal=QUIT
37
+ stdout_logfile=/var/log/app/foo-bar-1.log
38
+ stderr_logfile=/var/log/app/foo-bar-1.error.log
39
+ user=app
40
+ directory=/tmp/app
41
+ environment=PORT=5300
22
42
 
23
43
  [group:app]
24
- programs=app-alpha-1,app-bravo-1
44
+ programs=app-alpha-1,app-bravo-1,app-foo_bar-1,app-foo-bar-1
@@ -7,10 +7,6 @@ EOF
7
7
 
8
8
  end script
9
9
 
10
- start on (started network-interface
11
- or started network-manager
12
- or started networking)
10
+ start on runlevel [2345]
13
11
 
14
- stop on (stopping network-interface
15
- or stopping network-manager
16
- or stopping networking)
12
+ stop on runlevel [016]
@@ -79,6 +79,8 @@ def write_procfile(procfile="Procfile", alpha_env="")
79
79
  file.puts "alpha: ./alpha" + " #{alpha_env}".rstrip
80
80
  file.puts "\n"
81
81
  file.puts "bravo:\t./bravo"
82
+ file.puts "foo_bar:\t./foo_bar"
83
+ file.puts "foo-bar:\t./foo-bar"
82
84
  end
83
85
  File.expand_path(procfile)
84
86
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0
4
+ version: 0.63.0
5
+ prerelease:
5
6
  platform: mingw32
6
7
  authors:
7
8
  - David Dollar
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-08 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70250516346600 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 0.13.6
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
24
+ version_requirements: *70250516346600
25
+ - !ruby/object:Gem::Dependency
26
+ name: dotenv
27
+ requirement: &70250516341680 !ruby/object:Gem::Requirement
28
+ none: false
23
29
  requirements:
24
- - - '>='
30
+ - - ! '>='
25
31
  - !ruby/object:Gem::Version
26
- version: 0.13.6
32
+ version: '0.7'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70250516341680
27
36
  - !ruby/object:Gem::Dependency
28
37
  name: win32console
29
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70250516354100 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ~>
32
42
  - !ruby/object:Gem::Version
33
43
  version: 1.3.0
34
44
  type: :runtime
35
45
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 1.3.0
46
+ version_requirements: *70250516354100
41
47
  description: Process manager for applications with multiple components
42
48
  email: ddollar@gmail.com
43
49
  executables:
@@ -69,7 +75,6 @@ files:
69
75
  - lib/foreman/distribution.rb
70
76
  - lib/foreman/engine/cli.rb
71
77
  - lib/foreman/engine.rb
72
- - lib/foreman/env.rb
73
78
  - lib/foreman/export/base.rb
74
79
  - lib/foreman/export/bluepill.rb
75
80
  - lib/foreman/export/inittab.rb
@@ -130,26 +135,27 @@ files:
130
135
  homepage: http://github.com/ddollar/foreman
131
136
  licenses:
132
137
  - MIT
133
- metadata: {}
134
138
  post_install_message:
135
139
  rdoc_options: []
136
140
  require_paths:
137
141
  - lib
138
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
139
144
  requirements:
140
- - - '>='
145
+ - - ! '>='
141
146
  - !ruby/object:Gem::Version
142
147
  version: '0'
143
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
144
150
  requirements:
145
- - - '>='
151
+ - - ! '>='
146
152
  - !ruby/object:Gem::Version
147
153
  version: '0'
148
154
  requirements: []
149
155
  rubyforge_project:
150
- rubygems_version: 2.0.0
156
+ rubygems_version: 1.8.11
151
157
  signing_key:
152
- specification_version: 4
158
+ specification_version: 3
153
159
  summary: Process manager for applications with multiple components
154
160
  test_files: []
155
161
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c0a87ff21f4fd9a2caff939e6278a5eb7b94b8f4
4
- data.tar.gz: 8cdb734c00c58f7489def4e3a32ffe73851e0f3f
5
- SHA512:
6
- metadata.gz: 61805b66d6b87b66015eb064764d26db7c14fd121fd9aaf427dfabb0c0b8e664949da04a3dd3aead077aa2afd25eb778c5d927daf3a56ea7e262aa8a69302aad
7
- data.tar.gz: 52a3a51a00a937d8bbfafd246257fc5de2db3773a4671213738a527458d6632b5a99d75d2bd54f3925e38e39d720a9361f9e1cff0a3010492aed1a72737e21cf
@@ -1,29 +0,0 @@
1
- require "foreman"
2
-
3
- class Foreman::Env
4
-
5
- attr_reader :entries
6
-
7
- def initialize(filename)
8
- @entries = File.read(filename).gsub("\r\n","\n").split("\n").inject({}) do |ax, line|
9
- if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
10
- key = $1
11
- case val = $2
12
- # Remove single quotes
13
- when /\A'(.*)'\z/ then ax[key] = $1
14
- # Remove double quotes and unescape string preserving newline characters
15
- when /\A"(.*)"\z/ then ax[key] = $1.gsub('\n', "\n").gsub(/\\(.)/, '\1')
16
- else ax[key] = val
17
- end
18
- end
19
- ax
20
- end
21
- end
22
-
23
- def entries
24
- @entries.each do |key, value|
25
- yield key, value
26
- end
27
- end
28
-
29
- end