refile-neo4j 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/lib/refile/neo4j.rb +1 -0
- data/lib/refile/neo4j/attachment.rb +52 -0
- data/refile-neo4j.gemspec +24 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 66f982355768f97163118f7dec6212b5ab424027
|
4
|
+
data.tar.gz: af1c62a0f462f975dcfaa0853cd7e2418f9b7a9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a613411a1741eede0e37d0ee8ef3f58106e62ac6d168e3e1312947840caef82a17b38eebcdbdab0a330c77f25cc7fdb5e12f029089543d6f453fa1e62dc3f96
|
7
|
+
data.tar.gz: 1f7ef08496e1edb29800e468311eceee8434e59c5f7e1e29d95e1c7951ec90f8bee1a797005888436fc9333962e78940ee50447941ec7e6e44855e502d8ffabc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Andrew Havens
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Refile::Neo4j
|
2
|
+
|
3
|
+
Add Neo4j support to Refile.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'refile-neo4j'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class User
|
21
|
+
include Neo4j::ActiveNode
|
22
|
+
extend Refile::Neo4j::Attachment
|
23
|
+
|
24
|
+
attachment :profile_image
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andrewhavens/refile-neo4j.
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The design of this gem was influenced by [`refile-mongoid`](https://github.com/krettan/refile-mongoid).
|
35
|
+
|
36
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/refile/neo4j.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "refile/neo4j/attachment"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Refile
|
2
|
+
module Neo4j
|
3
|
+
module Attachment
|
4
|
+
include Refile::Attachment
|
5
|
+
|
6
|
+
# Attachment method which hooks into Neo4j::ActiveNode models
|
7
|
+
#
|
8
|
+
# @param [true, false] destroy Whether to remove the stored file if its model is destroyed
|
9
|
+
# @return [void]
|
10
|
+
# @see Refile::Attachment#attachment
|
11
|
+
def attachment(name, raise_errors: false, destroy: true, **options)
|
12
|
+
super(name, raise_errors: raise_errors, **options)
|
13
|
+
|
14
|
+
attacher = :"#{name}_attacher"
|
15
|
+
property :"#{name}_id", type: String
|
16
|
+
|
17
|
+
validate do
|
18
|
+
if send(attacher).present?
|
19
|
+
send(attacher).valid?
|
20
|
+
send(attacher).errors.each do |error|
|
21
|
+
errors.add(name, error)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
define_method "#{name}=" do |value|
|
27
|
+
send("#{name}_id_will_change!")
|
28
|
+
super(value)
|
29
|
+
end
|
30
|
+
|
31
|
+
define_method "remove_#{name}=" do |value|
|
32
|
+
send("#{name}_id_will_change!")
|
33
|
+
super(value)
|
34
|
+
end
|
35
|
+
|
36
|
+
define_method "remote_#{name}_url=" do |value|
|
37
|
+
send("#{name}_id_will_change!")
|
38
|
+
super(value)
|
39
|
+
end
|
40
|
+
|
41
|
+
before_save do
|
42
|
+
send(attacher).store!
|
43
|
+
end
|
44
|
+
|
45
|
+
after_destroy do
|
46
|
+
send(attacher).delete! if destroy
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
Gem::Specification.new do |spec|
|
3
|
+
spec.name = "refile-neo4j"
|
4
|
+
spec.version = "1.0.0"
|
5
|
+
spec.authors = ["Andrew Havens"]
|
6
|
+
spec.email = ["email@andrewhavens.com"]
|
7
|
+
|
8
|
+
spec.summary = %q{Add Neo4j support to Refile.}
|
9
|
+
spec.description = %q{Add Neo4j support to Refile.}
|
10
|
+
spec.homepage = "https://github.com/andrewhavens/refile-neo4j"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
14
|
+
spec.bindir = "exe"
|
15
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_runtime_dependency "refile", ">= 0.6.0"
|
19
|
+
spec.add_runtime_dependency "neo4j"
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refile-neo4j
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Havens
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: refile
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: neo4j
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Add Neo4j support to Refile.
|
84
|
+
email:
|
85
|
+
- email@andrewhavens.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- lib/refile/neo4j.rb
|
98
|
+
- lib/refile/neo4j/attachment.rb
|
99
|
+
- refile-neo4j.gemspec
|
100
|
+
homepage: https://github.com/andrewhavens/refile-neo4j
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.5.1
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Add Neo4j support to Refile.
|
124
|
+
test_files: []
|