joint 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/joint.rb +3 -2
- data/lib/joint/version.rb +1 -1
- data/test/test_joint.rb +6 -6
- metadata +13 -13
data/Rakefile
CHANGED
@@ -18,12 +18,12 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
|
19
19
|
gem.add_dependency 'wand', '>= 0.2.1'
|
20
20
|
gem.add_dependency 'mime-types'
|
21
|
+
gem.add_dependency 'mongo_mapper', '>= 0.7.4'
|
21
22
|
|
22
23
|
gem.add_development_dependency 'jeweler'
|
23
24
|
gem.add_development_dependency 'shoulda'
|
24
25
|
gem.add_development_dependency 'mocha'
|
25
26
|
gem.add_development_dependency 'jnunemaker-matchy'
|
26
|
-
gem.add_development_dependency 'mongo_mapper', '>= 0.7.2'
|
27
27
|
end
|
28
28
|
Jeweler::GemcutterTasks.new
|
29
29
|
|
data/lib/joint.rb
CHANGED
@@ -36,7 +36,7 @@ module Joint
|
|
36
36
|
if file.nil?
|
37
37
|
nil_attachments << :#{name}
|
38
38
|
else
|
39
|
-
self["#{name}_id"] =
|
39
|
+
self["#{name}_id"] = BSON::ObjectID.new if self["#{name}_id"].nil?
|
40
40
|
self["#{name}_size"] = File.size(file)
|
41
41
|
self["#{name}_type"] = Wand.wave(file.path)
|
42
42
|
self["#{name}_name"] = Joint.file_name(file)
|
@@ -67,8 +67,9 @@ module Joint
|
|
67
67
|
next unless io.respond_to?(:read)
|
68
68
|
io.rewind if io.respond_to?(:rewind)
|
69
69
|
grid.delete(send(name).id)
|
70
|
-
grid.put(io.read,
|
70
|
+
grid.put(io.read, {
|
71
71
|
:_id => send(name).id,
|
72
|
+
:filename => send(name).name,
|
72
73
|
:content_type => send(name).type,
|
73
74
|
})
|
74
75
|
end
|
data/lib/joint/version.rb
CHANGED
data/test/test_joint.rb
CHANGED
@@ -112,8 +112,8 @@ class JointTest < Test::Unit::TestCase
|
|
112
112
|
subject.image_id.should_not be_nil
|
113
113
|
subject.file_id.should_not be_nil
|
114
114
|
|
115
|
-
subject.image_id.should be_instance_of(
|
116
|
-
subject.file_id.should be_instance_of(
|
115
|
+
subject.image_id.should be_instance_of(BSON::ObjectID)
|
116
|
+
subject.file_id.should be_instance_of(BSON::ObjectID)
|
117
117
|
end
|
118
118
|
|
119
119
|
should "allow accessing keys through attachment proxy" do
|
@@ -126,8 +126,8 @@ class JointTest < Test::Unit::TestCase
|
|
126
126
|
subject.image.id.should_not be_nil
|
127
127
|
subject.file.id.should_not be_nil
|
128
128
|
|
129
|
-
subject.image.id.should be_instance_of(
|
130
|
-
subject.file.id.should be_instance_of(
|
129
|
+
subject.image.id.should be_instance_of(BSON::ObjectID)
|
130
|
+
subject.file.id.should be_instance_of(BSON::ObjectID)
|
131
131
|
end
|
132
132
|
|
133
133
|
should "proxy unknown methods to GridIO object" do
|
@@ -251,8 +251,8 @@ class JointTest < Test::Unit::TestCase
|
|
251
251
|
subject.image?.should be(false)
|
252
252
|
end
|
253
253
|
|
254
|
-
should "raise Mongo::
|
255
|
-
assert_raises(Mongo::
|
254
|
+
should "raise Mongo::GridFileNotFound" do
|
255
|
+
assert_raises(Mongo::GridFileNotFound) { subject.image.read }
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Nunemaker
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-18 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
type: :runtime
|
45
45
|
version_requirements: *id002
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: mongo_mapper
|
48
48
|
prerelease: false
|
49
49
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
@@ -52,11 +52,13 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
|
56
|
-
|
55
|
+
- 7
|
56
|
+
- 4
|
57
|
+
version: 0.7.4
|
58
|
+
type: :runtime
|
57
59
|
version_requirements: *id003
|
58
60
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
61
|
+
name: jeweler
|
60
62
|
prerelease: false
|
61
63
|
requirement: &id004 !ruby/object:Gem::Requirement
|
62
64
|
requirements:
|
@@ -68,7 +70,7 @@ dependencies:
|
|
68
70
|
type: :development
|
69
71
|
version_requirements: *id004
|
70
72
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
73
|
+
name: shoulda
|
72
74
|
prerelease: false
|
73
75
|
requirement: &id005 !ruby/object:Gem::Requirement
|
74
76
|
requirements:
|
@@ -80,7 +82,7 @@ dependencies:
|
|
80
82
|
type: :development
|
81
83
|
version_requirements: *id005
|
82
84
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
85
|
+
name: mocha
|
84
86
|
prerelease: false
|
85
87
|
requirement: &id006 !ruby/object:Gem::Requirement
|
86
88
|
requirements:
|
@@ -92,7 +94,7 @@ dependencies:
|
|
92
94
|
type: :development
|
93
95
|
version_requirements: *id006
|
94
96
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
97
|
+
name: jnunemaker-matchy
|
96
98
|
prerelease: false
|
97
99
|
requirement: &id007 !ruby/object:Gem::Requirement
|
98
100
|
requirements:
|
@@ -100,9 +102,7 @@ dependencies:
|
|
100
102
|
- !ruby/object:Gem::Version
|
101
103
|
segments:
|
102
104
|
- 0
|
103
|
-
|
104
|
-
- 2
|
105
|
-
version: 0.7.2
|
105
|
+
version: "0"
|
106
106
|
type: :development
|
107
107
|
version_requirements: *id007
|
108
108
|
description: MongoMapper and GridFS joined in file upload love.
|