Ruby on Rails win Installation

Source: Internet
Author: User
Ruby on Rails win Installation

I found the new technology Ruby on Rails. I will not talk about it any more. Let's talk about my installation process today!

First, download

Http://rubyforge.org/projects/rubyinstaller/

I got the latest! Then install it, just like installing other software.

Local installation is not learned, need to download

Gem

Http://rubyforge.org/frs? Group_id = 126

Also download a matching Apache, which uses apache2.

Http://www.neokeen.com/mornlee/= http://rubyforge.org/projects/rubyforapache"

This item also needs to be installed, mainly to generate something, useful is two so files, is used to load Apache, used to harden the language, although the speed is not good, stability is not good, but it is basically usable now. You can find a solution when you are actually working on the server, and modify httpd. conf [file, which is similar to PhP loading!

Add

Loadmodule fastcgi_module modules/mod_fastcgi.so
<Ifmodule mod_fastcgi.c>
Addhandler FastCGI-script. fcgi
</Ifmodule>

Note the location of the so file

Add more

Adddefacharcharset UTF-8
Loadmodule rewrite_module modules/mod_rewrite.so # Pay Attention to the location of the so file
<Virtualhost *: 80>
Servername 127.0.0.1
DocumentRoot D:/web/demo/public/
Errorlog D:/web/demo/log/Apache. Log

<Directory D:/web/demo/public/>
Options execcgi followsymlinks
Addhandler CGI-script. cgi
AllowOverride all
Order allow, deny
Allow from all

</Directory>
</Virtualhost>

Note d:/web is your virtual directory

Start a cmd

Enter the installed Ruby directory. The default value is C:/Ruby/bin.

Enter C:/Ruby/bin> ruby-V
Show Ruby 1.8.2 () [i386-mswin32]

Enter C:/Ruby/bin> gem update

In this step, you must pay attention to the proxy problem. If you cannot connect to the network, there will be an error message. It takes a long time for me to succeed. I have a proxy and I have used a proxy software to complete it, some other methods have been introduced. I have not succeeded in this experiment! The name of my agent software is sockscap.

A lot of items are displayed, which allows you to select the option to be updated. I chose 2.

Enter C:/Ruby/bin> gem install rails

All input y

Display

C:/Ruby/bin> gem install rails

C:/Ruby/bin> "C:/Ruby/bin/ruby.exe" "C:/Ruby/bin/gem" Install rails
Attempting local installation of 'rails'
Local gem file not found: rails *. Gem
Attempting Remote Installation of 'rails'
Install required dependency rake? [YN] y
Install required dependency activesupport? [YN] y
Install required dependency activerecord? [YN] y
Install required dependency actionpack? [YN] y
Install required dependency actionmailer? [YN] y
Install required dependency actionwebservice? [YN] y
Successfully installed rails-0.12.1
Successfully installed rake-0.5.4
Successfully installed activesupport-1.0.4
Successfully installed activerecord-1.10.1
Successfully installed actionpack-1.8.1
Successfully installed actionmailer-0.9.1
Successfully installed actionwebservice-0.7.1
Installing rdoc documentation for rake-0.5.4...
Installing rdoc documentation for activesupport-1.0.4...
Installing rdoc documentation for activerecord-1.10.1...
Installing rdoc documentation for actionpack-1.8.1...
Installing rdoc documentation for actionmailer-0.9.1...
Installing rdoc documentation for actionwebservice-0.7.1...

Basically, the environment is set up successfully!

Create a demo, that is, a test

Run the following statement in the directory c:/Ruby/bin:

Enter rails D:/web/demo to set the directory location, which must be consistent with Apache settings

Display

Create
Create APP/APIs
Create APP/Controllers
Create APP/helpers
Create APP/models
Create APP/views/layouts
Create config/Environments
Create Components
Create DB
Create Doc
Create lib
Create log
Create public/Images
Create public/javascripts
Create public/stylesheets
Create script
Create test/fixtures
Create test/functional
Create test/mocks/Development
Create test/mocks/test
Create test/Unit
Create vendor
Create rakefile
Create readme
Create changelog
Create APP/controllers/application. Rb
Create APP/helpers/application_helper.rb
Create test/test_helper.rb
Create config/database. yml
Create config/routes. Rb
Create public/. htaccess
Create config/environment. Rb
Create config/environments/production. Rb
Create config/environments/development. Rb
Create config/environments/test. Rb
Create script/console
Create script/lele_sandbox
Create script/destroy
Create script/generate
Create script/Server
Create script/runner
Create script/benchmarker
Create script/profiler
Create script/breakpointer
Create public/dispatch. Rb
Create public/dispatch. cgi
Create public/dispatch. fcgi
Create public/404.html
Create public/500.html
Create public/index.html
Create public/favicon. ICO
Create public/javascripts/prototype. js
Create DOC/readme_for_app
Create log/server. Log
Create log/production. Log
Create log/development. Log
Create log/test. Log

Modify related files in the demo application directory
Use the command line according to rails Conventions (in the current demo application directory)

Ruby-I. Bak-PE 'gsub! ("#! /Usr/local/bin/ruby ","#! C:/Ruby/bin/ruby ") 'Public/dispatch. * script /*

Change the file:

Public/dispatch. cgi, Public/dispatch. RB, Public/dispatch. fcgi, script/breakpointer, script/console, script/generate, script/Server

At the beginning of the file:

#! /Usr/local/bin/Ruby

Changed:

#! C:/Ruby/bin/Ruby
Make sure to modify the settings. Otherwise, FastCGI will fail.

Restart Apache and enter the local IP address.Http: // 127.0.0.1/

The page appears

Congratulations, you 've put Ruby on Rails!

Before you move on, Verify that the following conditions have been met:

  1. The log and public directories must be writable to the Web server (chmod -R 775 logAndchmod -R 775 public).
  2. The shebang line in the public/dispatch * files must reference your ruby installation.
    You might need to change it#!/usr/bin/env rubyOr point directly at the installation.
  3. Rails on Apache needs to have the CGI handler and mod_rewrite enabled.
    Somewhere in your httpd. conf, you shoshould have:
    AddHandler cgi-script .cgi
    LoadModule rewrite_module libexec/httpd/mod_rewrite.so
    AddModule mod_rewrite.c

Take the following steps to get started:

  1. Create empty development and test databases for your application.
    Recommendation: Use * _ development and * _ test names, such as basecamp_development and basecamp_test
    Warning: Don't point your test database at your development database, it'll destroy the latter on test runs!
  2. Edit config/database. yml with your database settings.
  3. Create controllers and models using the generator inscript/generate
    Help: run the generator with no arguments for documentation
  4. See all the tests run by runningrake.
  5. Develop your rails application!
  6. Setup ApacheFastCGI(AndRuby bindings), If you need better performance
  7. Remove the dispatches you don't use (so if you're on FastCGI, delete/move dispatch. RB, dispatch. cgi and gateway. cgi)

Trying to setup a default page for rails using routes? You'll have to delete this file (public/index.html) to get under way. Then define a new route inConfig/routes. RbOf the form:

  map.connect '', :controller => 'wiki/page', :action => 'show', :title => 'Welcome'

Having problems getting up and running? First try debugging it yourself by looking at the log files.
Then try the friendly rails communityOn the webOrOn IRC(Freenode # rubyonrails).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.