mongoid-paperclip 0.0.10 → 0.0.11
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 +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +76 -0
- data/README.md +10 -0
- data/lib/mongoid-paperclip.rb +1 -0
- data/lib/mongoid_paperclip.rb +1 -1
- data/mongoid-paperclip.gemspec +6 -1
- data/spec/config/mongoid.yml +6 -0
- data/spec/mongoid-paperclip_spec.rb +41 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/avatar.png +0 -0
- metadata +68 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e6b90f64cb3a40aed4af8a37c154a262ca6d1a8
|
4
|
+
data.tar.gz: 19a9f17694ee2867a40d1c9628d19a2723cc8c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aa7502e748ceeeda74634a915c90b71d0c9d2aeffc0db78a9ef6dbc25f2c75e3b4ea9947befddc60af1264b8570076bcb5dc5cc829a505baeaf33bbd14a99b6
|
7
|
+
data.tar.gz: 39f7aeb6c88b4c0877b540ac193478ea490ff41ac70a983494e778b3cc272526f79f2b1439104f86b310610346be00d92f1b339736978d67b28bb4af7364df1a
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mongoid-paperclip (0.0.11)
|
5
|
+
mongoid
|
6
|
+
paperclip (>= 2.3.6, != 4.3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (4.2.6)
|
12
|
+
activesupport (= 4.2.6)
|
13
|
+
builder (~> 3.1)
|
14
|
+
activesupport (4.2.6)
|
15
|
+
i18n (~> 0.7)
|
16
|
+
json (~> 1.7, >= 1.7.7)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
bson (4.1.1)
|
21
|
+
builder (3.2.2)
|
22
|
+
climate_control (0.0.3)
|
23
|
+
activesupport (>= 3.0)
|
24
|
+
cocaine (0.5.8)
|
25
|
+
climate_control (>= 0.0.3, < 1.0)
|
26
|
+
diff-lcs (1.2.5)
|
27
|
+
i18n (0.7.0)
|
28
|
+
json (1.8.3)
|
29
|
+
mime-types (3.1)
|
30
|
+
mime-types-data (~> 3.2015)
|
31
|
+
mime-types-data (3.2016.0521)
|
32
|
+
mimemagic (0.3.2)
|
33
|
+
minitest (5.9.0)
|
34
|
+
mongo (2.2.5)
|
35
|
+
bson (~> 4.0)
|
36
|
+
mongoid (5.1.3)
|
37
|
+
activemodel (~> 4.0)
|
38
|
+
mongo (~> 2.1)
|
39
|
+
origin (~> 2.2)
|
40
|
+
tzinfo (>= 0.3.37)
|
41
|
+
origin (2.2.0)
|
42
|
+
paperclip (5.0.0)
|
43
|
+
activemodel (>= 4.2.0)
|
44
|
+
activesupport (>= 4.2.0)
|
45
|
+
cocaine (~> 0.5.5)
|
46
|
+
mime-types
|
47
|
+
mimemagic (~> 0.3.0)
|
48
|
+
rake (11.2.2)
|
49
|
+
rspec (3.5.0)
|
50
|
+
rspec-core (~> 3.5.0)
|
51
|
+
rspec-expectations (~> 3.5.0)
|
52
|
+
rspec-mocks (~> 3.5.0)
|
53
|
+
rspec-core (3.5.2)
|
54
|
+
rspec-support (~> 3.5.0)
|
55
|
+
rspec-expectations (3.5.0)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.5.0)
|
58
|
+
rspec-mocks (3.5.0)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.5.0)
|
61
|
+
rspec-support (3.5.0)
|
62
|
+
thread_safe (0.3.5)
|
63
|
+
tzinfo (1.2.2)
|
64
|
+
thread_safe (~> 0.1)
|
65
|
+
|
66
|
+
PLATFORMS
|
67
|
+
ruby
|
68
|
+
|
69
|
+
DEPENDENCIES
|
70
|
+
bundler
|
71
|
+
mongoid-paperclip!
|
72
|
+
rake
|
73
|
+
rspec
|
74
|
+
|
75
|
+
BUNDLED WITH
|
76
|
+
1.12.5
|
data/README.md
CHANGED
@@ -84,6 +84,16 @@ end
|
|
84
84
|
@user.update_attributes({ ... :pictures => [...] })
|
85
85
|
```
|
86
86
|
|
87
|
+
## Testing
|
88
|
+
|
89
|
+
If you want to help develop this plugin, clone the repo and bundle to get all dependencies.
|
90
|
+
|
91
|
+
Then to run the tests:
|
92
|
+
|
93
|
+
```
|
94
|
+
rspec
|
95
|
+
```
|
96
|
+
|
87
97
|
## There you go
|
88
98
|
|
89
99
|
Quite a lot of people have been looking for a solution to use Paperclip with Mongoid so I hope this helps!
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'mongoid_paperclip'
|
data/lib/mongoid_paperclip.rb
CHANGED
data/mongoid-paperclip.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
|
5
5
|
gem.name = 'mongoid-paperclip'
|
6
|
-
gem.version = '0.0.
|
6
|
+
gem.version = '0.0.11'
|
7
7
|
gem.platform = Gem::Platform::RUBY
|
8
8
|
gem.authors = 'Michael van Rooijen'
|
9
9
|
gem.email = 'michael@vanrooijen.io'
|
@@ -16,5 +16,10 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = %x[git ls-files -- {spec}/*].split("\n")
|
17
17
|
gem.require_path = 'lib'
|
18
18
|
|
19
|
+
gem.add_dependency 'mongoid'
|
19
20
|
gem.add_dependency 'paperclip', ['>= 2.3.6', '!=4.3.0']
|
21
|
+
|
22
|
+
gem.add_development_dependency 'bundler'
|
23
|
+
gem.add_development_dependency 'rake'
|
24
|
+
gem.add_development_dependency 'rspec'
|
20
25
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Mongoid::Paperclip, type: :unit do
|
4
|
+
describe "avatar" do
|
5
|
+
let(:user) { User.create }
|
6
|
+
|
7
|
+
before do
|
8
|
+
user.update avatar: File.new('spec/support/avatar.png', 'rb')
|
9
|
+
end
|
10
|
+
|
11
|
+
it "stores file_name" do
|
12
|
+
expect(user.avatar_file_name).to eq("avatar.png")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "stores content_type" do
|
16
|
+
expect(user.avatar_content_type).to eq("image/png")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "stores file_size" do
|
20
|
+
expect(user.avatar_file_size).to eq(357)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "stores updated_at" do
|
24
|
+
expect(user.avatar_updated_at).to be_present
|
25
|
+
end
|
26
|
+
|
27
|
+
it "stores fingerprint" do
|
28
|
+
expect(user.avatar_fingerprint).to eq("2584a801e588b3fcf4aa074efff77e30")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "multiple attachments" do
|
33
|
+
let(:user) { MultipleAttachments.create }
|
34
|
+
|
35
|
+
it "works" do
|
36
|
+
user.update avatar: File.new('spec/support/avatar.png', 'rb'), icon: File.new('spec/support/avatar.png', 'rb')
|
37
|
+
expect(user.avatar_file_name).to eq("avatar.png")
|
38
|
+
expect(user.icon_file_name).to eq("avatar.png")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'mongoid'
|
3
|
+
require 'mongoid-paperclip'
|
4
|
+
|
5
|
+
ENV['MONGOID_ENV'] = 'test'
|
6
|
+
Mongoid.load!('./spec/config/mongoid.yml')
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.before(:each) do
|
10
|
+
Mongoid.purge!
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class User
|
15
|
+
include Mongoid::Document
|
16
|
+
include Mongoid::Paperclip
|
17
|
+
|
18
|
+
has_mongoid_attached_file :avatar
|
19
|
+
validates_attachment_file_name :avatar, matches: [/image/]
|
20
|
+
end
|
21
|
+
|
22
|
+
class MultipleAttachments
|
23
|
+
include Mongoid::Document
|
24
|
+
include Mongoid::Paperclip
|
25
|
+
|
26
|
+
has_mongoid_attached_file :avatar
|
27
|
+
validates_attachment_file_name :avatar, matches: [/image/]
|
28
|
+
|
29
|
+
has_mongoid_attached_file :icon
|
30
|
+
validates_attachment_file_name :avatar, matches: [/image/]
|
31
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van Rooijen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mongoid
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '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'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: paperclip
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,6 +44,48 @@ dependencies:
|
|
30
44
|
- - "!="
|
31
45
|
- !ruby/object:Gem::Version
|
32
46
|
version: 4.3.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
33
89
|
description: Enables you to use Paperclip with the Mongoid ODM for MongoDB.
|
34
90
|
email: michael@vanrooijen.io
|
35
91
|
executables: []
|
@@ -37,11 +93,19 @@ extensions: []
|
|
37
93
|
extra_rdoc_files: []
|
38
94
|
files:
|
39
95
|
- ".gitignore"
|
96
|
+
- ".rspec"
|
97
|
+
- Gemfile
|
98
|
+
- Gemfile.lock
|
40
99
|
- LICENSE
|
41
100
|
- README.md
|
42
101
|
- Rakefile
|
102
|
+
- lib/mongoid-paperclip.rb
|
43
103
|
- lib/mongoid_paperclip.rb
|
44
104
|
- mongoid-paperclip.gemspec
|
105
|
+
- spec/config/mongoid.yml
|
106
|
+
- spec/mongoid-paperclip_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- spec/support/avatar.png
|
45
109
|
homepage: https://github.com/meskyanichi/mongoid-paperclip
|
46
110
|
licenses:
|
47
111
|
- MIT
|
@@ -62,8 +126,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
126
|
version: '0'
|
63
127
|
requirements: []
|
64
128
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.5.1
|
66
130
|
signing_key:
|
67
131
|
specification_version: 4
|
68
132
|
summary: Paperclip compatibility for Mongoid ODM for MongoDB.
|
69
133
|
test_files: []
|
134
|
+
has_rdoc:
|