amritpal pathak
2010-Oct-24 13:20 UTC
Re: [Rails-core] Re: (Unable to start rails application) ruby scipt/server error
Rails application which i create manually like
rails new blog
and the content of the file "blog/config/boot.rb" are
require ''rubygems''
# Set up gems listed in the Gemfile.
gemfile = File.expand_path(''../../Gemfile'', __FILE__)
begin
ENV[''BUNDLE_GEMFILE''] = gemfile
require ''bundler''
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
Now cd blog
rails server is working well
and i can access the "localhost:3000" ,
but i have downloaded the source
code of site openstreetview (which is also rails application) in which the
content of file OpenStreetView/config/boot.rb
are like
# Don''t change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless
defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require ''initializer''
end
def load_rails_gem
if version = self.class.gem_version
gem ''rails'', version
else
gem ''rails''
end
rescue Gem::LoadError => load_error
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install
-v=#{version} rails`, update your RAILS_GEM_VERSION setting in
config/environment.rb for the Rails version you do have installed, or
comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?(''RAILS_GEM_VERSION'')
ENV[''RAILS_GEM_VERSION'']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
min_version = ''1.3.2''
require ''rubygems''
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you
have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please
install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
def parse_gem_version(text)
$1 if text =~
/^[^#]*RAILS_GEM_VERSION\s*=\s*["'']([!~<>=]*\s*[\d.]+)["'']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# All that for this:
Rails.boot!
Now cd OpenStreetView
rails server gives the
following error
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/local/bin/ruby
-d, [--database=DATABASE] # Preconfigure for selected database (options:
mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
# Default: sqlite3
-b, [--builder=BUILDER] # Path to an application builder (can be a
filesystem path or URL)
-m, [--template=TEMPLATE] # Path to an application template (can be a
filesystem path or URL)
[--dev] # Setup the application with Gemfile pointing
to your Rails checkout
[--edge] # Setup the application with Gemfile pointing
to Rails repository
[--skip-gemfile] # Don''t create a Gemfile
-O, [--skip-active-record] # Skip Active Record files
-T, [--skip-test-unit] # Skip Test::Unit files
-J, [--skip-prototype] # Skip Prototype files
-G, [--skip-git] # Skip Git ignores and keeps
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend] # Run but do not make any changes
-q, [--quiet] # Supress status output
-s, [--skip] # Skip files that already exist
Rails options:
-v, [--version] # Show Rails version number and quit
-h, [--help] # Show this help message and quit
Description:
The ''rails new'' command creates a new Rails application
with a default
directory structure and configuration at the path you specify.
Example:
rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
why this is happening even both are the
rails application .Please help me to run the server for openstreetview
Thanks for co-operation.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Luke Chadwick
2010-Oct-25 02:20 UTC
Re: Re: [Rails-core] Re: (Unable to start rails application) ruby scipt/server error
Hi Amritpal,
OpenStreetView is a Rails version 2.3.4 application. There are large
differences between Rails2 and Rails3 which is causing your problem. To
solve your problem do the following:
gem uninstall rails
gem install rails -v 2.3.4
cd OpenStreetView
ruby script/server
Let me know if you need any further help.
Regards,
Luke
On 25 October 2010 00:20, amritpal pathak
<amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Rails application which i create manually like
>
> rails new blog
>
> and the content of the file "blog/config/boot.rb" are
>
> require ''rubygems''
>
> # Set up gems listed in the Gemfile.
> gemfile = File.expand_path(''../../Gemfile'', __FILE__)
> begin
> ENV[''BUNDLE_GEMFILE''] = gemfile
> require ''bundler''
> Bundler.setup
> rescue Bundler::GemNotFound => e
> STDERR.puts e.message
> STDERR.puts "Try running `bundle install`."
> exit!
> end if File.exist?(gemfile)
>
>
> Now cd blog
> rails server is working well
> and i can access the "localhost:3000" ,
> but i have downloaded the source
> code of site openstreetview (which is also rails application) in which the
> content of file OpenStreetView/config/boot.rb
> are like
>
> # Don''t change this file!
> # Configure your app in config/environment.rb and config/environments/*.rb
>
> RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless
defined?(RAILS_ROOT)
>
> module Rails
> class << self
> def boot!
> unless booted?
> preinitialize
> pick_boot.run
> end
> end
>
> def booted?
> defined? Rails::Initializer
> end
>
> def pick_boot
> (vendor_rails? ? VendorBoot : GemBoot).new
> end
>
> def vendor_rails?
> File.exist?("#{RAILS_ROOT}/vendor/rails")
> end
>
> def preinitialize
> load(preinitializer_path) if File.exist?(preinitializer_path)
> end
>
> def preinitializer_path
> "#{RAILS_ROOT}/config/preinitializer.rb"
> end
> end
>
> class Boot
> def run
> load_initializer
> Rails::Initializer.run(:set_load_path)
> end
> end
>
> class VendorBoot < Boot
> def load_initializer
> require
"#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
> Rails::Initializer.run(:install_gem_spec_stubs)
> Rails::GemDependency.add_frozen_gem_path
> end
> end
>
> class GemBoot < Boot
> def load_initializer
> self.class.load_rubygems
> load_rails_gem
> require ''initializer''
> end
>
> def load_rails_gem
> if version = self.class.gem_version
> gem ''rails'', version
> else
> gem ''rails''
> end
> rescue Gem::LoadError => load_error
> $stderr.puts %(Missing the Rails #{version} gem. Please `gem install
> -v=#{version} rails`, update your RAILS_GEM_VERSION setting in
> config/environment.rb for the Rails version you do have installed, or
> comment out RAILS_GEM_VERSION to use the latest version installed.)
> exit 1
> end
>
> class << self
> def rubygems_version
> Gem::RubyGemsVersion rescue nil
> end
>
> def gem_version
> if defined? RAILS_GEM_VERSION
> RAILS_GEM_VERSION
> elsif ENV.include?(''RAILS_GEM_VERSION'')
> ENV[''RAILS_GEM_VERSION'']
> else
> parse_gem_version(read_environment_rb)
> end
> end
>
> def load_rubygems
> min_version = ''1.3.2''
> require ''rubygems''
> unless rubygems_version >= min_version
> $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you
> have #{rubygems_version}). Please `gem update --system` and try again.)
> exit 1
> end
>
> rescue LoadError
> $stderr.puts %Q(Rails requires RubyGems >= #{min_version}.
Please
> install RubyGems and try again: http://rubygems.rubyforge.org)
> exit 1
> end
>
> def parse_gem_version(text)
> $1 if text =~
>
/^[^#]*RAILS_GEM_VERSION\s*=\s*["'']([!~<>=]*\s*[\d.]+)["'']/
> end
>
> private
> def read_environment_rb
> File.read("#{RAILS_ROOT}/config/environment.rb")
> end
> end
> end
> end
>
> # All that for this:
> Rails.boot!
>
>
> Now cd OpenStreetView
> rails server gives the
> following error
>
>
>
> Usage:
> rails new APP_PATH [options]
>
> Options:
> -r, [--ruby=PATH] # Path to the Ruby binary of your choice
> # Default: /usr/local/bin/ruby
> -d, [--database=DATABASE] # Preconfigure for selected database
> (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
> # Default: sqlite3
> -b, [--builder=BUILDER] # Path to an application builder (can be a
> filesystem path or URL)
> -m, [--template=TEMPLATE] # Path to an application template (can be a
> filesystem path or URL)
> [--dev] # Setup the application with Gemfile pointing
> to your Rails checkout
> [--edge] # Setup the application with Gemfile pointing
> to Rails repository
> [--skip-gemfile] # Don''t create a Gemfile
> -O, [--skip-active-record] # Skip Active Record files
> -T, [--skip-test-unit] # Skip Test::Unit files
> -J, [--skip-prototype] # Skip Prototype files
> -G, [--skip-git] # Skip Git ignores and keeps
>
> Runtime options:
> -f, [--force] # Overwrite files that already exist
> -p, [--pretend] # Run but do not make any changes
> -q, [--quiet] # Supress status output
> -s, [--skip] # Skip files that already exist
>
> Rails options:
> -v, [--version] # Show Rails version number and quit
> -h, [--help] # Show this help message and quit
>
> Description:
> The ''rails new'' command creates a new Rails
application with a default
> directory structure and configuration at the path you specify.
>
> Example:
> rails new ~/Code/Ruby/weblog
>
> This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
> See the README in the newly created application to get going.
>
>
> why this is happening even both are
> the rails application .Please help me to run the server for openstreetview
>
>
> Thanks for co-operation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
email: luke.a.chadwick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
phone: +61402203606
twitter: @vertis
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.