windows10
在ruby官方网站上下载windows ruby的应用程序安装包 rubyinstaller
运行rubyinstaller-devkit-2.4.4-2-x64.exe应用程序进行安装
安装开发软件组件 :MSYS2 and MINGW development toolchain在安装组件对话框中输入选项3,回车后进行安装ruby开发组件
在ruby的安装目录下找到Interactive Ruby程序并打开Interactive Ruby默认安装路径:C:\Users\hxb\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Ruby 2.4.4-2-x64 with MSYS2
测试ruby语句irb(main):001:0> versionNameError: undefined local variable or method `version' for main:Object from (irb):1 from C:/Ruby24-x64/bin/irb.cmd:19:in `
查看ruby的版本C:\Users\hxb>ruby -vruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]
ruby默认的安装路径C:\Ruby24-x64\bin
测试gem安装是否成功在命令行输入gem -v可以看到版本号信息C:\Users\hxb>gem -v2.6.14.1
安装rails:C:\Users\hxb>gem install railsC:\Users\hxb>rails -vRails 5.2.1
使用rails创建rails web应用helloJackC:\Users\hxb>rails new helloJack create create README.md create Rakefile create .ruby-version create config.ru create .gitignore create Gemfile run git init from '.' create package.json...命令执行成功后,会在当前目录下创建helloJack目录以及相关的文件
启动rails web服务器C:\Users\hxb\helloJack\bin>rails server=> Booting Puma=> Rails 5.2.1 application starting in G:\ruby-2.4.4=> Run `rails server -h` for more startup optionsconfig.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: * development - set it to false * test - set it to false (unless you use a tool that preloads your test environment) * production - set it to trueRails Error: Unable to access log file. Please ensure that C:/Users/hxb/helloJack/log/G:/ruby-2.4.4.log exists and is writable (ie, make it writable for user and group: chmod 0664 C:/Users/hxb/helloJack/log/G:/ruby-2.4.4.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.*** SIGUSR2 not implemented, signal based restart unavailable!*** SIGUSR1 not implemented, signal based restart unavailable!*** SIGHUP not implemented, signal based logs reopening unavailable!Puma starting in single mode...* Version 3.12.0 (ruby 2.4.4-p296), codename: Llamas in Pajamas* Min threads: 5, max threads: 5* Environment: G:\ruby-2.4.4* Listening on tcp://0.0.0.0:3000
在浏览器中输入:http://localhost:3000 就可以看到页面了