Skip to content

Commit

Permalink
Merge pull request #5 from dpisarewski/master
Browse files Browse the repository at this point in the history
support for neo4j 5
  • Loading branch information
dpisarewski committed May 4, 2015
2 parents cf69eeb + 43d3c53 commit c160c47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -3,8 +3,8 @@ source "http://rubygems.org"
# Specify your gem's dependencies in carrierwave_neo4j.gemspec
gemspec

#gem 'neo4j', '4.1.2'
#gem 'neo4j-core', '4.0.3'
gem 'neo4j', github: 'neo4jrb/neo4j'
gem 'neo4j-core', github: 'neo4jrb/neo4j-core'
#gem 'carrierwave', '0.10.0'
gem 'pry'
gem 'rspec-its'
Expand Down
16 changes: 11 additions & 5 deletions lib/carrierwave/neo4j/uploader_converter.rb
Expand Up @@ -18,9 +18,15 @@ def to_ruby(value)
end
end

mod = case Neo4j::VERSION.split('.').first.to_i
when 3 then Neo4j
when 4 then Neo4j::Shared
end
def register_converter(mod)
mod::TypeConverters.send :include, CarrierWave::Neo4j::TypeConverters
end

mod::TypeConverters.send :include, CarrierWave::Neo4j::TypeConverters
major = Neo4j::VERSION.split('.').first.to_i

case major
when 1..2 then fail('Unsupported version of Neo4j gem. Please update it.')
when 3 then register_converter(Neo4j)
when 4 then register_converter(Neo4j::Shared)
when 5..Float::INFINITY then Neo4j::Shared::TypeConverters.register_converter(CarrierWave::Neo4j::TypeConverters::UploaderConverter)
end
2 changes: 1 addition & 1 deletion lib/carrierwave/neo4j/version.rb
@@ -1,5 +1,5 @@
module CarrierWave
module Neo4j
VERSION = "2.0.0"
VERSION = "2.0.1"
end
end

0 comments on commit c160c47

Please sign in to comment.