繁体   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