From 1a87df2c13842ba1d5583ab30e3bc198245dcdc1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 10 Jul 2014 21:34:11 -0400 Subject: Port to JRuby --- Gemfile | 9 ++++++--- Gemfile.lock | 24 ++++++++++++++++++++++-- app/models/user.rb | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 19d27f7..1610020 100644 --- a/Gemfile +++ b/Gemfile @@ -14,11 +14,13 @@ gem 'simple_captcha2', require: 'simple_captcha' group :development, :test do # Use sqlite3 as the database - gem 'sqlite3' + gem 'sqlite3', platforms: [ :mri ] + gem 'activerecord-jdbcsqlite3-adapter', platforms: [ :jruby ] end group :production do # USe PostgresQL as the database - gem 'pg' + gem 'pg', platforms: [ :mri ] + gem 'activerecord-jdbcpostgresql-adapter', platforms: [ :jruby ] end # group :test do @@ -38,7 +40,8 @@ gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes -gem 'therubyracer', platforms: :ruby +gem 'therubyracer', platforms: [ :mri ] +gem 'therubyrhino', platforms: [ :jruby ] # Use jquery as the JavaScript library gem 'jquery-rails' diff --git a/Gemfile.lock b/Gemfile.lock index daed0bc..b990ba5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,6 +19,14 @@ GEM activesupport (= 4.0.2) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) + activerecord-jdbc-adapter (1.3.9) + activerecord (>= 2.2) + activerecord-jdbcpostgresql-adapter (1.3.9) + activerecord-jdbc-adapter (~> 1.3.9) + jdbc-postgres (>= 9.1) + activerecord-jdbcsqlite3-adapter (1.3.9) + activerecord-jdbc-adapter (~> 1.3.9) + jdbc-sqlite3 (~> 3.7.2) activesupport (4.0.2) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) @@ -27,6 +35,7 @@ GEM tzinfo (~> 0.3.37) arel (4.0.2) bcrypt-ruby (3.1.2) + bcrypt-ruby (3.1.2-java) bootstrap-sass (3.2.0.0) sass (~> 3.2) builder (3.1.4) @@ -59,14 +68,17 @@ GEM httparty (0.13.1) json (~> 1.8) multi_xml (>= 0.5.2) - i18n (0.6.9) + i18n (0.6.11) jbuilder (1.5.3) activesupport (>= 3.0.0) multi_json (>= 1.2.0) + jdbc-postgres (9.3.1101) + jdbc-sqlite3 (3.7.2.1) jquery-rails (3.1.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) + json (1.8.1-java) libv8 (3.16.14.3) mail (2.5.4) mime-types (~> 1.16) @@ -125,23 +137,30 @@ GEM therubyracer (0.12.1) libv8 (~> 3.16.14.0) ref + therubyrhino (2.0.3) + therubyrhino_jar (>= 1.7.3) + therubyrhino_jar (1.7.4) thor (0.19.1) thread_safe (0.3.4) + thread_safe (0.3.4-java) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) turbolinks (2.2.2) coffee-rails - tzinfo (0.3.39) + tzinfo (0.3.40) uglifier (2.5.1) execjs (>= 0.3.0) json (>= 1.8.0) PLATFORMS + java ruby DEPENDENCIES + activerecord-jdbcpostgresql-adapter + activerecord-jdbcsqlite3-adapter bcrypt-ruby (= 3.1.2) bootstrap-sass coffee-rails (~> 4.0.0) @@ -159,5 +178,6 @@ DEPENDENCIES simple_captcha2 sqlite3 therubyracer + therubyrhino turbolinks uglifier (>= 1.3.0) diff --git a/app/models/user.rb b/app/models/user.rb index 99761e7..effe166 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -46,7 +46,7 @@ class User < ActiveRecord::Base validates(:email, presence: true, # This regex is taken from http://www.w3.org/TR/html5/forms.html#e-mail-state-%28type=email%29 - format: {with: /\A[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/}, + format: { with: /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/ }, uniqueness: { case_sensitive: false }) # user_name:string_uniq -- cgit v1.2.3