我使用jruby创建了一个应用程序,但我想让它在另一台只安装了ruby的计算机上运行。 它不会让我只是将gemfile从jruby更改为ruby,那么如何根据ruby将其更改为运行?
这是我使用jruby的gemfile:
source 'https://rubygems.org'
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
gem 'cowsay'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'activerecord-jdbcpostgresql-adapter'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
答案 0 :(得分:0)
改变这个:
ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
为:
ruby '2.2.2'
并改变:
gem 'activerecord-jdbcpostgresql-adapter'
为:
gem 'pg'
您可能还需要更新database.yml。你没有把它贴在这里,所以我不能确定。只需查找pg gem即可查看配置所需内容所需的内容。
答案 1 :(得分:0)
无需像其他答案中所建议的那样实际更改太多内容。 在 Gemfile 中为MRI / JRuby特定宝石指定平台限定符:
# ruby '2.2.2', :engine => 'jruby', :engine_version => '9.0.0.0'
# ...
gem 'rails', '4.1.8'
# ...
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
gem 'pg', platform: :mri
如果您在 database.yml (例如url: jdbc:postrgresql:...
)中没有使用任何AR-JDBC,而不是在JRuby和C-Ruby上使用相同的配置< / p>