imagery 0.2.1 → 0.2.2
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.
- data/imagery.gemspec +1 -1
- data/lib/imagery.rb +5 -4
- data/test/imagery.rb +3 -0
- metadata +2 -2
data/imagery.gemspec
CHANGED
data/lib/imagery.rb
CHANGED
@@ -2,7 +2,7 @@ require "fileutils"
|
|
2
2
|
require "tempfile"
|
3
3
|
|
4
4
|
class Imagery
|
5
|
-
VERSION = "0.2.
|
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 #{
|
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.
|
167
|
+
file.unlink
|
167
168
|
end
|
168
169
|
|
169
170
|
# Return the cleaned dimension representation minus the
|
data/test/imagery.rb
CHANGED
@@ -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.
|
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-
|
13
|
+
date: 2011-06-24 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|