jonbell-grip 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ begin
15
15
  gem.version = Grip::Version
16
16
 
17
17
  gem.add_dependency 'wand', '>= 0.2.1'
18
- gem.add_development_dependency 'mongo_mapper', '0.7.1'
18
+ gem.add_development_dependency 'mongo_mapper', '0.7.4'
19
19
  gem.add_development_dependency 'shoulda'
20
20
  end
21
21
  Jeweler::GemcutterTasks.new
data/jonbell-grip.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jonbell-grip}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Nunemaker", "Jonathan Bell"]
12
- s.date = %q{2010-03-25}
12
+ s.date = %q{2010-04-19}
13
13
  s.description = %q{Attachment plugin for MongoMapper that uses GridFS.}
14
14
  s.email = %q{nunemaker@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -48,16 +48,16 @@ Gem::Specification.new do |s|
48
48
 
49
49
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
50
  s.add_runtime_dependency(%q<wand>, [">= 0.2.1"])
51
- s.add_development_dependency(%q<mongo_mapper>, ["= 0.7.1"])
51
+ s.add_development_dependency(%q<mongo_mapper>, ["= 0.7.4"])
52
52
  s.add_development_dependency(%q<shoulda>, [">= 0"])
53
53
  else
54
54
  s.add_dependency(%q<wand>, [">= 0.2.1"])
55
- s.add_dependency(%q<mongo_mapper>, ["= 0.7.1"])
55
+ s.add_dependency(%q<mongo_mapper>, ["= 0.7.4"])
56
56
  s.add_dependency(%q<shoulda>, [">= 0"])
57
57
  end
58
58
  else
59
59
  s.add_dependency(%q<wand>, [">= 0.2.1"])
60
- s.add_dependency(%q<mongo_mapper>, ["= 0.7.1"])
60
+ s.add_dependency(%q<mongo_mapper>, ["= 0.7.4"])
61
61
  s.add_dependency(%q<shoulda>, [">= 0"])
62
62
  end
63
63
  end
data/lib/grip.rb CHANGED
@@ -20,7 +20,7 @@ module Grip
20
20
  end
21
21
 
22
22
  define_method("#{name}=") do |file|
23
- self["#{name}_id"] = Mongo::ObjectID.new
23
+ self["#{name}_id"] = BSON::ObjectID.new
24
24
  self["#{name}_size"] = File.size(file)
25
25
  self["#{name}_type"] = Wand.wave(file.path)
26
26
  self["#{name}_name"] = if file.respond_to?(:original_filename)
@@ -53,7 +53,7 @@ module Grip
53
53
  content_type = self["#{name}_type"]
54
54
 
55
55
  if file.respond_to?(:read)
56
- self.class.grid.put(file.read, self["#{name}_name"], :content_type => content_type, :_id => self["#{name}_id"])
56
+ self.class.grid.put(file.read, :filename => self["#{name}_name"], :content_type => content_type, :_id => self["#{name}_id"])
57
57
  end
58
58
  end
59
59
  end
data/lib/grip/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Grip
2
- Version = '0.1.1'
2
+ Version = '0.1.2'
3
3
  end
data/test/test_grip.rb CHANGED
@@ -51,9 +51,9 @@ class GripTest < Test::Unit::TestCase
51
51
  assert_not_nil @doc.image_id
52
52
  assert_not_nil @doc.pdf_id
53
53
  assert_not_nil embedded_doc.file_id
54
- assert_kind_of Mongo::ObjectID, @doc.image_id
55
- assert_kind_of Mongo::ObjectID, @doc.pdf_id
56
- assert_kind_of Mongo::ObjectID, embedded_doc.file_id
54
+ assert_kind_of BSON::ObjectID, @doc.image_id
55
+ assert_kind_of BSON::ObjectID, @doc.pdf_id
56
+ assert_kind_of BSON::ObjectID, embedded_doc.file_id
57
57
 
58
58
  assert_equal "image/png", @grid.get(@doc.image_id).content_type
59
59
  assert_equal "application/pdf", @grid.get(@doc.pdf_id).content_type
@@ -96,9 +96,9 @@ class GripTest < Test::Unit::TestCase
96
96
 
97
97
  test "cleans up attachments on destroy" do
98
98
  @doc.destroy
99
- assert_raises(Mongo::GridError) { @grid.get(@doc.image_id) }
100
- assert_raises(Mongo::GridError) { @grid.get(@doc.pdf_id) }
101
- assert_raises(Mongo::GridError) { @grid.get(embedded_doc.file_id) }
99
+ assert_raises(Mongo::GridFileNotFound) { @grid.get(@doc.image_id) }
100
+ assert_raises(Mongo::GridFileNotFound) { @grid.get(@doc.pdf_id) }
101
+ assert_raises(Mongo::GridFileNotFound) { @grid.get(embedded_doc.file_id) }
102
102
  end
103
103
 
104
104
  def embedded_doc
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Nunemaker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-25 00:00:00 -05:00
18
+ date: 2010-04-19 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,8 +42,8 @@ dependencies:
42
42
  segments:
43
43
  - 0
44
44
  - 7
45
- - 1
46
- version: 0.7.1
45
+ - 4
46
+ version: 0.7.4
47
47
  type: :development
48
48
  version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency