rails 2.0.5 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +115 -3
- data/MIT-LICENSE +1 -1
- data/README +67 -14
- data/Rakefile +9 -19
- data/bin/dbconsole +3 -0
- data/bin/rails +0 -0
- data/builtin/rails_info/rails/info.rb +5 -5
- data/configs/apache.conf +0 -0
- data/configs/databases/frontbase.yml +2 -2
- data/configs/databases/mysql.yml +2 -2
- data/configs/databases/oracle.yml +3 -3
- data/configs/databases/postgresql.yml +2 -2
- data/configs/databases/sqlite2.yml +2 -2
- data/configs/databases/sqlite3.yml +2 -2
- data/configs/initializers/new_rails_defaults.rb +15 -0
- data/configs/routes.rb +6 -0
- data/dispatches/dispatch.fcgi +0 -0
- data/dispatches/dispatch.rb +0 -0
- data/environments/boot.rb +1 -0
- data/environments/development.rb +0 -1
- data/environments/environment.rb +15 -7
- data/environments/production.rb +3 -0
- data/environments/test.rb +1 -1
- data/fresh_rakefile +0 -0
- data/helpers/application.rb +5 -0
- data/html/images/rails.png +0 -0
- data/html/index.html +6 -9
- data/html/javascripts/controls.js +1 -1
- data/html/javascripts/dragdrop.js +1 -1
- data/html/javascripts/effects.js +1 -1
- data/lib/commands/console.rb +2 -2
- data/lib/commands/dbconsole.rb +65 -0
- data/lib/commands/generate.rb +0 -0
- data/lib/commands/performance/profiler.rb +1 -1
- data/lib/commands/performance/request.rb +0 -0
- data/lib/commands/plugin.rb +28 -1
- data/lib/commands/server.rb +2 -2
- data/lib/commands/servers/lighttpd.rb +1 -1
- data/lib/commands/servers/mongrel.rb +9 -9
- data/lib/commands/servers/new_mongrel.rb +16 -0
- data/lib/commands/servers/webrick.rb +1 -1
- data/lib/console_app.rb +2 -2
- data/lib/dispatcher.rb +1 -1
- data/lib/fcgi_handler.rb +32 -16
- data/lib/initializer.rb +273 -59
- data/lib/rails/gem_builder.rb +21 -0
- data/lib/rails/gem_dependency.rb +124 -0
- data/lib/rails/mongrel_server/commands.rb +342 -0
- data/lib/rails/mongrel_server/handler.rb +55 -0
- data/lib/rails/plugin.rb +42 -11
- data/lib/rails/plugin/loader.rb +3 -1
- data/lib/rails/plugin/locator.rb +22 -1
- data/lib/rails/version.rb +2 -2
- data/lib/rails_generator/base.rb +1 -1
- data/lib/rails_generator/commands.rb +63 -47
- data/lib/rails_generator/generators/applications/app/app_generator.rb +5 -7
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +1 -4
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +1 -1
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +2 -6
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +8 -6
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/migration/USAGE +4 -4
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -0
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -20
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +3 -4
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +3 -4
- data/lib/rails_generator/lookup.rb +6 -2
- data/lib/rails_generator/options.rb +7 -0
- data/lib/rails_generator/scripts.rb +8 -5
- data/lib/rails_generator/secret_key_generator.rb +12 -8
- data/lib/source_annotation_extractor.rb +40 -0
- data/lib/tasks/databases.rake +52 -27
- data/lib/tasks/framework.rake +22 -29
- data/lib/tasks/gems.rake +64 -0
- data/lib/tasks/misc.rake +47 -0
- data/lib/tasks/testing.rake +1 -1
- data/lib/test_help.rb +8 -0
- metadata +19 -15
@@ -5,8 +5,8 @@ development:
|
|
5
5
|
database: db/development.sqlite3
|
6
6
|
timeout: 5000
|
7
7
|
|
8
|
-
# Warning: The database defined as
|
9
|
-
# re-generated from your development database when you run
|
8
|
+
# Warning: The database defined as "test" will be erased and
|
9
|
+
# re-generated from your development database when you run "rake".
|
10
10
|
# Do not set this db to the same as development or production.
|
11
11
|
test:
|
12
12
|
adapter: sqlite3
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
2
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
3
|
+
|
4
|
+
# Include Active Record class name as root for JSON serialized output.
|
5
|
+
ActiveRecord::Base.include_root_in_json = true
|
6
|
+
|
7
|
+
# Store the full class name (including module namespace) in STI type column.
|
8
|
+
ActiveRecord::Base.store_full_sti_class = true
|
9
|
+
|
10
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
11
|
+
ActiveSupport.use_standard_json_time_format = true
|
12
|
+
|
13
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
14
|
+
# if you're including raw json in an HTML page.
|
15
|
+
ActiveSupport.escape_html_entities_in_json = false
|
data/configs/routes.rb
CHANGED
@@ -17,6 +17,12 @@ ActionController::Routing::Routes.draw do |map|
|
|
17
17
|
|
18
18
|
# Sample resource route with sub-resources:
|
19
19
|
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
20
|
+
|
21
|
+
# Sample resource route with more complex sub-resources
|
22
|
+
# map.resources :products do |products|
|
23
|
+
# products.resources :comments
|
24
|
+
# products.resources :sales, :collection => { :recent => :get }
|
25
|
+
# end
|
20
26
|
|
21
27
|
# Sample resource route within a namespace:
|
22
28
|
# map.namespace :admin do |admin|
|
data/dispatches/dispatch.fcgi
CHANGED
File without changes
|
data/dispatches/dispatch.rb
CHANGED
File without changes
|
data/environments/boot.rb
CHANGED
data/environments/development.rb
CHANGED
@@ -12,7 +12,6 @@ config.whiny_nils = true
|
|
12
12
|
config.action_controller.consider_all_requests_local = true
|
13
13
|
config.action_view.debug_rjs = true
|
14
14
|
config.action_controller.perform_caching = false
|
15
|
-
config.action_view.cache_template_extensions = false
|
16
15
|
|
17
16
|
# Don't care if the mailer can't send
|
18
17
|
config.action_mailer.raise_delivery_errors = false
|
data/environments/environment.rb
CHANGED
@@ -16,10 +16,16 @@ Rails::Initializer.run do |config|
|
|
16
16
|
# -- all .rb files in that directory are automatically loaded.
|
17
17
|
# See Rails::Configuration for more options.
|
18
18
|
|
19
|
-
# Skip frameworks you're not going to use
|
20
|
-
#
|
19
|
+
# Skip frameworks you're not going to use. To use Rails without a database
|
20
|
+
# you must remove the Active Record framework.
|
21
21
|
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
22
22
|
|
23
|
+
# Specify gems that this application depends on.
|
24
|
+
# They can then be installed with "rake gems:install" on new installations.
|
25
|
+
# config.gem "bj"
|
26
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
27
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
28
|
+
|
23
29
|
# Only load the plugins named here, in the order given. By default, all plugins
|
24
30
|
# in vendor/plugins are loaded in alphabetical order.
|
25
31
|
# :all can be used as a placeholder for all plugins not explicitly named
|
@@ -32,6 +38,11 @@ Rails::Initializer.run do |config|
|
|
32
38
|
# (by default production uses :info, the others :debug)
|
33
39
|
# config.log_level = :debug
|
34
40
|
|
41
|
+
# Make Time.zone default to the specified zone, and make Active Record store time values
|
42
|
+
# in the database in UTC, and return them converted to the specified local zone.
|
43
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time.
|
44
|
+
config.time_zone = 'UTC'
|
45
|
+
|
35
46
|
# Your secret key for verifying cookie session data integrity.
|
36
47
|
# If you change this key, all old sessions will become invalid!
|
37
48
|
# Make sure the secret is at least 30 characters and all random,
|
@@ -43,7 +54,7 @@ Rails::Initializer.run do |config|
|
|
43
54
|
|
44
55
|
# Use the database for sessions instead of the cookie-based default,
|
45
56
|
# which shouldn't be used to store highly confidential information
|
46
|
-
# (create the session table with
|
57
|
+
# (create the session table with "rake db:sessions:create")
|
47
58
|
# config.action_controller.session_store = :active_record_store
|
48
59
|
|
49
60
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
@@ -53,7 +64,4 @@ Rails::Initializer.run do |config|
|
|
53
64
|
|
54
65
|
# Activate observers that should always be running
|
55
66
|
# config.active_record.observers = :cacher, :garbage_collector
|
56
|
-
|
57
|
-
# Make Active Record use UTC-base instead of local time
|
58
|
-
# config.active_record.default_timezone = :utc
|
59
|
-
end
|
67
|
+
end
|
data/environments/production.rb
CHANGED
@@ -12,6 +12,9 @@ config.action_controller.consider_all_requests_local = false
|
|
12
12
|
config.action_controller.perform_caching = true
|
13
13
|
config.action_view.cache_template_loading = true
|
14
14
|
|
15
|
+
# Use a different cache store in production
|
16
|
+
# config.cache_store = :mem_cache_store
|
17
|
+
|
15
18
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
16
19
|
# config.action_controller.asset_host = "http://assets.example.com"
|
17
20
|
|
data/environments/test.rb
CHANGED
@@ -16,7 +16,7 @@ config.action_controller.perform_caching = false
|
|
16
16
|
# Disable request forgery protection in test environment
|
17
17
|
config.action_controller.allow_forgery_protection = false
|
18
18
|
|
19
|
-
# Tell
|
19
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
20
20
|
# The :test delivery method accumulates sent emails in the
|
21
21
|
# ActionMailer::Base.deliveries array.
|
22
22
|
config.action_mailer.delivery_method = :test
|
data/fresh_rakefile
CHANGED
File without changes
|
data/helpers/application.rb
CHANGED
@@ -7,4 +7,9 @@ class ApplicationController < ActionController::Base
|
|
7
7
|
# See ActionController::RequestForgeryProtection for details
|
8
8
|
# Uncomment the :secret if you're not using the cookie session store
|
9
9
|
protect_from_forgery # :secret => '<%= app_secret %>'
|
10
|
+
|
11
|
+
# See ActionController::Base for details
|
12
|
+
# Uncomment this to filter the contents of submitted sensitive data parameters
|
13
|
+
# from your application log (in this case, all fields with names like "password").
|
14
|
+
# filter_parameter_logging :password
|
10
15
|
end
|
data/html/images/rails.png
CHANGED
Binary file
|
data/html/index.html
CHANGED
@@ -219,10 +219,7 @@
|
|
219
219
|
<ul class="links">
|
220
220
|
<li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
|
221
221
|
<li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
|
222
|
-
<li><a href="http://lists.rubyonrails.org/">Mailing lists</a></li>
|
223
|
-
<li><a href="http://wiki.rubyonrails.org/rails/pages/IRC">IRC channel</a></li>
|
224
222
|
<li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
|
225
|
-
<li><a href="http://dev.rubyonrails.org/">Bug tracker</a></li>
|
226
223
|
</ul>
|
227
224
|
</li>
|
228
225
|
|
@@ -252,12 +249,7 @@
|
|
252
249
|
<h1>Getting started</h1>
|
253
250
|
<h2>Here’s how to get rolling:</h2>
|
254
251
|
|
255
|
-
<ol>
|
256
|
-
<li>
|
257
|
-
<h2>Create your databases and edit <tt>config/database.yml</tt></h2>
|
258
|
-
<p>Rails needs to know your login and password.</p>
|
259
|
-
</li>
|
260
|
-
|
252
|
+
<ol>
|
261
253
|
<li>
|
262
254
|
<h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
|
263
255
|
<p>To see all available options, run it without parameters.</p>
|
@@ -267,6 +259,11 @@
|
|
267
259
|
<h2>Set up a default route and remove or rename this file</h2>
|
268
260
|
<p>Routes are set up in config/routes.rb.</p>
|
269
261
|
</li>
|
262
|
+
|
263
|
+
<li>
|
264
|
+
<h2>Create your database</h2>
|
265
|
+
<p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
|
266
|
+
</li>
|
270
267
|
</ol>
|
271
268
|
</div>
|
272
269
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) 2005-
|
1
|
+
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
2
|
// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
3
3
|
// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
|
4
4
|
// Contributors:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) 2005-
|
1
|
+
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
2
|
// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
|
3
3
|
//
|
4
4
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
data/html/javascripts/effects.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) 2005-
|
1
|
+
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
2
2
|
// Contributors:
|
3
3
|
// Justin Palmer (http://encytemedia.com/)
|
4
4
|
// Mark Pilgrim (http://diveintomark.org/)
|
data/lib/commands/console.rb
CHANGED
@@ -24,9 +24,9 @@ ENV['RAILS_ENV'] = case ARGV.first
|
|
24
24
|
end
|
25
25
|
|
26
26
|
if options[:sandbox]
|
27
|
-
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails
|
27
|
+
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails.version})"
|
28
28
|
puts "Any modifications you make will be rolled back on exit"
|
29
29
|
else
|
30
|
-
puts "Loading #{ENV['RAILS_ENV']} environment (Rails #{Rails
|
30
|
+
puts "Loading #{ENV['RAILS_ENV']} environment (Rails #{Rails.version})"
|
31
31
|
end
|
32
32
|
exec "#{options[:irb]} #{libs} --simple-prompt"
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yaml'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
include_password = false
|
6
|
+
|
7
|
+
OptionParser.new do |opt|
|
8
|
+
opt.banner = "Usage: dbconsole [options] [environment]"
|
9
|
+
opt.on("-p", "--include-password", "Automatically provide the database from database.yml") do |v|
|
10
|
+
include_password = true
|
11
|
+
end
|
12
|
+
opt.parse!(ARGV)
|
13
|
+
abort opt.to_s unless (0..1).include?(ARGV.size)
|
14
|
+
end
|
15
|
+
|
16
|
+
env = ARGV.first || ENV['RAILS_ENV'] || 'development'
|
17
|
+
unless config = YAML::load(ERB.new(IO.read(RAILS_ROOT + "/config/database.yml")).result)[env]
|
18
|
+
abort "No database is configured for the environment '#{env}'"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def find_cmd(*commands)
|
23
|
+
dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
|
24
|
+
commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/
|
25
|
+
commands.detect do |cmd|
|
26
|
+
dirs_on_path.detect do |path|
|
27
|
+
File.executable? File.join(path, cmd)
|
28
|
+
end
|
29
|
+
end || abort("Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.")
|
30
|
+
end
|
31
|
+
|
32
|
+
case config["adapter"]
|
33
|
+
when "mysql"
|
34
|
+
args = {
|
35
|
+
'host' => '--host',
|
36
|
+
'port' => '--port',
|
37
|
+
'socket' => '--socket',
|
38
|
+
'username' => '--user',
|
39
|
+
'encoding' => '--default-character-set'
|
40
|
+
}.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
|
41
|
+
|
42
|
+
if config['password'] && include_password
|
43
|
+
args << "--password=#{config['password']}"
|
44
|
+
end
|
45
|
+
|
46
|
+
args << config['database']
|
47
|
+
|
48
|
+
exec(find_cmd('mysql5', 'mysql'), *args)
|
49
|
+
|
50
|
+
when "postgresql"
|
51
|
+
ENV['PGUSER'] = config["username"] if config["username"]
|
52
|
+
ENV['PGHOST'] = config["host"] if config["host"]
|
53
|
+
ENV['PGPORT'] = config["port"].to_s if config["port"]
|
54
|
+
ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password
|
55
|
+
exec(find_cmd('psql'), config["database"])
|
56
|
+
|
57
|
+
when "sqlite"
|
58
|
+
exec(find_cmd('sqlite'), config["database"])
|
59
|
+
|
60
|
+
when "sqlite3"
|
61
|
+
exec(find_cmd('sqlite3'), config["database"])
|
62
|
+
|
63
|
+
else
|
64
|
+
abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!"
|
65
|
+
end
|
data/lib/commands/generate.rb
CHANGED
File without changes
|
File without changes
|
data/lib/commands/plugin.rb
CHANGED
@@ -162,6 +162,10 @@ class Plugin
|
|
162
162
|
@uri =~ /svn(?:\+ssh)?:\/\/*/
|
163
163
|
end
|
164
164
|
|
165
|
+
def git_url?
|
166
|
+
@uri =~ /^git:\/\// || @uri =~ /\.git$/
|
167
|
+
end
|
168
|
+
|
165
169
|
def installed?
|
166
170
|
File.directory?("#{rails_env.root}/vendor/plugins/#{name}") \
|
167
171
|
or rails_env.externals.detect{ |name, repo| self.uri == repo }
|
@@ -169,7 +173,10 @@ class Plugin
|
|
169
173
|
|
170
174
|
def install(method=nil, options = {})
|
171
175
|
method ||= rails_env.best_install_method?
|
172
|
-
|
176
|
+
if :http == method
|
177
|
+
method = :export if svn_url?
|
178
|
+
method = :clone if git_url?
|
179
|
+
end
|
173
180
|
|
174
181
|
uninstall if installed? and options[:force]
|
175
182
|
|
@@ -247,6 +254,10 @@ class Plugin
|
|
247
254
|
fetcher.fetch
|
248
255
|
end
|
249
256
|
end
|
257
|
+
|
258
|
+
def install_using_clone(options = {})
|
259
|
+
git_command :clone, options
|
260
|
+
end
|
250
261
|
|
251
262
|
def svn_command(cmd, options = {})
|
252
263
|
root = rails_env.root
|
@@ -257,12 +268,23 @@ class Plugin
|
|
257
268
|
puts base_cmd if $verbose
|
258
269
|
system(base_cmd)
|
259
270
|
end
|
271
|
+
|
272
|
+
def git_command(cmd, options = {})
|
273
|
+
root = rails_env.root
|
274
|
+
mkdir_p "#{root}/vendor/plugins"
|
275
|
+
base_cmd = "git #{cmd} --depth 1 #{uri} \"#{root}/vendor/plugins/#{name}\""
|
276
|
+
puts base_cmd if $verbose
|
277
|
+
puts "removing: #{root}/vendor/plugins/#{name}/.git"
|
278
|
+
system(base_cmd)
|
279
|
+
rm_rf "#{root}/vendor/plugins/#{name}/.git"
|
280
|
+
end
|
260
281
|
|
261
282
|
def guess_name(url)
|
262
283
|
@name = File.basename(url)
|
263
284
|
if @name == 'trunk' || @name.empty?
|
264
285
|
@name = File.basename(File.dirname(url))
|
265
286
|
end
|
287
|
+
@name.gsub!(/\.git$/, '') if @name =~ /\.git$/
|
266
288
|
end
|
267
289
|
|
268
290
|
def rails_env
|
@@ -447,6 +469,8 @@ module Commands
|
|
447
469
|
o.separator " #{@script_name} install continuous_builder\n"
|
448
470
|
o.separator " Install a plugin from a subversion URL:"
|
449
471
|
o.separator " #{@script_name} install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder\n"
|
472
|
+
o.separator " Install a plugin from a git URL:"
|
473
|
+
o.separator " #{@script_name} install git://github.com/SomeGuy/my_awesome_plugin.git\n"
|
450
474
|
o.separator " Install a plugin and add a svn:externals entry to vendor/plugins"
|
451
475
|
o.separator " #{@script_name} install -x continuous_builder\n"
|
452
476
|
o.separator " List all available plugins:"
|
@@ -725,6 +749,9 @@ module Commands
|
|
725
749
|
o.on( "-o", "--checkout",
|
726
750
|
"Use svn checkout to grab the plugin.",
|
727
751
|
"Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
|
752
|
+
o.on( "-e", "--export",
|
753
|
+
"Use svn export to grab the plugin.",
|
754
|
+
"Exports the plugin, allowing you to check it into your local repository. Does not enable updates, or add an svn:externals entry.") { |v| @method = :export }
|
728
755
|
o.on( "-q", "--quiet",
|
729
756
|
"Suppresses the output from installation.",
|
730
757
|
"Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
|
data/lib/commands/server.rb
CHANGED
@@ -14,7 +14,7 @@ rescue Exception
|
|
14
14
|
end
|
15
15
|
|
16
16
|
server = case ARGV.first
|
17
|
-
when "lighttpd", "mongrel", "webrick"
|
17
|
+
when "lighttpd", "mongrel", "new_mongrel", "webrick"
|
18
18
|
ARGV.shift
|
19
19
|
else
|
20
20
|
if defined?(Mongrel)
|
@@ -31,7 +31,7 @@ case server
|
|
31
31
|
puts "=> Booting WEBrick..."
|
32
32
|
when "lighttpd"
|
33
33
|
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
34
|
-
when "mongrel"
|
34
|
+
when "mongrel", "new_mongrel"
|
35
35
|
puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
|
36
36
|
end
|
37
37
|
|
@@ -62,7 +62,7 @@ config = IO.read(config_file)
|
|
62
62
|
default_port, default_ip = 3000, '0.0.0.0'
|
63
63
|
port = config.scan(/^\s*server.port\s*=\s*(\d+)/).first rescue default_port
|
64
64
|
ip = config.scan(/^\s*server.bind\s*=\s*"([^"]+)"/).first rescue default_ip
|
65
|
-
puts "=> Rails application starting on http://#{ip || default_ip}:#{port || default_port}"
|
65
|
+
puts "=> Rails #{Rails.version} application starting on http://#{ip || default_ip}:#{port || default_port}"
|
66
66
|
|
67
67
|
tail_thread = nil
|
68
68
|
|
@@ -32,12 +32,12 @@ ARGV.clone.options do |opts|
|
|
32
32
|
opts.parse!
|
33
33
|
end
|
34
34
|
|
35
|
-
puts "=> Rails application starting on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
35
|
+
puts "=> Rails #{Rails.version} application starting on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
36
36
|
|
37
|
-
parameters = [
|
38
|
-
"start",
|
39
|
-
"-p", OPTIONS[:port].to_s,
|
40
|
-
"-a", OPTIONS[:ip].to_s,
|
37
|
+
parameters = [
|
38
|
+
"start",
|
39
|
+
"-p", OPTIONS[:port].to_s,
|
40
|
+
"-a", OPTIONS[:ip].to_s,
|
41
41
|
"-e", OPTIONS[:environment],
|
42
42
|
"-P", "#{RAILS_ROOT}/tmp/pids/mongrel.pid"
|
43
43
|
]
|
@@ -50,12 +50,12 @@ else
|
|
50
50
|
|
51
51
|
start_debugger if OPTIONS[:debugger]
|
52
52
|
|
53
|
-
require 'initializer'
|
54
|
-
Rails::Initializer.run(:initialize_logger)
|
55
|
-
|
56
53
|
puts "=> Call with -d to detach"
|
57
54
|
puts "=> Ctrl-C to shutdown server"
|
58
|
-
|
55
|
+
|
56
|
+
log = Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath
|
57
|
+
open(log, (File::WRONLY | File::APPEND | File::CREAT)) unless File.exist? log
|
58
|
+
tail_thread = tail(log)
|
59
59
|
|
60
60
|
trap(:INT) { exit }
|
61
61
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
unless defined?(Mongrel)
|
2
|
+
abort "PROBLEM: Mongrel is not available on your system (or not in your path)"
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'rails/mongrel_server/commands'
|
6
|
+
|
7
|
+
GemPlugin::Manager.instance.load "rails::mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
|
8
|
+
|
9
|
+
case ARGV[0] ||= 'start'
|
10
|
+
when 'start', 'stop', 'restart'
|
11
|
+
ARGV[0] = "rails::mongrelserver::#{ARGV[0]}"
|
12
|
+
end
|
13
|
+
|
14
|
+
if not Mongrel::Command::Registry.instance.run ARGV
|
15
|
+
exit 1
|
16
|
+
end
|