Welcome 微信登录

首页 / 操作系统 / Linux / Linux Mint 17下搭建Ruby环境

Linux Mint 17下搭建Ruby环境一.环境搭建安装curlsudo apt-get install curl安装RVM(Ruby Version Manager)curl -sSL https://get.rvm.io | bash -s stable安装rubyrvm install ruby-1.9.3-p545安装bundlergem install bundler(若要卸载用gem安装的app,则先gem list,然后gem uninstall app_name)现在去github上下载一个项目git clone git@github.com:abruzzi/letusgo-server.git进入文件夹cd letusgo-server更新项目依赖(必须有Gemfile.lock文件,bundle install类似于nodejs的npm install)bundle install至此,ruby环境就搭建好了(ps:该项目是的框架用的是Sinatra)。二,应用程序进入letusgo-server文件夹里,执行./setup.sh不出意外则会看到:==  CreateProducts: migrating =================================================
-- create_table(:products)
 -> 0.0009s
==  CreateProducts: migrated (0.0010s) ========================================然后执行 shotgun此时服务器则会开启:== Shotgun/WEBrick on http://127.0.0.1:9393/
[2014-11-23 20:20:41] INFO  WEBrick 1.3.1
[2014-11-23 20:20:41] INFO  ruby 1.9.3 (2014-11-13) [i686-linux]
[2014-11-23 20:20:41] INFO  WEBrick::HTTPServer#start: pid=18420 port=9393
至此,Sinatra框架已经部署完毕,可以去浏览器输入http://127.0.0.1:9393/了。友情提示:以上安装指令都不需要sudo,只用在当前用户下执行即可。三.参考资料1. [Sinatra](http://www.sinatrarb.com/) as Web Server
2. [ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) as ORM
3. Sqlite3 as database (single file database)
4. [RSpec](http://rspec.info/) as unit test framework
5. [Rake](https://github.com/ruby/rake) as build tools
6. RVM安装指令 http://www.linuxidc.com/Linux/2015-02/114100.htmRuby中的遍历指定目录的文件方法 http://www.linuxidc.com/Linux/2015-01/111525.htmUbuntu下搭建Ruby On Rails http://www.linuxidc.com/Linux/2012-06/61981.htm实测 Ubuntu 13.10 上搭建 Ruby on Rails http://www.linuxidc.com/Linux/2014-02/96399.htmRuby on Rails 4 Tutorial 中文版 高清完整PDF http://www.linuxidc.com/Linux/2014-04/100253.htmRuby 的详细介绍:请点这里
Ruby 的下载地址:请点这里本文永久更新链接地址