refinery / refinerycms

An extendable Ruby on Rails CMS that supports Rails 6.0+
https://www.refinerycms.com/
MIT License
3.9k stars 1.26k forks source link

JRuby support #459

Closed BigForNothing closed 13 years ago

BigForNothing commented 13 years ago

JRuby support is lacking. With the ImageMagick removed, I would think there would be a greater push to ensuring that JRuby could be used in development, test and production environments...

parndt commented 13 years ago

ImageMagick was not removed, RMagick was. Can you point to something specifically that fails in JRuby please?

stevenheidel commented 13 years ago

RefineryCMS is compatible with JRuby, I just tested it out before we pushed 0.9.9

parndt commented 13 years ago

Please reopen if you can point to any specific infringement :)

BigForNothing commented 13 years ago

Sorry, wrong library and I should have elaborated. Basically, RefineryCMS doesn't detect that its running under JRuby and requires sqlite3-ruby in the Gemfile. This ends up causing all the extra RefineryCMS stuff not to be included it seems.

{11-02-08 15:19}[ruby-1.9.2]RANCAMW-121XVUW:~/Programming uleexda% rvm use jruby info: Using /Users/uleexda/.rvm/gems/jruby-1.5.6 info: running hook after_use {11-02-08 15:19}[jruby-1.5.6]RANCAMW-121XVUW:~/Programming uleexda% rvm gemset create refinery info: 'refinery' gemset created (/Users/uleexda/.rvm/gems/jruby-1.5.6@refinery). {11-02-08 15:19}[jruby-1.5.6]RANCAMW-121XVUW:~/Programming uleexda% rvm use jruby@refinery rvm info: Using /Users/uleexda/.rvm/gems/jruby-1.5.6 with gemset refinery info: running hook after_use {11-02-08 15:19}[jruby-1.5.6@refinery]RANCAMW-121XVUW:~/Programming uleexda% gem install refinerycms NOTE: If you are running Ruby 1.9.2 you can ignore this message.

RDoc 2.5+ has a new ri data format for Ruby 1.8.7 and 1.9.1. (1.9.2 contains RDoc 2.5 so there is nothing to do!)

To install new ri data for core and stdlib you'll need to:

gem install rdoc-data

then run:

rdoc-data --install

To have ri data for you gems you'll also need to run:

gem rdoc --all --overwrite

If you don't want to rebuild the rdoc for gem server, add --no-rdoc.

NOTE: RDoc 2.5 did not save method parameters, so you should upgrade your rdoc-data gem to a version >= 2.5.3 if you installed an older version. Successfully installed acts_as_indexed-0.6.7 Successfully installed rack-1.2.1 Successfully installed warden-1.0.3 Successfully installed bcrypt-ruby-2.1.4-java Successfully installed devise-1.1.5 Successfully installed dragonfly-0.8.2 Successfully installed babosa-0.2.2 Successfully installed friendly_id_globalize3-3.2.1 Successfully installed activesupport-3.0.4 Successfully installed builder-2.1.2 Successfully installed i18n-0.5.0 Successfully installed activemodel-3.0.4 Successfully installed arel-2.0.8 Successfully installed tzinfo-0.3.24 Successfully installed activerecord-3.0.4 Successfully installed globalize3-0.1.0.beta Successfully installed moretea-awesome_nested_set-1.4.3.1 Successfully installed rack-cache-0.5.3 Successfully installed rack-test-0.5.7 Successfully installed rack-mount-0.6.13 Successfully installed abstract-1.0.0 Successfully installed erubis-2.6.6 Successfully installed actionpack-3.0.4 Successfully installed activeresource-3.0.4 Successfully installed mime-types-1.16 Successfully installed polyglot-0.3.1 Successfully installed treetop-1.4.9 Successfully installed mail-2.2.15 Successfully installed actionmailer-3.0.4 Successfully installed thor-0.14.6 Successfully installed railties-3.0.4 Successfully installed rails-3.0.4 Successfully installed rdoc-3.5.3 Successfully installed truncate_html-0.5.0 Successfully installed will_paginate-3.0.pre2 Successfully installed refinerycms-0.9.9 36 gems installed {11-02-08 15:23}[jruby-1.5.6@refinery]RANCAMW-121XVUW:~/Programming uleexda% refinerycms refinery_jruby_test Running: rails new "/Users/uleexda/Programming/refinery_jruby_test" --database sqlite3 --skip-test-unit --skip-prototype create
create README create Rakefile create config.ru create .gitignore create Gemfile create app create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create config create config/routes.rb create config/application.rb create config/environment.rb create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/backtrace_silencers.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/secret_token.rb create config/initializers/session_store.rb create config/locales create config/locales/en.yml create config/boot.rb create config/database.yml create db create db/seeds.rb create doc create doc/README_FOR_APP create lib create lib/tasks create lib/tasks/.gitkeep create log create log/server.log create log/production.log create log/development.log create log/test.log create public create public/404.html create public/422.html create public/500.html create public/favicon.ico create public/index.html create public/robots.txt create public/images create public/images/rails.png create public/stylesheets create public/stylesheets/.gitkeep create public/javascripts create public/javascripts/.gitkeep create public/javascripts/application.js create script create script/rails create tmp create tmp/sessions create tmp/sockets create tmp/cache create tmp/pids create vendor/plugins create vendor/plugins/.gitkeep


Refinery successfully installed in '/Users/uleexda/Programming/refinery_jruby_test'!

Installing gem requirements using bundler.. Running: cd "/Users/uleexda/Programming/refinery_jruby_test" && bundle install Fetching source index for http://rubygems.org/ Using rake (0.8.7) Installing ZenTest (4.4.2) Using abstract (1.0.0) Using activesupport (3.0.4) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.4) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.7) Using tzinfo (0.3.24) Using actionpack (3.0.4) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.15) Using actionmailer (3.0.4) Using arel (2.0.8) Using activerecord (3.0.4) Using activeresource (3.0.4) Using acts_as_indexed (0.6.7) Installing autotest (4.4.6) Installing autotest-notification (2.3.1) Installing autotest-rails (4.1.0) Using babosa (0.2.2) Using bcrypt-ruby (2.1.4) Using bundler (1.0.10) Installing celerity (0.8.7) Installing culerity (0.2.15) Installing weakling (0.0.4) Installing nokogiri (1.4.4.2) Installing ffi (0.6.3) Installing childprocess (0.1.6) Installing json_pure (1.5.1) Installing rubyzip (0.9.4) Installing selenium-webdriver (0.1.2) Installing xpath (0.1.3) Installing capybara (0.4.1.1) Installing configuration (1.2.0) Installing diff-lcs (1.1.2) Installing json (1.4.6) Installing gherkin (2.3.3) Installing term-ansicolor (1.0.5) Installing cucumber (0.10.0) Installing cucumber-rails (0.3.2) Installing database_cleaner (0.6.2) Using warden (1.0.3) Using devise (1.1.5) Using dragonfly (0.8.2) Installing factory_girl (1.3.3) Using friendly_id_globalize3 (3.2.1) Using globalize3 (0.1.0.beta) Installing jruby-prof (0.1.0) Installing launchy (0.3.7) Using moretea-awesome_nested_set (1.4.3.1) Using rack-cache (0.5.3) Using thor (0.14.6) Using railties (3.0.4) Using rails (3.0.4) Using rdoc (3.5.3) Using truncate_html (0.5.0) Using will_paginate (3.0.pre2) Using refinerycms (0.9.9) Installing refinerycms-generators (0.9.9.3) Installing routing-filter (0.2.3) Installing refinerycms-i18n (0.9.9.7) Installing rspec-core (2.3.1) Installing rspec-expectations (2.3.0) Installing rspec-mocks (2.3.0) Installing rspec (2.3.0) Installing rspec-rails (2.3.0) Installing spork (0.8.4) with native extensions /Users/uleexda/.rvm/rubies/jruby-1.5.6/lib/ruby/site_ruby/1.8/rubygems/installer.rb:482:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/Users/uleexda/.rvm/rubies/jruby-1.5.6/bin/jruby extconf.rb WARNING: JRuby does not support native extensions or the mkmf' library. Check http://kenai.com/projects/jruby/pages/Home for alternatives. extconf.rb:9: undefined methoddir_config' for main:Object (NoMethodError)

Gem files will remain installed in /Users/uleexda/.rvm/gems/jruby-1.5.6@refinery/gems/sqlite3-1.3.3 for inspection. Results logged to /Users/uleexda/.rvm/gems/jruby-1.5.6@refinery/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out

from /Users/uleexda/.rvm/rubies/jruby-1.5.6/lib/ruby/site_ruby/1.8/rubygems/installer.rb:445:in `each'
from /Users/uleexda/.rvm/rubies/jruby-1.5.6/lib/ruby/site_ruby/1.8/rubygems/installer.rb:445:in `build_extensions'
from /Users/uleexda/.rvm/rubies/jruby-1.5.6/lib/ruby/site_ruby/1.8/rubygems/installer.rb:197:in `install'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:21:in `run'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/bin/bundle:13
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/gems/bundler-1.0.10/bin/bundle:19:in `load'
from /Users/uleexda/.rvm/gems/jruby-1.5.6@global/bin/bundle:19

Installing sqlite3 (1.3.3) with native extensions Running: cd "/Users/uleexda/Programming/refinery_jruby_test" && rake -f "/Users/uleexda/Programming/refinery_jruby_test/Rakefile" db:create (in /Users/uleexda/Programming/refinery_jruby_test) Could not find gem 'sqlite3 (>= 0, runtime)' in any of the gem sources listed in your Gemfile. Running: cd "/Users/uleexda/Programming/refinery_jruby_test" && rails generate refinerycms Could not find gem 'sqlite3 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

Setting up your development database.. Running: cd "/Users/uleexda/Programming/refinery_jruby_test" && rake -f "/Users/uleexda/Programming/refinery_jruby_test/Rakefile" db:migrate (in /Users/uleexda/Programming/refinery_jruby_test) Could not find gem 'sqlite3 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

=== ACTION REQUIRED === Now you can launch your webserver using:

cd /Users/uleexda/Programming/refinery_jruby_test rails server

This will launch the built-in webserver at port 3000. You can now see your site running in your browser at http://localhost:3000

Thanks for installing Refinery, enjoy creating your new application!

BigForNothing commented 13 years ago

Apologies for the formatting...

Obviously I can make the changes to the Gemfile to use jdbc-sqlite3 and the respective activerecord adapters, however at that point it basically seems that I'm sitting a default rails app.

Edit: Wanted to add, if there is anything you all need me to test, let me know...

parndt commented 13 years ago

I now understand your issue.

Do you think you'd be able to provide a patch that makes Refinery magically insert JRuby compatible gems into the Gemfile if it knows it's running under JRuby? Otherwise, I'm sure someone else will in time.

BigForNothing commented 13 years ago

I'll take a look into it.. If I can't find the time to do it today I'll try to have it it done tomorrow.

parndt commented 13 years ago

Probably the best place to do it is here, right after it generates the rails application. You'd have to gsub the current sqlite3 to jdbc-sqlite3 or whatever is best for JRuby:

https://github.com/resolve/refinerycms/blob/master/bin/refinerycms#L256

stevenheidel commented 13 years ago

Ah that makes sense. The JRuby adapter doesn't get copied over from the git version

parndt commented 13 years ago

Yes, because rails is responsible for generating the application so that we ensure we are compatible with existing applications.

BigForNothing commented 13 years ago

I was experimenting with this before I left work, but if you move the sqlite3-ruby and jdbc lines to within the ### refinery section, it shows up in the final gemfile properly. At that point it appears there is a dependency that wants sqlite3. I had to take off before I could investigation further. As it is, im still not home and haven't looked into it more. However it initially appears the refinercms bin file doesn't need to be modified.

parndt commented 13 years ago

Putting the gem requirement between the ### REFINERY CMS tags is not a proper solution as refinerycms developers may want to use a different database and when they do so will break this again :-) The best way is to gsub it in bin/refinerycms right after rails installs it.

parndt commented 13 years ago

Add better suppot for jruby by replacing sqlite3 with activerecord-jdbcsqlite3-adapter if the user installs on RUBY_PLATFORM == 'java'. Closed by 59d9745076151601d51c98fd56287e54806a7386

lukefx commented 13 years ago

Guys, this issue isn't closed. You can't even start a new app with JRuby on Windows.

https://gist.github.com/913259

DragonFly still want to use 'Dragonfly::Config::ImageMagick'.