简体   繁体   中英

ruby on rails configuration

Im using the following guide for getting started with rails for ubuntu 9.10. http://guides.rails.info/getting_started.html

I have installed both ruby and gem.


gokul@gokul-laptop:~$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] gokul@gokul-laptop:~$ gem -v 1.3.6 gokul@gokul-laptop:~$


For rails,


gokul@gokul-laptop:~$sudo gem install rails


doesnt seem to give any response. so used the synaptic package manager for installing it. And it seems to have installed correctly.


gokul@gokul-laptop:~$ rails Usage: /usr/bin/rails /path/to/your/app [options]

Options: -r, --ruby=path Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).

                                 Default: /usr/bin/ruby1.8
-d, --database=name              Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3/frontbase/ibm_db).
                                 Default: sqlite3
-D, --with-dispatchers           Add CGI/FastCGI/mod_ruby dispatches code to generated application skeleton
                                 Default: false
    --freeze                     Freeze Rails in vendor/rails from the gems generating the skeleton
                                 Default: false
-m, --template=path              Use an application template that lives at path (can be a filesystem path or URL).
                                 Default: (none)

Rails Info:

-v, --version                    Show the Rails version number and quit.
-h, --help                       Show this help message and quit.

General Options:

-p, --pretend                    Run but do not make any changes.
-f, --force                      Overwrite files that already exist.
-s, --skip                       Skip files that already exist.
-q, --quiet                      Suppress normal output.
-t, --backtrace                  Debugging: show backtrace on errors.
-c, --svn                        Modify files with subversion. (Note: svn must be in path)
-g, --git                        Modify files with git. (Note: git must be in path)

Description: The 'rails' command creates a new Rails application with a default directory structure and configuration at the path you specify.

Example: rails ~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.

gokul@gokul-laptop:~$


app folder is created with all the proper folders. The problem starts with the following commands...


gokul@gokul-laptop:~$ sudo gem install bundler

[sudo] password for gokul:

Successfully installed bundler-0.9.24

1 gem installed

Installing ri documentation for bundler-0.9.24...

Installing RDoc documentation for bundler-0.9.24...

gokul@gokul-laptop:~$ bundle install

Could not locate Gemfile

gokul@gokul-laptop:~$


coming to the database, the default sqlite3 seems to have installed correctly.


gokul@gokul-laptop:~$ sqlite3

SQLite version 3.6.16

Enter ".help" for instructions

Enter SQL statements terminated with a ";"

sqlite>


The welcome aboard page is not being able to be found at ( http://localhost:3000 ) after executing the following commands...


gokul@gokul-laptop:~/Desktop$ rails blog

  create 
  create  app/controllers
  create  app/helpers
  create  app/models
  create  app/views/layouts
  create  config/environments
  create  config/initializers
  create  config/locales
  create  db
  create  doc
  create  lib
  create  lib/tasks
  create  log
  create  public/images
  create  public/javascripts
  create  public/stylesheets
  create  script/performance
  create  test/fixtures
  create  test/functional
  create  test/integration
  create  test/performance
  create  test/unit
  create  vendor
  create  vendor/plugins
  create  tmp/sessions
  create  tmp/sockets
  create  tmp/cache
  create  tmp/pids
  create  Rakefile
  create  README
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  config/database.yml
  create  config/routes.rb
  create  config/locales/en.yml
  create  db/seeds.rb
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/new_rails_defaults.rb
  create  config/initializers/session_store.rb
  create  config/environment.rb
  create  config/boot.rb
  create  config/environments/production.rb
  create  config/environments/development.rb
  create  config/environments/test.rb
  create  script/about
  create  script/console
  create  script/dbconsole
  create  script/destroy
  create  script/generate
  create  script/runner
  create  script/server
  create  script/plugin
  create  script/performance/benchmarker
  create  script/performance/profiler
  create  test/test_helper.rb
  create  test/performance/browsing_test.rb
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/index.html
  create  public/favicon.ico
  create  public/robots.txt
  create  public/images/rails.png
  create  public/javascripts/prototype.js
  create  public/javascripts/effects.js
  create  public/javascripts/dragdrop.js
  create  public/javascripts/controls.js
  create  public/javascripts/application.js
  create  doc/README_FOR_APP
  create  log/server.log
  create  log/production.log
  create  log/development.log
  create  log/test.log

gokul@gokul-laptop:~/Desktop$ cd blog

gokul@gokul-laptop:~/Desktop/blog$ rake db:create

(in /home/gokul/Desktop/blog)

gokul@gokul-laptop:~/Desktop/blog$ rails server

  create 
  create  app/controllers
  create  app/helpers
  create  app/models
  create  app/views/layouts
  create  config/environments
  create  config/initializers
  create  config/locales
  create  db
  create  doc
  create  lib
  create  lib/tasks
  create  log
  create  public/images
  create  public/javascripts
  create  public/stylesheets
  create  script/performance
  create  test/fixtures
  create  test/functional
  create  test/integration
  create  test/performance
  create  test/unit
  create  vendor
  create  vendor/plugins
  create  tmp/sessions
  create  tmp/sockets
  create  tmp/cache
  create  tmp/pids
  create  Rakefile
  create  README
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  config/database.yml
  create  config/routes.rb
  create  config/locales/en.yml
  create  db/seeds.rb
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/new_rails_defaults.rb
  create  config/initializers/session_store.rb
  create  config/environment.rb
  create  config/boot.rb
  create  config/environments/production.rb
  create  config/environments/development.rb
  create  config/environments/test.rb
  create  script/about
  create  script/console
  create  script/dbconsole
  create  script/destroy
  create  script/generate
  create  script/runner
  create  script/server
  create  script/plugin
  create  script/performance/benchmarker
  create  script/performance/profiler
  create  test/test_helper.rb
  create  test/performance/browsing_test.rb
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/index.html
  create  public/favicon.ico
  create  public/robots.txt
  create  public/images/rails.png
  create  public/javascripts/prototype.js
  create  public/javascripts/effects.js
  create  public/javascripts/dragdrop.js
  create  public/javascripts/controls.js
  create  public/javascripts/application.js
  create  doc/README_FOR_APP
  create  log/server.log
  create  log/production.log
  create  log/development.log
  create  log/test.log

gokul@gokul-laptop:~/Desktop/blog$


hope some one can help me with this...

To run server type:

./script/server

Don't:

rails server

rails creates new Rails project in current directory.

If you want to get started with a stable version of Rails on Ubuntu 9.10 I'd suggest:

Remove any gems installed via apt, aptitude or synaptic and check that rubygems is at least at Version 1.3.5.

 gem -v
 sudo gem install sqlite3-ruby rails # will install Rails 2.3.5 = latest stable release
 rails app
 cd app
 rake db:create
 script/server

If you want to learn Rails 3 (currently beta3)

Remove the RUBYGEMS package installed via apt, aptitude or synaptic and install RubyGems 1.3.6 manually.

wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz
tar xfz rubygems*tgz
cd rubygems-*
sudo ruby setup.rb && cd ..
gem -v
# if gem command fails
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

sudo gem install sqlite3-ruby bundler rails -pre
# will install Rails 3.0.0beta3
rails app
cd app
bundle install
rake db:create
rails server

After you install bundler and generate rails application you need to cd into rails app before launching

bundle install

Steps are:

gem install bundler
rails blog
cd blog
bundle install

If u still got the problem...just try this bundle init . This will create the GemFile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM