carrierwave-neo4j 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5507ccab191bfca681514fde9d25ad62c56ff8ab
4
- data.tar.gz: b849d9e4f6b4b73c7e985454f6f09fc10235e9b5
3
+ metadata.gz: eed0a17437d69669c72cecb206892b4ceb44b97f
4
+ data.tar.gz: 090b62247871e18da9c37b08fe2d500e93228bed
5
5
  SHA512:
6
- metadata.gz: 0911192167258d8be9d4ecf37857dc056725627706c30b2d853c0b6d4e10b8c38cd9fe3d0d90e0b143cc2ef5a8656fe1f0220d1ccac7aa9eeaa0ece0a39cd3ac
7
- data.tar.gz: 4fd214ca10c2f7a0950156760d3bf7a25b45dc2b618026a27118184dc47a9603632e1ef577f4c78dccfc57256178ae103ee0137d3f16f1471cd1fad391b7878e
6
+ metadata.gz: 917b312423a7483035661b3550b2bb5377e260ebcb9c1ee034dfa9de38810250a461efa4856223df425d162de3fe3aa2da067cf70efe965fc181c8e2daa121f2
7
+ data.tar.gz: 6f98f2c765206a1a92e15ccd5ceb71f36259ba55fc98d1ebba6be98856ec88f4eef01cb4f0f3e7225069def15edb1ad1f62bf35869ec48d58c4023a730ac7545
data/Gemfile CHANGED
@@ -3,4 +3,9 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in carrierwave_neo4j.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'neo4j', github: 'neo4jrb/neo4j'
7
+ gem 'neo4j-core', github: 'neo4jrb/neo4j-core'
8
+ #gem 'carrierwave', '0.10.0'
9
+ gem 'pry'
10
+ gem 'rspec-its'
6
11
  gem 'database_cleaner', github: 'dpisarewski/database_cleaner', branch: 'neo4j'
data/README.md CHANGED
@@ -7,7 +7,7 @@ This gem adds support for Neo4j 3.0+ to CarrierWave, see the CarrierWave documen
7
7
  Add to your Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'carrierwave-neo4j', require: 'carrierwave/neo4j', github: 'dpisarewski/carrierwave-neo4j'
10
+ gem 'carrierwave-neo4j', require: 'carrierwave/neo4j'
11
11
  ```
12
12
  Use it like this:
13
13
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency("activesupport", ">= 3.0" )
22
- s.add_dependency("neo4j", ">= 1.1")
22
+ s.add_dependency("neo4j", ">= 3.0.0")
23
23
  s.add_dependency("carrierwave", "~> 0.5")
24
24
  s.add_development_dependency("rspec", "~> 2.0")
25
25
  end
@@ -26,6 +26,7 @@ module CarrierWave
26
26
 
27
27
  after_save :"store_#{column}!"
28
28
  before_save :"write_#{column}_identifier"
29
+ before_destroy :"clear_#{column}"
29
30
  after_destroy :"remove_#{column}!"
30
31
 
31
32
  class_eval <<-RUBY, __FILE__, __LINE__+1
@@ -41,8 +42,7 @@ module CarrierWave
41
42
  super
42
43
  end
43
44
 
44
- def remove_#{column}!
45
- super
45
+ def clear_#{column}
46
46
  write_uploader(_mounter(:#{column}).serialization_column, nil)
47
47
  end
48
48
 
@@ -18,9 +18,15 @@ module CarrierWave::Neo4j
18
18
  end
19
19
  end
20
20
 
21
- mod = case Neo4j::VERSION.split('.').first.to_i
22
- when 3 then Neo4j
23
- when 4 then Neo4j::Shared
24
- end
21
+ def register_converter(mod)
22
+ mod::TypeConverters.send :include, CarrierWave::Neo4j::TypeConverters
23
+ end
25
24
 
26
- mod::TypeConverters.send :include, CarrierWave::Neo4j::TypeConverters
25
+ major = Neo4j::VERSION.split('.').first.to_i
26
+
27
+ case major
28
+ when 1..2 then fail('Unsupported version of Neo4j gem. Please update it.')
29
+ when 3 then register_converter(Neo4j)
30
+ when 4 then register_converter(Neo4j::Shared)
31
+ when 5..Float::INFINITY then Neo4j::Shared::TypeConverters.register_converter(CarrierWave::Neo4j::TypeConverters::UploaderConverter)
32
+ end
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Neo4j
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
data/spec/neo4j_spec.rb CHANGED
@@ -116,8 +116,9 @@ describe CarrierWave::Neo4j do
116
116
  end
117
117
 
118
118
  it "also destroys the image" do
119
+ file_path = record.image.path
119
120
  expect { record.destroy }.to change {
120
- File.exist? public_path("uploads/tarja.jpg")
121
+ File.exist? file_path
121
122
  }.from(true).to(false)
122
123
  end
123
124
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rubygems"
2
2
  require "bundler/setup"
3
3
  require "rspec"
4
+ require "rspec/its"
4
5
 
5
6
  require "carrierwave"
6
7
  require "carrierwave/neo4j"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-20 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.1'
40
+ version: 3.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: carrierwave
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project: carrierwave_neo4j
109
- rubygems_version: 2.4.3
109
+ rubygems_version: 2.4.6
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Neo4j support for Carrierwave