refile-nobrainer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/lib/refile/nobrainer/attachment.rb +34 -0
- data/lib/refile/nobrainer.rb +1 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7b108ab0d2782cf43645bb7b09bdd49a6544297
|
4
|
+
data.tar.gz: 94ff9aa588a086149e58b6963d920c010ec4bfc1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed8dc2135b91b324f154ed8ba1e86a301f5f28edac949f5fccdee032df297befc74000dd6dea39be3c06ee5f0a2bba0ccc35e953529811c046bb135878978c5d
|
7
|
+
data.tar.gz: 6839e7e43debd1c68322e26d368fd256aa83741869ff772036402e9bc9396ac75913fb70cf0cc82ffa4820d76c00a6eda1ce3397de04e008ddcfc9587ec6854f
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Uberous
|
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,33 @@
|
|
1
|
+
# Refile::NoBrainer
|
2
|
+
|
3
|
+
[NoBrainer](http://nobrainer.io/) extension for [Refile](https://github.com/refile/refile).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "refile-nobrainer"
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require "refile/nobrainer"
|
17
|
+
|
18
|
+
class User
|
19
|
+
include NoBrainer::Document
|
20
|
+
extend Refile::NoBrainer::Attachment
|
21
|
+
|
22
|
+
attachment :profile_image
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
[MIT](/LICENSE.txt)
|
29
|
+
|
30
|
+
### Notice
|
31
|
+
Kudos go out to [@krettan](https://github.com/krettan)
|
32
|
+
|
33
|
+
Copied from https://github.com/krettan/refile-mongoid
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'refile'
|
2
|
+
require 'nobrainer'
|
3
|
+
|
4
|
+
module Refile
|
5
|
+
module NoBrainer
|
6
|
+
module Attachment
|
7
|
+
include Refile::Attachment
|
8
|
+
|
9
|
+
def attachment(name, raise_errors: false, **options)
|
10
|
+
super
|
11
|
+
attacher = "#{name}_attacher"
|
12
|
+
field "#{name}_id".to_sym, type: String
|
13
|
+
|
14
|
+
before_save do
|
15
|
+
send(attacher).store!
|
16
|
+
end
|
17
|
+
|
18
|
+
after_destroy do
|
19
|
+
send(attacher).delete!
|
20
|
+
end
|
21
|
+
|
22
|
+
before_validation do
|
23
|
+
if send(attacher).present?
|
24
|
+
send(attacher).valid?
|
25
|
+
send(attacher).errors.each do |error|
|
26
|
+
errors.add(name, error)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "refile/nobrainer/attachment"
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refile-nobrainer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Henricus Louwhoff
|
8
|
+
- Jeroen Visser
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: refile
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.5'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.5'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: nobrainer
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.27.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.27.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.1'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.1'
|
70
|
+
description: Allow NoBrainer to play nicely with refile
|
71
|
+
email:
|
72
|
+
- henry@postb.us
|
73
|
+
- jeroenvisser101@gmail.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- lib/refile/nobrainer.rb
|
81
|
+
- lib/refile/nobrainer/attachment.rb
|
82
|
+
homepage: https://github.com/uberous/refile-nobrainer
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.1.0
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.6.4
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: NoBrainer integration of the Refile gem
|
106
|
+
test_files: []
|