首页 / RUBY / Linux 下安装JRuby
Linux 下安装JRuby
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux 下安装JRuby,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2085字,纯文字阅读大概需要3分钟。
内容图文

安装ruby
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo ‘export PATH="$HOME/.rbenv/bin:$PATH"‘ >> ~/.bashrc
echo ‘eval "$(rbenv init -)"‘ >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo ‘export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"‘ >> ~/.bashrc
exec $SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
安装Bundler
gem install bundler
安装NodeJS
node -vcurl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
安装Rails
gem install rails -v
4.2.6
rbenv rehash
版本号可以通过tab提示获得最新版本号
第一个网站
使用SQLite3测试:
#### If you want to use SQLite (not recommended)
rails new myapp
#### If you want to use MySQL
rails new myapp -d mysql
#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql
# Move into the application directory
cd myapp
# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified
# Create the database
rake db:create
rails server
打开 http://localhost:3000 即看到封面。
第一个CRUD功能
rails generate scaffold Person first_name:string last_name:string phone_number:string address:text
rake db:migrate
rake db:migrate RAILS_ENV=production
现在打开 http://localhost:3000/people 即有一个人员管理CRUD页面。
Jruby下运行Rails
安装Java
先卸载openjdk:
yum -y remove java*
安装oracle jdk
sudo rpm -i jdk-8u112-linux-x64.rpm
安装Jruby
56 rbenv install --list
57 rbenv global jruby-9.1.5.0
58 jruby –v
修改Gemfile
去掉自动生成的:
gem ‘activerecord-jdbcsqlite3-adapter‘
在末尾增加:
platform :jruby do
gem ‘activerecord-jdbc-adapter‘, git: ‘https://github.com/jruby/activerecord-jdbc-adapter.git‘, branch: ‘rails-5‘
gem ‘activerecord-jdbcsqlite3-adapter‘, git: "https://github.com/jruby/activerecord-jdbc-adapter.git", branch: ‘rails-5‘
gem ‘listen‘
end
运行
bundle install
jruby –S rails server
原文:http://www.cnblogs.com/inshua/p/6053895.html
内容总结
以上是互联网集市为您收集整理的Linux 下安装JRuby全部内容,希望文章能够帮你解决Linux 下安装JRuby所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。