Ruby Rails web Development environment--windows

Source: Internet
Author: User
Tags windows 7 x64 ruby on rails



Ruby on Rails is a framework that makes it easy for you to develop, deploy, and maintain Web applications. October 2015 programming language leaderboard Ruby entered the top 10 of the Tiobe leaderboard, which shows how popular it is. This article will help you open the door to Ruby on Rails web development and help you get to the world of Ruby on rails and enjoy a different view.


Ruby on Rails Full installation package


: http://railsinstaller.org/en






Want to quickly build a development environment of friends can try this, I have not tried;



I use the following installation process, the middle encountered a lot of problems, the process is more lengthy and tortuous!


Ruby


Ruby, a scripting language created for simple and fast object-oriented programming (object-oriented program design), was developed by the Japanese as (Yukihiro Matsumoto) in the 1990s, adhering to the GPL protocol and Ruby License. Its inspirations and features are derived from Perl, Smalltalk, Eiffel, Ada, and Lisp languages. The Ruby language itself also developed a Ruby language alternative to other platforms such as JRuby (Java platform), IronRuby (. NET platform). Ruby's author began writing Ruby on February 24, 1993, until December 1995, when it was officially released in FJ (News Group). Because Perl is pronounced the same as the June Birthstone Pearl (Pearl), Ruby is named after the Birthstone Ruby (Ruby) of July.


Download Rubyinstaller


: http://rubyinstaller.org/









Depending on your operating system environment Select version, my is Windows 7 x64, so I choose 64 bit.





Install Ruby


1. Compiling and installing Ruby from source code
Refer to http://www.javaeye.com/topic/148751.
2, install Ruby through Rubyinstaller, installation steps are as follows:


















After the installation is complete, run ruby-v to display the version number. If the ruby version number is displayed correctly, the installation is successful.





RubyGems


RubyGems (abbreviated as GEMS) is a ruby packaging system for packaging ruby components. It provides a standard format for distributing Ruby programs and libraries, as well as a tool for managing package installation.
The RubyGems function is similar to the Apt-get under Linux. Use it to easily download and install rails from a remote server.
Open command Line window (cmd), enter execute command gem install rails--remote or gem install rails--include-dependencies.



Note: After you install Ruby, RubyGems is installed by default, and you can view it with the following commands, such as:





Download RubyGems


https://rubygems.org/pages/download/





Installing RubyGems


1. Unzip the downloaded installation package into a directory;



2. Open the command line and switch to this directory;



3. Execute:Ruby setup.rb (this may require opening a command-line window as an administrator)


DevKit


After adding Devkit, your Ruby has a mingw32 local compilation environment, and this local compilation environment is automatically called. Devkit is only called when the gem you are installing needs to be compiled locally.



Http://rubyinstaller.org/add-ons/devkit



Download Devkit



Http://rubyinstaller.org/downloads



Installing Devkit



1, run, extract to a directory, for example: C:\DevKit



2. Open the command line and switch to this directory;



3. Execute command:Ruby DK.RB Init



4. Modify the Config.yml file





# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the ‘ruby dk.rb init‘ step and may be modified
# before running the ‘ruby dk.rb install‘ step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
- C:\Ruby22-x64
# - C:/ruby192dev
#
---

C:\Ruby22-x64 is my Ruby installation directory





5. Execute command:Ruby dk.rb Install




C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for ‘C:/Ruby22-x64‘
[INFO] Installing ‘C:/Ruby22-x64/lib/ruby/site_ruby/devkit.rb‘




Rails


The rails framework was first proposed in July 2004, and its developers were 26-year-old Danish David Heinemeier Hansson. Unlike the already complex web development framework, rails is a more realistic and efficient web development framework. Rails combines the advantages of the PHP system (rapid development) and the advantages of the Java System (program-structured), so rails has been widely watched in the industry for a long time.








Installing Rails


to install rails remotely, execute the command: Gem Install Rails



At this point, Windows Firewall may pop up security alerts and click Allow access:






There may be a network connection error during the period, so try again.






The installation process may be longer, depending on your computer performance, network speed;





Installing Sqlite3


Execute command: Gem install Sqlite3-ruby




C:\ruby>gem install sqlite3-ruby
Fetching: sqlite3-1.3.11-x64-mingw32.gem (100%)
Successfully installed sqlite3-1.3.11-x64-mingw32
Fetching: sqlite3-ruby-1.3.3.gem (100%)

#######################################################

Hello! The sqlite3-ruby gem has changed it‘s name to just sqlite3.  Rather than
installing `sqlite3-ruby`, you should install `sqlite3`.  Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3

#######################################################

Successfully installed sqlite3-ruby-1.3.3
Parsing documentation for sqlite3-1.3.11-x64-mingw32
Installing ri documentation for sqlite3-1.3.11-x64-mingw32
Parsing documentation for sqlite3-ruby-1.3.3
Installing ri documentation for sqlite3-ruby-1.3.3
Done installing documentation for sqlite3, sqlite3-ruby after 1 seconds
2 gems installed


Create a we

1, create the working directory;



such as: C:\ruby



2, open the command line, switch to the directory;



3. Execute command: Rails new Blog






After the command executes successfully, a blog directory is created under the C:\ruby directory, and the blog can be modified to the name of the app you want to create.



For more help on commanding rails new, execute the command view: Rails new-h


start the Web service


1, switch the command line to the application directory;



2. Execution: Rails server




Could not find Gem ' Sqlite3 (>= 0) X64-mingw32 ' in any of the gems sources listed in your gemfile or available on this m Achine. Run ' bundle install ' to install missing gems.
If Sqlite3 is not installed, this information will be prompted;






C:\ruby\blog>rails server
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-12-12 13:45:34] INFO  WEBrick 1.3.1
[2015-12-12 13:45:34] INFO  ruby 2.2.3 (2015-08-18) [x64-mingw32]
[2015-12-12 13:45:34] INFO  WEBrick::HTTPServer#start: pid=12948 port=3000
Open Browser access:





Seeing this page indicates that the configuration was successful.


Concluding remarks


This article references: http://blog.csdn.net/jason314/article/details/6204781



Bo Master wrote relatively fine, but a few years apart, some places have changed,



For example: After installing Ruby, RubyGems is installed by default, and the rails mentioned in this article are not available;



Other reference sites:



Http://guides.rubyonrails.org/getting_started.html



http://railsinstaller.org/en



Https://github.com/oneclick/rubyinstaller/wiki/Development-Kit



Http://rubyinstaller.org/downloads






Ruby Rails Web development environment under--windows for Ruby rails


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.