日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 综合教程 >内容正文

综合教程

Linux 下安装JRuby

發(fā)布時(shí)間:2023/12/19 综合教程 27 生活家
生活随笔 收集整理的這篇文章主要介紹了 Linux 下安装JRuby 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

安裝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

版本號(hào)可以通過(guò)tab提示獲得最新版本號(hào)

第一個(gè)網(wǎng)站

使用SQLite3測(cè)試:

#### 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

打開(kāi) http://localhost:3000 即看到封面。

第一個(gè)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

現(xiàn)在打開(kāi) http://localhost:3000/people 即有一個(gè)人員管理CRUD頁(yè)面。

Jruby下運(yùn)行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

去掉自動(dòng)生成的:

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

運(yùn)行

bundle install

jruby –S rails server

總結(jié)

以上是生活随笔為你收集整理的Linux 下安装JRuby的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。