簡體   English   中英

Ruby on Rails配置

[英]ruby on rails configuration

我使用以下指南開始使用ubuntu 9.10的導軌。 http://guides.rails.info/getting_started.html

我已經安裝了紅寶石和寶石。


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:〜 $


對於導軌,


gokul @ gokul-laptop:〜$ sudo gem安裝導軌


似乎沒有給出任何回應。 因此使用了突觸軟件包管理器進行安裝。 而且它似乎已正確安裝。


gokul @ gokul-laptop:〜$ rails用法:/ usr / bin / rails / path / to / your / app [options]

選項:-r,--ruby = path所選Ruby二進制文件的路徑(否則腳本使用env,調度程序為當前路徑)。

                                 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信息:

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

常規選項:

-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)

描述:“ rails”命令創建一個新的Rails應用程序,該應用程序在您指定的路徑上具有默認目錄結構和配置。

示例: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.

戈庫爾@戈庫爾-筆記本電腦:〜$


app文件夾是使用所有正確的文件夾創建的。 問題開始於以下命令...


gokul @ gokul-laptop:〜$ sudo gem安裝捆綁器

[sudo] gokul的密碼:

成功安裝bundler-0.9.24

安裝1個寶石

正在安裝Bundle-0.9.24的ri文檔...

正在安裝Bundle-0.9.24的RDoc文檔...

gokul @ gokul-laptop:〜$捆綁安裝

找不到Gemfile

戈庫爾@戈庫爾-筆記本電腦:〜$


進入數據庫時​​,默認的sqlite3似乎已正確安裝。


gokul @ gokul-laptop:〜$ sqlite3

SQLite版本3.6.16

輸入“ .help”以獲取說明

輸入以“;”結尾的SQL語句

sqlite的>


執行以下命令后,無法在( http:// localhost:3000上找到歡迎登機頁面 ...


gokul @ gokul-laptop:〜/ Desktop $ rails博客

  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博客

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

(在/ home / gokul / Desktop / blog中)

gokul @ gokul-laptop:〜/ Desktop / blog $ rails服務器

  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

戈庫爾@戈庫爾-筆記本:〜/桌面/博客$


希望有人可以幫助我...

要運行服務器,請輸入:

./script/server

別:

rails server

rails在當前目錄中創建新的Rails項目。

如果您想在Ubuntu 9.10上開始使用穩定版本的Rails,我建議:

刪除通過apt,aptitude或synaptic安裝的所有寶石,並檢查rubygems至少在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

如果您想學習Rails 3(當前為beta3)

刪除通過apt,aptitude或synaptic安裝的RUBYGEMS軟件包,並手動安裝RubyGems 1.3.6。

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

安裝捆綁器並生成Rails應用程序后,需要在啟動前將CD插入Rails應用程序

bundle install

步驟如下:

gem install bundler
rails blog
cd blog
bundle install

如果您仍然遇到問題...請嘗試使用這個bundle init。 這將創建GemFile。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM