scale_down 0.2.3.2 → 0.2.9

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/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ == 2011-09-13 ==
2
+ Ruby 1.9.2 tested
3
+
1
4
  == 2011-05-17 ==
2
5
  Fixed a bug where images would get oriented when they should not
3
6
  Adjusted the colorspacing code a bit
@@ -1,3 +1,3 @@
1
1
  module ScaleDown
2
- VERSION = "0.2.3.2"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -10,23 +10,23 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  teardown do
13
- FileUtils.rm_r(tests_path("scaled_test")) if File.directory?(tests_path('scaled_test'))
13
+ FileUtils.rm_r(fixture_path("scaled_test")) if File.directory?(fixture_path('scaled_test'))
14
14
  end
15
15
 
16
16
  context "scaling a valid image" do
17
17
  setup do
18
18
  @subject = create \
19
- tests_path("files/graphic.png"),
20
- tests_path("scaled_test/graphic_scaled.png"),
19
+ fixture_path("files/graphic.png"),
20
+ fixture_path("scaled_test/graphic_scaled.png"),
21
21
  { :width => 100, :height => 180}
22
22
  end
23
23
 
24
24
  should "save the file (and generate the path)" do
25
- assert File.exists?(tests_path('scaled_test/graphic_scaled.png'))
25
+ assert File.exists?(fixture_path('scaled_test/graphic_scaled.png'))
26
26
  end
27
27
 
28
28
  should "scale the image" do
29
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.png")).first
29
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.png")).first
30
30
  assert_equal 90, image.columns
31
31
  assert_equal 180, image.rows
32
32
  end
@@ -45,11 +45,11 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
45
45
 
46
46
  should "auto scale any one dimensions" do
47
47
  assert create \
48
- tests_path("files/graphic.png"),
49
- tests_path("scaled_test/graphic_scaled.png"),
48
+ fixture_path("files/graphic.png"),
49
+ fixture_path("scaled_test/graphic_scaled.png"),
50
50
  { :width => "auto", :height => 150 }
51
51
 
52
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.png")).first
52
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.png")).first
53
53
  assert_equal 150, image.rows
54
54
  assert_equal 75, image.columns
55
55
  end
@@ -76,8 +76,8 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
76
76
  context "an invalid file" do
77
77
  setup do
78
78
  @subject = create \
79
- tests_path("files/invalid_jpeg.jpg"),
80
- tests_path("scaled_test/graphic_scaled.jpg"),
79
+ fixture_path("files/invalid_jpeg.jpg"),
80
+ fixture_path("scaled_test/graphic_scaled.jpg"),
81
81
  { :width => 100, :height => 105 }
82
82
  end
83
83
 
@@ -86,20 +86,20 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
86
86
  end
87
87
 
88
88
  should "not create a scaled image" do
89
- assert !File.exists?(tests_path("scaled_test/graphic_scaled.jpg"))
89
+ assert !File.exists?(fixture_path("scaled_test/graphic_scaled.jpg"))
90
90
  end
91
91
  end
92
92
 
93
93
  context "a file larger than the MAX_SIZE" do
94
94
  setup do
95
- File.expects(:size).with(tests_path("files/graphic.png")).at_least_once.returns(50 * 1_048_576)
95
+ File.expects(:size).with(fixture_path("files/graphic.png")).at_least_once.returns(50 * 1_048_576)
96
96
  end
97
97
 
98
98
  should "raise an exception" do
99
99
  assert_raises ScaleDown::FileSizeTooLarge do
100
100
  @subject = create \
101
- tests_path("files/graphic.png"),
102
- tests_path("scaled_test/graphic_scaled.png"),
101
+ fixture_path("files/graphic.png"),
102
+ fixture_path("scaled_test/graphic_scaled.png"),
103
103
  { :width => 100, :height => 105 }
104
104
  end
105
105
  end
@@ -108,13 +108,13 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
108
108
  context "cropping" do
109
109
  setup do
110
110
  @subject = create \
111
- tests_path("files/graphic.png"),
112
- tests_path("scaled_test/graphic_scaled.png"),
111
+ fixture_path("files/graphic.png"),
112
+ fixture_path("scaled_test/graphic_scaled.png"),
113
113
  { :width => 25, :height => 25, :crop => true }
114
114
  end
115
115
 
116
116
  should "crop the image to the dimensions" do
117
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.png")).first
117
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.png")).first
118
118
  assert_equal 25, image.columns
119
119
  assert_equal 25, image.rows
120
120
  end
@@ -123,24 +123,24 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
123
123
  context "orientation" do
124
124
  setup do
125
125
  @subject = create \
126
- tests_path("files/orient.jpg"),
127
- tests_path("scaled_test/graphic_scaled.jpg"),
126
+ fixture_path("files/orient.jpg"),
127
+ fixture_path("scaled_test/graphic_scaled.jpg"),
128
128
  { :width => "auto", :height => 800}
129
129
  end
130
130
 
131
131
  should "be automatic" do
132
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.jpg")).first
132
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.jpg")).first
133
133
  assert_equal 600, image.columns
134
134
  assert_equal 800, image.rows
135
135
  end
136
136
 
137
137
  should "ignore files without orientation EXIF" do
138
138
  @subject = create \
139
- tests_path("files/no_orient.tif"),
140
- tests_path("scaled_test/graphic_scaled.jpg"),
139
+ fixture_path("files/no_orient.tif"),
140
+ fixture_path("scaled_test/graphic_scaled.jpg"),
141
141
  { :width => "auto", :height => 424}
142
142
 
143
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.jpg")).first
143
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.jpg")).first
144
144
  assert_equal 330, image.columns
145
145
  assert_equal 424, image.rows
146
146
  end
@@ -149,21 +149,21 @@ class ScaleDown::Image::Test < Test::Unit::TestCase
149
149
  context "CMYK images" do
150
150
  should "be converted to RGB" do
151
151
  create \
152
- tests_path("files/cmyk.tif"),
153
- tests_path("scaled_test/graphic_scaled.jpg"),
152
+ fixture_path("files/cmyk.tif"),
153
+ fixture_path("scaled_test/graphic_scaled.jpg"),
154
154
  { :width => "auto", :height => 200}
155
155
 
156
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled.jpg")).first
156
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled.jpg")).first
157
157
  assert_equal Magick::RGBColorspace, image.colorspace
158
158
  end
159
159
 
160
160
  should "convert JPGs to RGB JPEGS" do
161
161
  create \
162
- tests_path("files/cmyk_gray.jpg"),
163
- tests_path("scaled_test/graphic_scaled_2.jpg"),
162
+ fixture_path("files/cmyk_gray.jpg"),
163
+ fixture_path("scaled_test/graphic_scaled_2.jpg"),
164
164
  { :width => "auto", :height => 200}
165
165
 
166
- image = Magick::Image.read(tests_path("scaled_test/graphic_scaled_2.jpg")).first
166
+ image = Magick::Image.read(fixture_path("scaled_test/graphic_scaled_2.jpg")).first
167
167
  assert_equal Magick::RGBColorspace, image.colorspace
168
168
  end
169
169
  end
@@ -43,9 +43,9 @@ class ScaleDown::Test < Test::Unit::TestCase
43
43
  context "integration test" do
44
44
  setup do
45
45
  FileUtils.mkdir_p("/tmp/scale_down/test_images/example_1")
46
- FileUtils.cp tests_path("files/graphic.png"), "/tmp/scale_down/test_images/example_1/graphic.png"
46
+ FileUtils.cp fixture_path("files/graphic.png"), "/tmp/scale_down/test_images/example_1/graphic.png"
47
47
  FileUtils.mkdir_p("/tmp/scale_down/test_images/example_2")
48
- FileUtils.cp tests_path("files/invalid_jpeg.jpg"), "/tmp/scale_down/test_images/example_2/invalid_jpeg.jpg"
48
+ FileUtils.cp fixture_path("files/invalid_jpeg.jpg"), "/tmp/scale_down/test_images/example_2/invalid_jpeg.jpg"
49
49
  end
50
50
 
51
51
  teardown do
@@ -53,7 +53,7 @@ class ScaleDown::Test < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  should "get image info" do
56
- FileUtils.cp tests_path("files/cmyk.tif"), "/tmp/scale_down/test_images/example_1/long name .tiff"
56
+ FileUtils.cp fixture_path("files/cmyk.tif"), "/tmp/scale_down/test_images/example_1/long name .tiff"
57
57
  get "/test_images/example_1/#{CGI.escape 'long name .tiff'}/info"
58
58
  assert_equal "300x500", last_response.body
59
59
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'lib/scale_down'
1
+ require 'scale_down'
2
2
  require 'rack/test'
3
3
  require 'contest'
4
4
  require 'mocha'
@@ -14,7 +14,7 @@ class Test::Unit::TestCase
14
14
  hmac = HMAC::SHA1.new(secret).update(path).to_s
15
15
  end
16
16
 
17
- def tests_path(append)
17
+ def fixture_path(append)
18
18
  File.join(File.expand_path(File.dirname(__FILE__)), append)
19
19
  end
20
20
 
metadata CHANGED
@@ -1,14 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scale_down
3
3
  version: !ruby/object:Gem::Version
4
- hash: 87
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 3
10
- - 2
11
- version: 0.2.3.2
5
+ version: 0.2.9
12
6
  platform: ruby
13
7
  authors:
14
8
  - John Weir
@@ -16,7 +10,7 @@ autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
12
 
19
- date: 2011-05-18 00:00:00 -04:00
13
+ date: 2011-08-13 00:00:00 -04:00
20
14
  default_executable:
21
15
  dependencies:
22
16
  - !ruby/object:Gem::Dependency
@@ -27,10 +21,6 @@ dependencies:
27
21
  requirements:
28
22
  - - ">="
29
23
  - !ruby/object:Gem::Version
30
- hash: 1
31
- segments:
32
- - 2
33
- - 1
34
24
  version: "2.1"
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,10 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 15
46
- segments:
47
- - 1
48
- - 0
49
35
  version: "1.0"
50
36
  type: :runtime
51
37
  version_requirements: *id002
@@ -57,11 +43,6 @@ dependencies:
57
43
  requirements:
58
44
  - - ">="
59
45
  - !ruby/object:Gem::Version
60
- hash: 15
61
- segments:
62
- - 0
63
- - 4
64
- - 0
65
46
  version: 0.4.0
66
47
  type: :runtime
67
48
  version_requirements: *id003
@@ -73,11 +54,6 @@ dependencies:
73
54
  requirements:
74
55
  - - ">="
75
56
  - !ruby/object:Gem::Version
76
- hash: 31
77
- segments:
78
- - 0
79
- - 1
80
- - 2
81
57
  version: 0.1.2
82
58
  type: :development
83
59
  version_requirements: *id004
@@ -89,11 +65,6 @@ dependencies:
89
65
  requirements:
90
66
  - - "="
91
67
  - !ruby/object:Gem::Version
92
- hash: 43
93
- segments:
94
- - 0
95
- - 9
96
- - 8
97
68
  version: 0.9.8
98
69
  type: :development
99
70
  version_requirements: *id005
@@ -105,11 +76,6 @@ dependencies:
105
76
  requirements:
106
77
  - - "="
107
78
  - !ruby/object:Gem::Version
108
- hash: 7
109
- segments:
110
- - 0
111
- - 5
112
- - 6
113
79
  version: 0.5.6
114
80
  type: :development
115
81
  version_requirements: *id006
@@ -166,23 +132,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
132
  requirements:
167
133
  - - ">="
168
134
  - !ruby/object:Gem::Version
169
- hash: 3
170
- segments:
171
- - 0
172
135
  version: "0"
173
136
  required_rubygems_version: !ruby/object:Gem::Requirement
174
137
  none: false
175
138
  requirements:
176
139
  - - ">="
177
140
  - !ruby/object:Gem::Version
178
- hash: 3
179
- segments:
180
- - 0
181
141
  version: "0"
182
142
  requirements: []
183
143
 
184
144
  rubyforge_project: scale_down
185
- rubygems_version: 1.4.2
145
+ rubygems_version: 1.5.2
186
146
  signing_key:
187
147
  specification_version: 3
188
148
  summary: A Sinatra based server for quickly scaling and serving images. Nothing more.