Skip to content
This repository
Browse code

Extracted the process scripts (inspector, reaper, spawner) into the p…

…lugin irs_process_scripts [DHH]
  • Loading branch information...
commit 3b3c0507e2f67a0f64dc04b396c1d13411ab5890 1 parent be140e8
David Heinemeier Hansson authored November 30, 2008
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *2.3.0 [Edge]*
2 2
 
  3
+* Extracted the process scripts (inspector, reaper, spawner) into the plugin irs_process_scripts [DHH]
  4
+
3 5
 * Changed Rails.root to return a Pathname object (allows for Rails.root.join('app', 'controllers') => "#{RAILS_ROOT}/app/controllers") #1482 [Damian Janowski/?]
4 6
 
5 7
 * Added view path support for engines [DHH]
6  railties/Rakefile
@@ -53,7 +53,6 @@ BASE_DIRS = %w(
53 53
   public
54 54
   script
55 55
   script/performance
56  
-  script/process
57 56
   test
58 57
   vendor
59 58
   vendor/plugins
@@ -71,7 +70,7 @@ LOG_FILES    = %w( server.log development.log test.log production.log )
71 70
 HTML_FILES   = %w( 422.html 404.html 500.html index.html robots.txt favicon.ico images/rails.png
72 71
                    javascripts/prototype.js javascripts/application.js
73 72
                    javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js )
74  
-BIN_FILES    = %w( about console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin )
  73
+BIN_FILES    = %w( about console destroy generate performance/benchmarker performance/profiler runner server plugin )
75 74
 
76 75
 VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport activeresource railties )
77 76
 
@@ -174,9 +173,6 @@ task :copy_dispatches do
174 173
 
175 174
   copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi")
176 175
   chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
177  
-
178  
-  # copy_with_rewritten_ruby_path("dispatches/gateway.cgi", "#{PKG_DESTINATION}/public/gateway.cgi")
179  
-  # chmod 0755, "#{PKG_DESTINATION}/public/gateway.cgi"
180 176
 end
181 177
 
182 178
 task :copy_html_files do
3  railties/bin/process/inspector
... ...
@@ -1,3 +0,0 @@
1  
-#!/usr/bin/env ruby
2  
-require File.dirname(__FILE__) + '/../../config/boot'
3  
-require 'commands/process/inspector'
3  railties/bin/process/reaper
... ...
@@ -1,3 +0,0 @@
1  
-#!/usr/bin/env ruby
2  
-require File.dirname(__FILE__) + '/../../config/boot'
3  
-require 'commands/process/reaper'
3  railties/bin/process/spawner
... ...
@@ -1,3 +0,0 @@
1  
-#!/usr/bin/env ruby
2  
-require File.dirname(__FILE__) + '/../../config/boot'
3  
-require 'commands/process/spawner'
68  railties/lib/commands/process/inspector.rb
... ...
@@ -1,68 +0,0 @@
1  
-require 'optparse'
2  
-
3  
-if RUBY_PLATFORM =~ /(:?mswin|mingw)/ then abort("Inspector is only for Unix") end
4  
-
5  
-OPTIONS = {
6  
-  :pid_path => File.expand_path(RAILS_ROOT + '/tmp/pids'),
7  
-  :pattern  => "dispatch.*.pid",
8  
-  :ps       => "ps -o pid,state,user,start,time,pcpu,vsz,majflt,command -p %s"
9  
-}
10  
-
11  
-class Inspector
12  
-  def self.inspect(pid_path, pattern)
13  
-    new(pid_path, pattern).inspect
14  
-  end
15  
-
16  
-  def initialize(pid_path, pattern)
17  
-    @pid_path, @pattern = pid_path, pattern
18  
-  end
19  
-
20  
-  def inspect
21  
-    header = `#{OPTIONS[:ps] % 1}`.split("\n")[0] + "\n"
22  
-    lines  = pids.collect { |pid| `#{OPTIONS[:ps] % pid}`.split("\n")[1] }
23  
-    
24  
-    puts(header + lines.join("\n"))
25  
-  end
26  
-
27  
-  private
28  
-    def pids
29  
-      pid_files.collect do |pid_file|
30  
-        File.read(pid_file).to_i
31  
-      end
32  
-    end
33  
-
34  
-    def pid_files
35  
-      Dir.glob(@pid_path + "/" + @pattern)
36  
-    end
37  
-end
38  
-
39  
-
40  
-ARGV.options do |opts|
41  
-  opts.banner = "Usage: inspector [options]"
42  
-
43  
-  opts.separator ""
44  
-
45  
-  opts.on <<-EOF
46  
-  Description:
47  
-    Displays system information about Rails dispatchers (or other processes that use pid files) through
48  
-    the ps command.
49  
-
50  
-  Examples:
51  
-    inspector                                             # default ps on all tmp/pids/dispatch.*.pid files
52  
-    inspector -s 'ps -o user,start,majflt,pcpu,vsz -p %s' # custom ps, %s is where the pid is interleaved
53  
-  EOF
54  
-
55  
-  opts.on("  Options:")
56  
-
57  
-  opts.on("-s", "--ps=command", "default: #{OPTIONS[:ps]}", String)           { |v| OPTIONS[:ps] = v }
58  
-  opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)   { |v| OPTIONS[:pid_path] = v }
59  
-  opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |v| OPTIONS[:pattern] = v }
60  
-
61  
-  opts.separator ""
62  
-
63  
-  opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
64  
-
65  
-  opts.parse!
66  
-end
67  
-
68  
-Inspector.inspect(OPTIONS[:pid_path], OPTIONS[:pattern])
149  railties/lib/commands/process/reaper.rb
... ...
@@ -1,149 +0,0 @@
1  
-require 'optparse'
2  
-require 'net/http'
3  
-require 'uri'
4  
-
5  
-if RUBY_PLATFORM =~ /(:?mswin|mingw)/ then abort("Reaper is only for Unix") end
6  
-
7  
-class Killer
8  
-  class << self
9  
-    # Searches for all processes matching the given keywords, and then invokes
10  
-    # a specific action on each of them. This is useful for (e.g.) reloading a
11  
-    # set of processes:
12  
-    #
13  
-    #   Killer.process(:reload, "/tmp/pids", "dispatcher.*.pid")
14  
-    def process(action, pid_path, pattern, keyword)
15  
-      new(pid_path, pattern, keyword).process(action)
16  
-    end
17  
-
18  
-    # Forces the (rails) application to reload by sending a +HUP+ signal to the
19  
-    # process.
20  
-    def reload(pid)
21  
-      `kill -s HUP #{pid}`
22  
-    end
23  
-
24  
-    # Force the (rails) application to restart by sending a +USR2+ signal to the
25  
-    # process.
26  
-    def restart(pid)
27  
-      `kill -s USR2 #{pid}`
28  
-    end
29  
-
30  
-    # Forces the (rails) application to gracefully terminate by sending a
31  
-    # +TERM+ signal to the process.
32  
-    def graceful(pid)
33  
-      `kill -s TERM #{pid}`
34  
-    end
35  
-
36  
-    # Forces the (rails) application to terminate immediately by sending a -9
37  
-    # signal to the process.
38  
-    def kill(pid)
39  
-      `kill -9 #{pid}`
40  
-    end
41  
-
42  
-    # Send a +USR1+ signal to the process.
43  
-    def usr1(pid)
44  
-      `kill -s USR1 #{pid}`
45  
-    end
46  
-  end
47  
-
48  
-  def initialize(pid_path, pattern, keyword=nil)
49  
-    @pid_path, @pattern, @keyword = pid_path, pattern, keyword
50  
-  end
51  
-
52  
-  def process(action)
53  
-    pids = find_processes
54  
-
55  
-    if pids.empty?
56  
-      warn "Couldn't find any pid file in '#{@pid_path}' matching '#{@pattern}'"
57  
-      warn "(also looked for processes matching #{@keyword.inspect})" if @keyword
58  
-    else
59  
-      pids.each do |pid|
60  
-        puts "#{action.capitalize}ing #{pid}"
61  
-        self.class.send(action, pid)
62  
-      end
63  
-      
64  
-      delete_pid_files if terminating?(action)
65  
-    end      
66  
-  end
67  
-  
68  
-  private
69  
-    def terminating?(action)
70  
-      [ "kill", "graceful" ].include?(action)
71  
-    end
72  
-  
73  
-    def find_processes
74  
-      files = pid_files
75  
-      if files.empty?
76  
-        find_processes_via_grep
77  
-      else
78  
-        files.collect { |pid_file| File.read(pid_file).to_i }
79  
-      end
80  
-    end
81  
-
82  
-    def find_processes_via_grep
83  
-      lines = `ps axww -o 'pid command' | grep #{@keyword}`.split(/\n/).
84  
-        reject { |line| line =~ /inq|ps axww|grep|spawn-fcgi|spawner|reaper/ }
85  
-      lines.map { |line| line[/^\s*(\d+)/, 1].to_i }
86  
-    end
87  
-    
88  
-    def delete_pid_files
89  
-      pid_files.each { |pid_file| File.delete(pid_file) }
90  
-    end
91  
-    
92  
-    def pid_files
93  
-      Dir.glob(@pid_path + "/" + @pattern)
94  
-    end
95  
-end
96  
-
97  
-
98  
-OPTIONS = {
99  
-  :action     => "restart",
100  
-  :pid_path   => File.expand_path(RAILS_ROOT + '/tmp/pids'),
101  
-  :pattern    => "dispatch.[0-9]*.pid",
102  
-  :dispatcher => File.expand_path("#{RAILS_ROOT}/public/dispatch.fcgi")
103  
-}
104  
-
105  
-ARGV.options do |opts|
106  
-  opts.banner = "Usage: reaper [options]"
107  
-
108  
-  opts.separator ""
109  
-
110  
-  opts.on <<-EOF
111  
-  Description:
112  
-    The reaper is used to restart, reload, gracefully exit, and forcefully exit processes
113  
-    running a Rails Dispatcher (or any other process responding to the same signals). This
114  
-    is commonly done when a new version of the application is available, so the existing
115  
-    processes can be updated to use the latest code.
116  
-
117  
-    It uses pid files to work on the processes and by default assume them to be located
118  
-    in RAILS_ROOT/tmp/pids. 
119  
-
120  
-    The reaper actions are:
121  
-
122  
-    * restart : Restarts the application by reloading both application and framework code
123  
-    * reload  : Only reloads the application, but not the framework (like the development environment)
124  
-    * graceful: Marks all of the processes for exit after the next request
125  
-    * kill    : Forcefully exists all processes regardless of whether they're currently serving a request
126  
-
127  
-    Restart is the most common and default action.
128  
-
129  
-  Examples:
130  
-    reaper                  # restarts the default dispatchers
131  
-    reaper -a reload        # reload the default dispatchers
132  
-    reaper -a kill -r *.pid # kill all processes that keep pids in tmp/pids
133  
-  EOF
134  
-
135  
-  opts.on("  Options:")
136  
-
137  
-  opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String)  { |v| OPTIONS[:action] = v }
138  
-  opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)                      { |v| OPTIONS[:pid_path] = v }
139  
-  opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String)                    { |v| OPTIONS[:pattern] = v }
140  
-  opts.on("-d", "--dispatcher=path", "DEPRECATED. default: #{OPTIONS[:dispatcher]}", String)     { |v| OPTIONS[:dispatcher] = v }
141  
-
142  
-  opts.separator ""
143  
-
144  
-  opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
145  
-
146  
-  opts.parse!
147  
-end
148  
-
149  
-Killer.process(OPTIONS[:action], OPTIONS[:pid_path], OPTIONS[:pattern], OPTIONS[:dispatcher])
219  railties/lib/commands/process/spawner.rb
... ...
@@ -1,219 +0,0 @@
1  
-require 'active_support'
2  
-require 'optparse'
3  
-require 'socket'
4  
-require 'fileutils'
5  
-
6  
-def daemonize #:nodoc:
7  
-  exit if fork                   # Parent exits, child continues.
8  
-  Process.setsid                 # Become session leader.
9  
-  exit if fork                   # Zap session leader. See [1].
10  
-  Dir.chdir "/"                  # Release old working directory.
11  
-  File.umask 0000                # Ensure sensible umask. Adjust as needed.
12  
-  STDIN.reopen "/dev/null"       # Free file descriptors and
13  
-  STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.
14  
-  STDERR.reopen STDOUT           # STDOUT/ERR should better go to a logfile.
15  
-end
16  
-
17  
-class Spawner
18  
-  def self.record_pid(name = "#{OPTIONS[:process]}.spawner", id = Process.pid)
19  
-    FileUtils.mkdir_p(OPTIONS[:pids])
20  
-    File.open(File.expand_path(OPTIONS[:pids] + "/#{name}.pid"), "w+") { |f| f.write(id) }
21  
-  end
22  
-
23  
-  def self.spawn_all
24  
-    OPTIONS[:instances].times do |i|
25  
-      port = OPTIONS[:port] + i
26  
-      print "Checking if something is already running on #{OPTIONS[:address]}:#{port}..."
27  
-
28  
-      begin
29  
-        srv = TCPServer.new(OPTIONS[:address], port)
30  
-        srv.close
31  
-        srv = nil
32  
-
33  
-        puts "NO"
34  
-        puts "Starting dispatcher on port: #{OPTIONS[:address]}:#{port}"
35  
-
36  
-        FileUtils.mkdir_p(OPTIONS[:pids])
37  
-        spawn(port)
38  
-      rescue
39  
-        puts "YES"
40  
-      end
41  
-    end
42  
-  end
43  
-end
44  
-
45  
-class FcgiSpawner < Spawner
46  
-  def self.spawn(port)
47  
-    cmd = "#{OPTIONS[:spawner]} -f #{OPTIONS[:dispatcher]} -p #{port} -P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid"
48  
-    cmd << " -a #{OPTIONS[:address]}" if can_bind_to_custom_address?
49  
-    system(cmd)
50  
-  end
51  
-
52  
-  def self.can_bind_to_custom_address?
53  
-    @@can_bind_to_custom_address ||= /^\s-a\s/.match `#{OPTIONS[:spawner]} -h`
54  
-  end
55  
-end
56  
-
57  
-class MongrelSpawner < Spawner
58  
-  def self.spawn(port)
59  
-    cmd =
60  
-      "mongrel_rails start -d " +
61  
-      "-a #{OPTIONS[:address]} " +
62  
-      "-p #{port} " +
63  
-      "-P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid " +
64  
-      "-e #{OPTIONS[:environment]} " +
65  
-      "-c #{OPTIONS[:rails_root]} " +
66  
-      "-l #{OPTIONS[:rails_root]}/log/mongrel.log"
67  
-
68  
-    # Add prefix functionality to spawner's call to mongrel_rails
69  
-    # Digging through mongrel's project subversion server, the earliest
70  
-    # Tag that has prefix implemented in the bin/mongrel_rails file
71  
-    # is 0.3.15 which also happens to be the earliest tag listed.
72  
-    # References: http://mongrel.rubyforge.org/svn/tags
73  
-    if Mongrel::Const::MONGREL_VERSION.to_f >=0.3 && !OPTIONS[:prefix].nil?
74  
-      cmd = cmd + " --prefix #{OPTIONS[:prefix]}"
75  
-    end
76  
-    system(cmd)
77  
-  end
78  
-  
79  
-  def self.can_bind_to_custom_address?
80  
-    true
81  
-  end
82  
-end
83  
-
84  
-
85  
-begin
86  
-  require_library_or_gem 'fcgi'
87  
-rescue Exception
88  
-  # FCGI not available
89  
-end
90  
-
91  
-begin
92  
-  require_library_or_gem 'mongrel'
93  
-rescue Exception
94  
-  # Mongrel not available
95  
-end
96  
-
97  
-server = case ARGV.first
98  
-  when "fcgi", "mongrel"
99  
-    ARGV.shift
100  
-  else
101  
-    if defined?(Mongrel)
102  
-      "mongrel"
103  
-    elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `spawn-fcgi -version` }.blank? && defined?(FCGI)
104  
-      "fcgi"
105  
-    end
106  
-end
107  
-
108  
-case server
109  
-  when "fcgi"
110  
-    puts "=> Starting FCGI dispatchers"
111  
-    spawner_class = FcgiSpawner
112  
-  when "mongrel"
113  
-    puts "=> Starting mongrel dispatchers"
114  
-    spawner_class = MongrelSpawner
115  
-  else
116  
-    puts "Neither FCGI (spawn-fcgi) nor Mongrel was installed and available!"
117  
-    exit(0)
118  
-end
119  
-
120  
-
121  
-
122  
-OPTIONS = {
123  
-  :environment => "production",
124  
-  :spawner     => '/usr/bin/env spawn-fcgi',
125  
-  :dispatcher  => File.expand_path(RELATIVE_RAILS_ROOT + '/public/dispatch.fcgi'),
126  
-  :pids        => File.expand_path(RELATIVE_RAILS_ROOT + "/tmp/pids"),
127  
-  :rails_root  => File.expand_path(RELATIVE_RAILS_ROOT),
128  
-  :process     => "dispatch",
129  
-  :port        => 8000,
130  
-  :address     => '0.0.0.0',
131  
-  :instances   => 3,
132  
-  :repeat      => nil,
133  
-  :prefix      => nil
134  
-}
135  
-
136  
-ARGV.options do |opts|
137  
-  opts.banner = "Usage: spawner [platform] [options]"
138  
-
139  
-  opts.separator ""
140  
-
141  
-  opts.on <<-EOF
142  
-  Description:
143  
-    The spawner is a wrapper for spawn-fcgi and mongrel that makes it
144  
-    easier to start multiple processes running the Rails dispatcher. The
145  
-    spawn-fcgi command is included with the lighttpd web server, but can
146  
-    be used with both Apache and lighttpd (and any other web server
147  
-    supporting externally managed FCGI processes). Mongrel automatically
148  
-    ships with with mongrel_rails for starting dispatchers.
149  
-
150  
-    The first choice you need to make is whether to spawn the Rails
151  
-    dispatchers as FCGI or Mongrel. By default, this spawner will prefer
152  
-    Mongrel, so if that's installed, and no platform choice is made,
153  
-    Mongrel is used.
154  
-
155  
-    Then decide a starting port (default is 8000) and the number of FCGI
156  
-    process instances you'd like to run. So if you pick 9100 and 3
157  
-    instances, you'll start processes on 9100, 9101, and 9102.
158  
-
159  
-    By setting the repeat option, you get a protection loop, which will
160  
-    attempt to restart any FCGI processes that might have been exited or
161  
-    outright crashed.
162  
-
163  
-    You can select bind address for started processes. By default these
164  
-    listen on every interface. For single machine installations you would
165  
-    probably want to use 127.0.0.1, hiding them form the outside world.
166  
-
167  
-     Examples:
168  
-       spawner               # starts instances on 8000, 8001, and 8002
169  
-                             # using Mongrel if available.
170  
-       spawner fcgi          # starts instances on 8000, 8001, and 8002
171  
-                             # using FCGI.
172  
-       spawner mongrel -i 5  # starts instances on 8000, 8001, 8002,
173  
-                             # 8003, and 8004 using Mongrel.
174  
-       spawner -p 9100 -i 10 # starts 10 instances counting from 9100 to
175  
-                             # 9109 using Mongrel if available.
176  
-       spawner -p 9100 -r 5  # starts 3 instances counting from 9100 to
177  
-                             # 9102 and attempts start them every 5
178  
-                             # seconds.
179  
-       spawner -a 127.0.0.1  # starts 3 instances binding to localhost
180  
-  EOF
181  
-
182  
-  opts.on("  Options:")
183  
-
184  
-  opts.on("-p", "--port=number",      Integer, "Starting port number (default: #{OPTIONS[:port]})")                { |v| OPTIONS[:port] = v }
185  
-
186  
-  if spawner_class.can_bind_to_custom_address?
187  
-    opts.on("-a", "--address=ip",     String,  "Bind to IP address (default: #{OPTIONS[:address]})")                { |v| OPTIONS[:address] = v }
188  
-  end
189  
-
190  
-  opts.on("-p", "--port=number",      Integer, "Starting port number (default: #{OPTIONS[:port]})")                { |v| OPTIONS[:port] = v }
191  
-  opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})")            { |v| OPTIONS[:instances] = v }
192  
-  opts.on("-r", "--repeat=seconds",   Integer, "Repeat spawn attempts every n seconds (default: off)")             { |v| OPTIONS[:repeat] = v }
193  
-  opts.on("-e", "--environment=name", String,  "test|development|production (default: #{OPTIONS[:environment]})")  { |v| OPTIONS[:environment] = v }
194  
-  opts.on("-P", "--prefix=path",      String,  "URL prefix for Rails app. [Used only with Mongrel > v0.3.15]: (default: #{OPTIONS[:prefix]})")         { |v| OPTIONS[:prefix] = v }
195  
-  opts.on("-n", "--process=name",     String,  "default: #{OPTIONS[:process]}")                                    { |v| OPTIONS[:process] = v }
196  
-  opts.on("-s", "--spawner=path",     String,  "default: #{OPTIONS[:spawner]}")                                    { |v| OPTIONS[:spawner] = v }
197  
-  opts.on("-d", "--dispatcher=path",  String,  "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) }
198  
-
199  
-  opts.separator ""
200  
-
201  
-  opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
202  
-
203  
-  opts.parse!
204  
-end
205  
-
206  
-ENV["RAILS_ENV"] = OPTIONS[:environment]
207  
-
208  
-if OPTIONS[:repeat]
209  
-  daemonize
210  
-  trap("TERM") { exit }
211  
-  spawner_class.record_pid
212  
-
213  
-  loop do
214  
-    spawner_class.spawn_all
215  
-    sleep(OPTIONS[:repeat])
216  
-  end
217  
-else
218  
-  spawner_class.spawn_all
219  
-end
57  railties/lib/commands/process/spinner.rb
... ...
@@ -1,57 +0,0 @@
1  
-require 'optparse'
2  
-
3  
-def daemonize #:nodoc:
4  
-  exit if fork                   # Parent exits, child continues.
5  
-  Process.setsid                 # Become session leader.
6  
-  exit if fork                   # Zap session leader. See [1].
7  
-  Dir.chdir "/"                  # Release old working directory.
8  
-  File.umask 0000                # Ensure sensible umask. Adjust as needed.
9  
-  STDIN.reopen "/dev/null"       # Free file descriptors and
10  
-  STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.
11  
-  STDERR.reopen STDOUT           # STDOUT/ERR should better go to a logfile.
12  
-end
13  
-
14  
-OPTIONS = {
15  
-  :interval => 5.0,
16  
-  :command  => File.expand_path(RAILS_ROOT + '/script/process/spawner'),
17  
-  :daemon   => false
18  
-}
19  
-
20  
-ARGV.options do |opts|
21  
-  opts.banner = "Usage: spinner [options]"
22  
-
23  
-  opts.separator ""
24  
-
25  
-  opts.on <<-EOF
26  
-  Description:
27  
-    The spinner is a protection loop for the spawner, which will attempt to restart any FCGI processes
28  
-    that might have been exited or outright crashed. It's a brute-force attempt that'll just try
29  
-    to run the spawner every X number of seconds, so it does pose a light load on the server.
30  
-
31  
-  Examples:
32  
-    spinner # attempts to run the spawner with default settings every second with output on the terminal
33  
-    spinner -i 3 -d # only run the spawner every 3 seconds and detach from the terminal to become a daemon
34  
-    spinner -c '/path/to/app/script/process/spawner -p 9000 -i 10' -d # using custom spawner
35  
-  EOF
36  
-
37  
-  opts.on("  Options:")
38  
-
39  
-  opts.on("-c", "--command=path",    String) { |v| OPTIONS[:command] = v }
40  
-  opts.on("-i", "--interval=seconds", Float) { |v| OPTIONS[:interval] = v }
41  
-  opts.on("-d", "--daemon")                  { |v| OPTIONS[:daemon] = v }
42  
-
43  
-  opts.separator ""
44  
-
45  
-  opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
46  
-
47  
-  opts.parse!
48  
-end
49  
-
50  
-daemonize if OPTIONS[:daemon]
51  
-
52  
-trap(OPTIONS[:daemon] ? "TERM" : "INT") { exit }
53  
-
54  
-loop do
55  
-  system(OPTIONS[:command])
56  
-  sleep(OPTIONS[:interval])
57  
-end
5  railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -85,7 +85,6 @@ def create_directories(m)
85 85
         public/javascripts
86 86
         public/stylesheets
87 87
         script/performance
88  
-        script/process
89 88
         test/fixtures
90 89
         test/functional
91 90
         test/integration
@@ -139,8 +138,8 @@ def create_public_files(m)
139 138
     
140 139
     def create_script_files(m)
141 140
       %w( 
142  
-        about console dbconsole destroy generate performance/benchmarker performance/profiler
143  
-        performance/request process/reaper process/spawner process/inspector runner server plugin 
  141
+        about console dbconsole destroy generate runner server plugin
  142
+        performance/benchmarker performance/profiler performance/request
144 143
       ).each do |file|
145 144
         m.file "bin/#{file}", "script/#{file}", { 
146 145
           :chmod => 0755, 

0 notes on commit 3b3c050

Please sign in to comment.
Something went wrong with that request. Please try again.