thumbor_rails 1.0.1 → 1.1.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/README.md +1 -1
- data/lib/thumbor_rails/version.rb +1 -1
- data/lib/thumbor_rails.rb +1 -1
- data/spec/thumbor_rails/helpers_spec.rb +55 -28
- metadata +28 -18
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -11,7 +11,7 @@ thumbor_rails is a client to make easier to use the thumbor imaging service (htt
|
|
11
11
|
You can use this gem by putting the following inside your Gemfile:
|
12
12
|
|
13
13
|
```
|
14
|
-
gem "thumbor_rails", "1.0
|
14
|
+
gem "thumbor_rails", "1.1.0"
|
15
15
|
```
|
16
16
|
|
17
17
|
Now generate the thumbor basic client configuration:
|
data/lib/thumbor_rails.rb
CHANGED
@@ -1,50 +1,77 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ThumborRails::Helpers do
|
4
|
+
let(:params) { { } }
|
5
|
+
|
4
6
|
include ThumborRails::Helpers
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
before do
|
9
|
+
ThumborRails.setup do |config|
|
10
|
+
config.security_key = 'MY_SECURITY_KEY'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'interpolate thumbor hosts with %d to 0-3, like Rails asset_host' do
|
15
|
+
subject { thumbor_url('http://test.img') }
|
16
|
+
let!(:original_url) { ThumborRails.server_url }
|
17
|
+
before { ThumborRails.server_url = server_url }
|
18
|
+
after { ThumborRails.server_url = original_url }
|
19
|
+
|
20
|
+
context 'when url is set to "http://thumbor%d.com"' do
|
21
|
+
let(:server_url) { 'http://thumbor%d.com' }
|
22
|
+
it { should eq('http://thumbor3.com/yPVDsGJsQKjKky_cdbkNuIpc9-A=/http://test.img') }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'automatically remove the protocol in source urls' do
|
27
|
+
subject { thumbor_url("#{protocol}test.img", unsafe: true) }
|
28
|
+
before { ThumborRails.force_no_protocol_in_source_url = true }
|
29
|
+
after { ThumborRails.force_no_protocol_in_source_url = false }
|
30
|
+
|
31
|
+
context 'when http' do
|
32
|
+
let(:protocol) { 'http://' }
|
33
|
+
it { should eq "http://thumbor.example.com/unsafe/test.img" }
|
9
34
|
end
|
10
35
|
|
11
|
-
|
12
|
-
|
36
|
+
context 'when https' do
|
37
|
+
let(:protocol) { 'https://' }
|
38
|
+
it { should eq "http://thumbor.example.com/unsafe/test.img" }
|
13
39
|
end
|
14
40
|
|
15
|
-
|
16
|
-
|
41
|
+
context 'when no protocol' do
|
42
|
+
let(:protocol) { 'www.' }
|
43
|
+
it { should eq "http://thumbor.example.com/unsafe/www.test.img" }
|
17
44
|
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#thumbor_url' do
|
48
|
+
subject { thumbor_url('http://test.img', params) }
|
18
49
|
|
19
|
-
|
20
|
-
|
21
|
-
begin
|
22
|
-
ThumborRails.server_url = "http://thumbor%d.com"
|
23
|
-
expect(thumbor_url('http://test.img')).to eq('http://thumbor3.com/yPVDsGJsQKjKky_cdbkNuIpc9-A=/http://test.img')
|
24
|
-
ensure
|
25
|
-
ThumborRails.server_url = original_url
|
26
|
-
end
|
50
|
+
context 'basic encrypted url' do
|
51
|
+
it { should eq('http://thumbor.example.com/yPVDsGJsQKjKky_cdbkNuIpc9-A=/http://test.img') }
|
27
52
|
end
|
28
53
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
54
|
+
context 'allow unsafe urls' do
|
55
|
+
let(:params) { { unsafe: true } }
|
56
|
+
it { should eq('http://thumbor.example.com/unsafe/http://test.img') }
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'pass arguments to thumbor' do
|
60
|
+
let(:params) { { unsafe: true, width: 100, height: 200 } }
|
61
|
+
it { should eq('http://thumbor.example.com/unsafe/100x200/http://test.img') }
|
38
62
|
end
|
39
63
|
end
|
40
64
|
|
41
65
|
describe '#thumbor_image_tag' do
|
42
|
-
|
43
|
-
|
66
|
+
subject { thumbor_image_tag('http://myimg.jpg', params) }
|
67
|
+
|
68
|
+
context 'unsafe disabled' do
|
69
|
+
it { should eq('<img alt="Myimg" src="http://thumbor.example.com/Q-1lWnxlCLnkzXWWM5xTAs1QEBM=/http://myimg.jpg" />') }
|
44
70
|
end
|
45
71
|
|
46
|
-
|
47
|
-
|
72
|
+
context 'unsafe enabled' do
|
73
|
+
let(:params) { { unsafe: true } }
|
74
|
+
it { should eq('<img alt="Myimg" src="http://thumbor.example.com/unsafe/http://myimg.jpg" />') }
|
48
75
|
end
|
49
76
|
end
|
50
77
|
end
|
metadata
CHANGED
@@ -1,69 +1,78 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumbor_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Rafael Caricio
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: ruby-thumbor
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.2.1
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.2.1
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rspec
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rb-fsevent
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: 0.9.1
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: 0.9.1
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rake
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0'
|
69
78
|
description: thumbor_rails is a client for the thumbor imaging service (http://github.com/globocom/thumbor)
|
@@ -74,40 +83,41 @@ executables: []
|
|
74
83
|
extensions: []
|
75
84
|
extra_rdoc_files: []
|
76
85
|
files:
|
77
|
-
- README.md
|
78
86
|
- lib/generators/thumbor_rails/install_generator.rb
|
79
87
|
- lib/generators/thumbor_rails/templates/config/initializers/thumbor_rails.rb
|
80
|
-
- lib/thumbor_rails.rb
|
81
88
|
- lib/thumbor_rails/helpers.rb
|
82
89
|
- lib/thumbor_rails/version.rb
|
90
|
+
- lib/thumbor_rails.rb
|
91
|
+
- README.md
|
83
92
|
- spec/spec_helper.rb
|
84
93
|
- spec/thumbor_rails/helpers_spec.rb
|
85
94
|
- spec/thumbor_rails_spec.rb
|
86
95
|
homepage: https://github.com/rafaelcaricio/thumbor_rails
|
87
96
|
licenses:
|
88
97
|
- MIT
|
89
|
-
metadata: {}
|
90
98
|
post_install_message:
|
91
99
|
rdoc_options:
|
92
|
-
-
|
100
|
+
- --main
|
93
101
|
- README.md
|
94
102
|
require_paths:
|
95
103
|
- lib
|
96
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
97
106
|
requirements:
|
98
|
-
- -
|
107
|
+
- - ! '>='
|
99
108
|
- !ruby/object:Gem::Version
|
100
109
|
version: '0'
|
101
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
102
112
|
requirements:
|
103
|
-
- -
|
113
|
+
- - ! '>='
|
104
114
|
- !ruby/object:Gem::Version
|
105
115
|
version: '0'
|
106
116
|
requirements: []
|
107
117
|
rubyforge_project:
|
108
|
-
rubygems_version:
|
118
|
+
rubygems_version: 1.8.23
|
109
119
|
signing_key:
|
110
|
-
specification_version:
|
120
|
+
specification_version: 3
|
111
121
|
summary: thumbor_rails is a client to manage and generate urls for the thumbor imaging
|
112
122
|
service (http://github.com/globocom/thumbor) for Ruby and Rails projects.
|
113
123
|
test_files:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: bad68a7ed8543235144e2705d07c387e3d7f1e57
|
4
|
-
data.tar.gz: 7fd9a6ad0ebe2cc28476556c4db8809b25c3e5cc
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 4c0c700222289d6e6abd0b68a8f1e433ed2b9baab97fe50b734f70405be2fb2b90f2d91e96817555de06b42e8e9a99d20a731502d93837c34d76ec23d3d020ba
|
7
|
-
data.tar.gz: 0b234e44156f368e60f87922cb477ed1697198a8314ecad863d3addd469780e22ee5640a13417ecf56525fb3509e6dff8ce5f7a258479011a40635ff9184a42a
|