imagery 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "imagery"
3
- s.version = "0.2.1"
3
+ s.version = "0.2.2"
4
4
  s.summary = "POROS + GraphicsMagick."
5
5
  s.description = "Provide a clean and light interface around GraphicsMagick."
6
6
  s.authors = ["Cyril David"]
@@ -2,7 +2,7 @@ require "fileutils"
2
2
  require "tempfile"
3
3
 
4
4
  class Imagery
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
 
7
7
  autoload :S3, "imagery/s3"
8
8
  autoload :Faking, "imagery/faking"
@@ -145,7 +145,7 @@ class Imagery
145
145
  end
146
146
 
147
147
  def self.identify(io)
148
- file = Tempfile.new("imagery")
148
+ file = Tempfile.new(["imagery", ".jpg"])
149
149
 
150
150
  # Something poorly documented, but vastly important: we need to
151
151
  # make sure the file is in binary mode.
@@ -154,8 +154,9 @@ class Imagery
154
154
  # Now we can safely write the file knowing that we're operating in
155
155
  # binary mode.
156
156
  file.write(io.read)
157
+ file.close
157
158
 
158
- `gm identify #{io.path} 2> /dev/null`
159
+ `gm identify #{file.path} 2> /dev/null`
159
160
 
160
161
  return $?.success?
161
162
  ensure
@@ -163,7 +164,7 @@ class Imagery
163
164
  io.rewind
164
165
 
165
166
  # Tempfile quickly runs out of names, so best to avoid that.
166
- file.close!
167
+ file.unlink
167
168
  end
168
169
 
169
170
  # Return the cleaned dimension representation minus the
@@ -81,6 +81,9 @@ scope do
81
81
  test "saving with an already existing image" do |im, io|
82
82
  im.save(io)
83
83
 
84
+ # Kind of irregular, but we need to rewind this.
85
+ io.rewind
86
+
84
87
  assert im.save(io, "GUID")
85
88
  assert File.exist?(Imagery.root("avatar/GUID/original.jpg"))
86
89
  assert ! File.exist?(Imagery.root("avatar/1001/original.jpg"))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: imagery
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cyril David
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-23 00:00:00 +08:00
13
+ date: 2011-06-24 00:00:00 +08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16