Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Support JRuby again.
Browse files Browse the repository at this point in the history
  • Loading branch information
nning committed Dec 9, 2014
1 parent fa55659 commit 205ecd8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: ruby

rvm:
- 2.1
- jruby

notifications:
email: false
Expand Down
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
gem 'rails', '~> 3.2.19'

gem 'pg', platforms: :ruby
#gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby
gem 'activerecord-jdbcpostgresql-adapter', platforms: :jruby

gem 'cancan' # Authorization
gem 'default_value_for' # Default values
Expand All @@ -24,7 +24,7 @@ gem 'yaml_db' # Database dump
group :assets do
gem 'coffee-rails'
gem 'therubyracer', platforms: :ruby
# gem 'therubyrhino', platforms: :jruby
gem 'therubyrhino', platforms: :jruby
gem 'uglifier'

gem 'sass-rails'
Expand All @@ -39,7 +39,7 @@ group :development do
gem 'capistrano-rbenv', github: 'capistrano/rbenv'

# More beautiful exception pages
gem 'better_errors'
gem 'better_errors', platforms: :ruby
gem 'binding_of_caller', platforms: :ruby

gem 'rails-erd' # Entity/relationship diagram of model
Expand All @@ -52,10 +52,10 @@ group :development, :test do
gem 'mysql2'
end

# platforms :jruby do
# gem 'activerecord-jdbcsqlite3-adapter'
# gem 'activerecord-jdbcmysql-adapter'
# end
platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'activerecord-jdbcmysql-adapter'
end
end

group :test do
Expand Down
31 changes: 26 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ GEM
activesupport (= 3.2.21)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.3.13)
activerecord (>= 2.2)
activerecord-jdbcmysql-adapter (1.3.13)
activerecord-jdbc-adapter (~> 1.3.13)
jdbc-mysql (>= 5.1.22)
activerecord-jdbcpostgresql-adapter (1.3.13)
activerecord-jdbc-adapter (~> 1.3.13)
jdbc-postgres (>= 9.1)
activerecord-jdbcsqlite3-adapter (1.3.13)
activerecord-jdbc-adapter (~> 1.3.13)
jdbc-sqlite3 (>= 3.7.2, < 3.9)
activeresource (3.2.21)
activemodel (= 3.2.21)
activesupport (= 3.2.21)
Expand Down Expand Up @@ -119,9 +130,9 @@ GEM
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
foreigner (1.6.1)
foreigner (1.7.1)
activerecord (>= 3.0.0)
haml (4.0.5)
haml (4.0.6)
tilt
has_scope (0.6.0.rc)
actionpack (>= 3.2, < 5)
Expand All @@ -133,6 +144,9 @@ GEM
inherited_resources (1.4.1)
has_scope (~> 0.6.0.rc)
responders (~> 1.0.0.rc)
jdbc-mysql (5.1.33)
jdbc-postgres (9.3.1102)
jdbc-sqlite3 (3.8.7)
journey (1.0.4)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
Expand All @@ -153,7 +167,7 @@ GEM
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
netrc (0.8.0)
netrc (0.9.0)
orm_adapter (0.5.0)
paper_trail (2.7.2)
activerecord (~> 3.0)
Expand Down Expand Up @@ -189,7 +203,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.4.0)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
Expand Down Expand Up @@ -248,6 +262,9 @@ GEM
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
therubyrhino (2.0.4)
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)
Expand All @@ -257,7 +274,7 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.42)
uglifier (2.5.3)
uglifier (2.6.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
Expand All @@ -271,6 +288,9 @@ PLATFORMS
ruby

DEPENDENCIES
activerecord-jdbcmysql-adapter
activerecord-jdbcpostgresql-adapter
activerecord-jdbcsqlite3-adapter
better_errors
binding_of_caller
bootstrap-sass (~> 3.1.1.1)
Expand Down Expand Up @@ -306,5 +326,6 @@ DEPENDENCIES
simple_form
sqlite3
therubyracer
therubyrhino
uglifier
yaml_db
4 changes: 3 additions & 1 deletion lib/search.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Search for resources.
module Search
# Results for query.
def self.for(mailbox, query, sql: !Settings.elasticsearch)
def self.for(mailbox, query, options = {})
sql = options[:sql] || !Settings.elasticsearch

haystack = ::Domain.managable(mailbox)
haystack_ids = haystack.pluck(:id)

Expand Down
4 changes: 3 additions & 1 deletion lib/search/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module Search::Address
@model = nil

# Search either via SQL or indexed (depending on settings or argument).
def self.search(haystack, needle, sql: !Settings.elasticsearch)
def self.search(haystack, needle, options = {})
sql = options[:sql] || !Settings.elasticsearch

@model = Object.const_get haystack.model_name

if sql
Expand Down
4 changes: 3 additions & 1 deletion lib/search/domain.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Search for domains.
module Search::Domain
# Search either via SQL or indexed (depending on settings or argument).
def self.search(haystack, needle, sql: !Settings.elasticsearch)
def self.search(haystack, needle, options = {})
sql = options[:sql] || !Settings.elasticsearch

if sql
sql_search(haystack, needle)
else
Expand Down

0 comments on commit 205ecd8

Please sign in to comment.