scale_down 0.5.3 → 0.6.0

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/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  pkg/*
2
3
  *.gem
3
4
  .bundle
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 2011-12-09 ==
2
+ Version 0.6.0
3
+ public_path is renamed public_folder
4
+ bug fixes
5
+
1
6
  == 2011-12-09 ==
2
7
  Version 0.5.1
3
8
  Fix for non PNG/JPG images. Redirect to the JPG version.
data/README.rdoc CHANGED
@@ -100,7 +100,7 @@ Create a Rackup file (config.ru). See https://github.com/jweir/ScaleDown/tree/ma
100
100
  config.hmac_key = "secret"
101
101
 
102
102
  # Path to the public directory
103
- config.public_path = File.expand_path(File.dirname(__FILE__))+"/public"
103
+ config.public_folder = File.expand_path(File.dirname(__FILE__))+"/public"
104
104
  end
105
105
 
106
106
  run ScaleDown::Controller
@@ -29,11 +29,11 @@ module ScaleDown
29
29
 
30
30
  # The location of the public path for you application
31
31
  # +Must be set+
32
- attr_accessor :public_path
32
+ attr_accessor :public_folder
33
33
 
34
- def public_path=(str)
35
- @public_path = str
36
- ScaleDown::Controller.public = str
34
+ def public_folder=(str)
35
+ @public_folder = str
36
+ ScaleDown::Controller.public_folder = str
37
37
  end
38
38
 
39
39
  def logger=(logger)
@@ -21,7 +21,7 @@ class ScaleDown::Dispatcher
21
21
 
22
22
  # TODO return a JSON response with a full set of image details
23
23
  def info(relative_path)
24
- path = [ScaleDown.public_path, relative_path].join("/")
24
+ path = [ScaleDown.public_folder, relative_path].join("/")
25
25
  if File.exists?(path)
26
26
  GC.start
27
27
  image = Magick::Image.read(path).first
@@ -73,11 +73,11 @@ class ScaleDown::Dispatcher
73
73
 
74
74
  def root_path
75
75
  root = @params[:path].gsub(/\/scaled$/,"")
76
- File.join(ScaleDown.public_path, root, @params[:filename])
76
+ File.join(ScaleDown.public_folder, root, @params[:filename])
77
77
  end
78
78
 
79
79
  def scaled_file_path
80
- File.join(ScaleDown.public_path, redirect_path)
80
+ File.join(ScaleDown.public_folder, redirect_path)
81
81
  end
82
82
 
83
83
  def scaled_filename
@@ -41,9 +41,8 @@ class ScaleDown::Image
41
41
  def initialize(properties = {})
42
42
  load_file(properties[:file]) do |file|
43
43
  resize(file, properties[:options])
44
- fix_color_space(file)
45
-
46
- @valid = write(file, properties[:out])
44
+ corrected = fix_color_space(file)
45
+ @valid = write(corrected, properties[:out])
47
46
  end
48
47
  end
49
48
 
@@ -72,7 +71,9 @@ class ScaleDown::Image
72
71
  def fix_color_space(file)
73
72
  if file.colorspace == Magick::CMYKColorspace
74
73
  file.add_profile "#{File.expand_path(File.dirname(__FILE__))}/../../color_profiles/sRGB.icm"
75
- file = file.quantize 2**24, Magick::RGBColorspace
74
+ file.quantize 2**24, Magick::RGBColorspace
75
+ else
76
+ file
76
77
  end
77
78
  end
78
79
 
@@ -1,3 +1,3 @@
1
1
  module ScaleDown
2
- VERSION = "0.5.3"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -3,10 +3,10 @@ require File.expand_path(File.dirname(__FILE__))+'/../test_helper'
3
3
  class ScaleDown::Test < Test::Unit::TestCase
4
4
 
5
5
  context "Configuration" do
6
- context "public_path" do
6
+ context "public_folder" do
7
7
  should "set the controller's public setting" do
8
- ScaleDown.public_path = "/tmp/directory"
9
- assert_equal "/tmp/directory", ScaleDown::Controller.public
8
+ ScaleDown.public_folder = "/tmp/directory"
9
+ assert_equal "/tmp/directory", ScaleDown::Controller.public_folder
10
10
  end
11
11
  end
12
12
  end
@@ -7,7 +7,7 @@ class ScaleDown::Dispatcher::Test < Test::Unit::TestCase
7
7
  ScaleDown.hmac_key = "secret"
8
8
  ScaleDown.hmac_method = HMAC::SHA1
9
9
  ScaleDown.hmac_length = 8
10
- ScaleDown.public_path = "/tmp"
10
+ ScaleDown.public_folder = "/tmp"
11
11
 
12
12
  hmac = HMAC::SHA1.new("secret").update("file/path/400x300-crop/filename.png").to_s
13
13
 
@@ -143,7 +143,7 @@ class ScaleDown::Dispatcher::Test < Test::Unit::TestCase
143
143
 
144
144
  context "#info" do
145
145
  setup do
146
- ScaleDown.public_path = File.join(File.expand_path(File.dirname(__FILE__)), "..")
146
+ ScaleDown.public_folder = File.join(File.expand_path(File.dirname(__FILE__)), "..")
147
147
  end
148
148
 
149
149
  should "return the width x height for an image" do
@@ -16,7 +16,7 @@ class ScaleDown::Test < Test::Unit::TestCase
16
16
  ScaleDown.hmac_key = "secret"
17
17
  ScaleDown.hmac_method = HMAC::SHA1
18
18
  ScaleDown.hmac_length = 8
19
- ScaleDown.public_path = "/tmp/scale_down"
19
+ ScaleDown.public_folder = "/tmp/scale_down"
20
20
  end
21
21
 
22
22
  context "HMAC" do
@@ -53,8 +53,8 @@ class ScaleDown::Test < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  should "get image info" do
56
- FileUtils.cp fixture_path("files/cmyk.tif"), "/tmp/scale_down/test_images/example_1/long name .tiff"
57
- get "/test_images/example_1/#{CGI.escape 'long name .tiff'}/info"
56
+ FileUtils.cp fixture_path("files/cmyk.tif"), "/tmp/scale_down/test_images/example_1/long-name.tiff"
57
+ get "/test_images/example_1/#{CGI.escape 'long-name.tiff'}/info"
58
58
  assert_equal "300x500", last_response.body
59
59
  end
60
60
 
@@ -13,7 +13,7 @@ class ScaleDown::Test < Test::Unit::TestCase
13
13
  ScaleDown.hmac_key = "secret"
14
14
  ScaleDown.hmac_method = HMAC::SHA1
15
15
  ScaleDown.hmac_length = 8
16
- ScaleDown.public_path = "/tmp"
16
+ ScaleDown.public_folder = "/tmp"
17
17
  end
18
18
 
19
19
  should "create a URL with the HMAC signature" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scale_down
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-15 00:00:00.000000000Z
12
+ date: 2012-01-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &2153528900 !ruby/object:Gem::Requirement
16
+ requirement: &2164341720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153528900
24
+ version_requirements: *2164341720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &2153528400 !ruby/object:Gem::Requirement
27
+ requirement: &2164341220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153528400
35
+ version_requirements: *2164341220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-hmac
38
- requirement: &2153527940 !ruby/object:Gem::Requirement
38
+ requirement: &2164340760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153527940
46
+ version_requirements: *2164340760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: contest
49
- requirement: &2153527480 !ruby/object:Gem::Requirement
49
+ requirement: &2164340300 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153527480
57
+ version_requirements: *2164340300
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &2153527020 !ruby/object:Gem::Requirement
60
+ requirement: &2164370020 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - =
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.9.8
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153527020
68
+ version_requirements: *2164370020
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
- requirement: &2153556740 !ruby/object:Gem::Requirement
71
+ requirement: &2164369560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - =
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.5.6
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153556740
79
+ version_requirements: *2164369560
80
80
  description: ''
81
81
  email:
82
82
  - john@famedriver.com
@@ -87,7 +87,6 @@ files:
87
87
  - .gitignore
88
88
  - CHANGES
89
89
  - Gemfile
90
- - Gemfile.lock
91
90
  - README.rdoc
92
91
  - Rakefile
93
92
  - color_profiles/sRGB.icm
data/Gemfile.lock DELETED
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- scale_down (0.2.9)
5
- rmagick (>= 2.1)
6
- ruby-hmac (>= 0.4.0)
7
- sinatra (>= 1.0)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- contest (0.1.3)
13
- daemons (1.1.4)
14
- eventmachine (0.12.10)
15
- mocha (0.9.8)
16
- rake
17
- rack (1.2.2)
18
- rack-test (0.5.6)
19
- rack (>= 1.0)
20
- rake (0.8.7)
21
- rmagick (2.13.1)
22
- ruby-hmac (0.4.0)
23
- sinatra (1.2.7)
24
- rack (~> 1.1)
25
- tilt (>= 1.2.2, < 2.0)
26
- thin (1.3.1)
27
- daemons (>= 1.0.9)
28
- eventmachine (>= 0.12.6)
29
- rack (>= 1.0.0)
30
- tilt (1.3.3)
31
-
32
- PLATFORMS
33
- ruby
34
-
35
- DEPENDENCIES
36
- contest (>= 0.1.2)
37
- mocha (= 0.9.8)
38
- rack-test (= 0.5.6)
39
- scale_down!
40
- thin