ruby on rails 搭建

一、安装ruby
说明:安装的过程中,一直next,不做任何其他选择

rubyinstaller-2.0.0-p643.exe

 

版本验证:出现下面的界面表示成功

E:>ruby -v
ruby 2.0.0p643 (2015-02-25) [i386-mingw32]

恭喜您,ruby安装成功

 

二、安装ralis

从下面路径

ruby on rails 搭建

1、安装gem

进入一个工程目录

ellow.png, skipping
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/vijay
dev.jpg, skipping
Installing ri documentation for rails-4.2.1
1 gem installed

>gem install rails

》》》》》》》》》》》》》》》》》执行报错
Installing ri documentation for actionpack-4.2.1
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - ./ActionDispatch/Routing/Mapper/Scoping/:

》》》》》》》》》》》》》》》》》》》》》》》》

E:\bjservice>gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org/

E:\bjservice>gem sources -r
ERROR:  While executing gem ... (OptionParser::MissingArgument)
    missing argument: -r

E:\bjservice>gem   sources -r https://rubygems.org/
source https://rubygems.org/ not present in cache

E:\bjservice>gem   sources -a https://ruby.taobao.org/
source https://ruby.taobao.org/ already present in the cache

E:\bjservice>gem   install rails
>>》》》》》》》》》》》》》》》》》 提示下面信息标识成功
ellow.png, skipping
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/vijay
dev.jpg, skipping
Installing ri documentation for rails-4.2.1
1 gem installed

》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

E:\bjservice>bundle   install
DL is deprecated, please use Fiddle
Fetching source index from http://ruby.taobao.org/
Installing rake 10.2.2
Installing i18n 0.6.9
Installing minitest 4.7.5
Installing multi_json 1.9.2

Gem::InstallError: The 'atomic' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing atomic (1.1.16), and Bundler cannot continue.

Make sure that `gem install atomic -v '1.1.16'` succeeds before bundling.

E:\bjservice>gem install atomic -v '1.1.16'
ERROR:  Error installing atomic:
        The 'atomic' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

E:\bjservice>

》》》》》》》》》》提示错误安装devkit》》》》》》

进入安目录

C:\>cd devkit

C:\devkit>ruby   dk.rb init
[INFO] found RubyInstaller v2.0.0 at C:/Ruby200

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\devkit>ruby   dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby200'
[INFO] Installing 'C:/Ruby200/lib/ruby/site_ruby/devkit.rb'

C:\devkit>

》》》》》》工程目录再次执行

E:\bjservice>bundle   install

 

E:\bjservice>gem install mysql2 -v'0.3.15' -- -- with-mysql-lib="C:\mysql-5.6.23
-win32\lib" --with-mysql-include="C:\mysql-5.6.23-win32\include"

Temporarily enhancing PATH to include DevKit...
Building native extensions with: '-- with-mysql-lib=C:\mysql-5.6.23-win32\lib --
with-mysql-include=C:\mysql-5.6.23-win32\include'
This could take a while...
Successfully installed mysql2-0.3.15
Parsing documentation for mysql2-0.3.15
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skip
ping
Installing ri documentation for mysql2-0.3.15
1 gem installed

E:\bjservice>

E:\bjservice>bundle   install

Installing ruby-ole 1.2.11.7
Installing sass-rails 4.0.2
Installing sdoc 0.4.0
Installing spreadsheet 0.9.7
Installing turbolinks 2.2.1
Installing uglifier 2.5.0
Bundle complete! 20 Gemfile dependencies, 66 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

E:\bjservice>

E:\bjservice>rails   -v
Rails 4.0.4

E:\bjservice>

 

一切安装就绪,准备运行
安装过程很顺利,暗自庆幸。。。

第一次运行,出LoadError:

C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require
‘: 126: 找不到指定的模块。 – C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13/lib/mysql2/mysql2.so (LoadError)
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:4
5:in `require’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2.rb
:8:in `’
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:1
10:in `require’
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:1
10:in `rescue in require’
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:3
5:in `require’
from download.rb:6:in `’
 到目录

C:\mysql-5.6.23-win32\lib下面拷贝libmysql.dll到C:\Ruby200\bin下面,再次执行mysql安装

E:\bjservice>gem install mysql2 -v'0.3.15' -- -- with-mysql-lib="C:\mysql-5.6.23
-win32\lib" --with-mysql-include="C:\mysql-5.6.23-win32\include"

一起OK运行成功提示信息

"F:\soft\RubyMine 7.1.1\bin\runnerw.exe" C:\Ruby200\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) E:/bjservice/bin/rails server -b 127.0.0.1 -p 3000 -e development
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on
http://127.0.0.1:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-05-13 10:36:55] INFO  WEBrick 1.3.1
[2015-05-13 10:36:55] INFO  ruby 2.0.0 (2015-02-25) [i386-mingw32]
[2015-05-13 10:36:55] INFO  WEBrick::HTTPServer#start: pid=12800 port=3000

 

你可能感兴趣的:(ruby on rails 搭建)