Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #56 from filiptepper/master

Added JRuby support
  • Loading branch information...
commit c27b375ac0b38519e463d03ae269003c9116e264 2 parents 03588cd + 10ad513
@diogob authored
View
4 Gemfile
@@ -2,7 +2,9 @@ source "http://rubygems.org"
# Add dependencies required to use your gem here.
gem 'rails'
gem 'rake'
-gem 'pg'
+
+gem 'pg', :platforms => :ruby
+gem 'activerecord-jdbcpostgresql-adapter', :platforms => :jruby
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
View
7 Gemfile.lock
@@ -22,6 +22,10 @@ GEM
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
+ activerecord-jdbc-adapter (1.2.2.1)
+ activerecord-jdbcpostgresql-adapter (1.2.2.1)
+ activerecord-jdbc-adapter (~> 1.2.2.1)
+ jdbc-postgres (>= 9.0, < 9.2)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
@@ -35,6 +39,7 @@ GEM
git (1.2.5)
hike (1.2.1)
i18n (0.6.1)
+ jdbc-postgres (9.1.901)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
@@ -101,9 +106,11 @@ GEM
tzinfo (0.3.33)
PLATFORMS
+ java
ruby
DEPENDENCIES
+ activerecord-jdbcpostgresql-adapter
bundler (~> 1.1.3)
jeweler (~> 1.8.3)
pg
View
18 activerecord-postgres-hstore.gemspec
@@ -104,7 +104,11 @@ Gem::Specification.new do |s|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rails>, [">= 0"])
s.add_runtime_dependency(%q<rake>, [">= 0"])
- s.add_runtime_dependency(%q<pg>, [">= 0"])
+ if RUBY_PLATFORM == "java"
+ s.add_runtime_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
+ else
+ s.add_runtime_dependency(%q<pg>, [">= 0"])
+ end
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
@@ -113,7 +117,11 @@ Gem::Specification.new do |s|
else
s.add_dependency(%q<rails>, [">= 0"])
s.add_dependency(%q<rake>, [">= 0"])
- s.add_dependency(%q<pg>, [">= 0"])
+ if RUBY_PLATFORM == "java"
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
+ else
+ s.add_dependency(%q<pg>, [">= 0"])
+ end
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.1.3"])
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
@@ -123,7 +131,11 @@ Gem::Specification.new do |s|
else
s.add_dependency(%q<rails>, [">= 0"])
s.add_dependency(%q<rake>, [">= 0"])
- s.add_dependency(%q<pg>, [">= 0"])
+ if RUBY_PLATFORM == "java"
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
+ else
+ s.add_dependency(%q<pg>, [">= 0"])
+ end
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<bundler>, ["~> 1.1.3"])
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
View
3  app/Gemfile
@@ -1,7 +1,8 @@
source 'http://rubygems.org'
gem 'rails', '3.0.0'
-gem 'pg'
+gem 'pg', :platforms => :ruby
+gem 'activerecord-jdbcpostgresql-adapter', :platforms => :jruby
gem 'activerecord-postgres-hstore', :path => '../'
# Use unicorn as the web server
View
4 lib/activerecord-postgres-hstore/activerecord.rb
@@ -133,7 +133,7 @@ def hstore(*args)
end
- class PostgreSQLColumn < Column
+ class PostgreSQLColumn
# Does the type casting from hstore columns using String#from_hstore or Hash#from_hstore.
def type_cast_code_with_hstore(var_name)
type == :hstore ? "#{var_name}.from_hstore" : type_cast_code_without_hstore(var_name)
@@ -148,7 +148,7 @@ def simplified_type_with_hstore(field_type)
alias_method_chain :simplified_type, :hstore
end
- class PostgreSQLAdapter < AbstractAdapter
+ class PostgreSQLAdapter
def native_database_types_with_hstore
native_database_types_without_hstore.merge({:hstore => { :name => "hstore" }})
end
View
9 lib/activerecord-postgres-hstore/railties.rb
@@ -1,14 +1,19 @@
require 'rails'
require 'rails/generators'
require 'rails/generators/migration'
-require 'pg'
+
+if RUBY_PLATFORM == "jruby"
+ require 'activerecord-jdbcpostgresql-adapter'
+else
+ require 'pg'
+end
# = Hstore Railtie
#
# Creates a new railtie for 2 reasons:
#
# * Initialize ActiveRecord properly
-# * Add hstore:setup generator
+# * Add hstore:setup generator
class Hstore < Rails::Railtie
initializer 'activerecord-postgres-hstore' do
Please sign in to comment.
Something went wrong with that request. Please try again.