Permalink
Browse files

Final steps toward clean rails "foo"; cd foo; gem bundle; script/serv…

…er working
  • Loading branch information...
1 parent 4403dfa commit 520b8b59110dd130c89b317b6bd65d8644c7836f Yehuda Katz + Carl Lerche committed Nov 19, 2009
@@ -3,11 +3,6 @@ class Application
include Initializable
class << self
- def inherited(klass)
- Rails.application ||= klass unless klass.name =~ /Rails/
- super
- end
-
# Stub out App initialize
def initialize!
new
@@ -38,6 +33,7 @@ def call(env)
end
def initialize
+ Rails.application ||= self
run_initializers(self)
end
@@ -3,11 +3,13 @@
require 'fileutils'
require 'optparse'
+# Waiting for Rack::Server patch
+
options = {
:Port => 3000,
:Host => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
- :config => "#{Rails.root}/config.ru",
+ :config => $config_ru,
:detach => false,
:debugger => false
}
@@ -50,7 +50,7 @@ def create_root
def create_root_files
copy_file "Rakefile"
copy_file "README"
- copy_file "config.ru"
+ template "config.ru"
template "Gemfile"
end
@@ -2,4 +2,4 @@
require ::File.expand_path('../config/environment', __FILE__)
# Dispatch the request
-run Rails.application
+run <%= app_name.classify %>
@@ -1,6 +1,6 @@
require File.expand_path('../boot', __FILE__)
-Rails::Initializer.run do |config|
+class <%= app_name.classify %> < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the rails application
-Rails.initialize!
+<%= app_name.classify %>.initialize!
@@ -1,2 +1,5 @@
require File.expand_path('../../config/application', __FILE__)
+# Temporary patch until Rack::Server
+# Will be Rails::Server.start(File.expand_path("../../config.ru", __FILE__))
+$config_ru = File.expand_path("../../config.ru", __FILE__)
require 'rails/commands/server'
@@ -1,12 +1,11 @@
module Rails
module Rack
class LogTailer
- EnvironmentLog = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log"
-
def initialize(app, log = nil)
+ @default_log = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log"
@app = app
- path = Pathname.new(log || EnvironmentLog).cleanpath
+ path = Pathname.new(log || @default_log).cleanpath
@cursor = ::File.size(path)
@last_checked = Time.now.to_f

1 comment on commit 520b8b5

@rubys
Contributor
rubys commented on 520b8b5 Nov 19, 2009

This commit breaks all rake tasks

$ rake routes --trace
(in /home/rubys/git/awdwr/work/depot)
** Invoke routes (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
can't convert nil into String
/home/rubys/git/awdwr/work/depot/vendor/rails/railties/lib/rails/tasks/misc.rake:4:in join' /home/rubys/git/awdwr/work/depot/vendor/rails/railties/lib/rails/tasks/misc.rake:4 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Please sign in to comment.