thumbor_rails 0.1.1 → 0.1.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.
- checksums.yaml +7 -0
- data/README.md +7 -3
- data/lib/thumbor_rails/helpers.rb +4 -0
- data/lib/thumbor_rails/version.rb +1 -1
- data/lib/thumbor_rails.rb +3 -0
- data/spec/thumbor_rails/helpers_spec.rb +11 -0
- data/spec/thumbor_rails_spec.rb +4 -0
- metadata +13 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3827ec3b7c254eca96c76a1af932e3d85eca7ca3
|
4
|
+
data.tar.gz: 4b1da71a4cd139527c7c69ada08b6b967caa2212
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39651de5c049c410ab62489963d31afa79ed8f33c11a860225f893680655978c6d137095ef3495ec9d5fd856b8493a02fa05ab9ebf138e4a1ac0bc199ee9e1ae
|
7
|
+
data.tar.gz: 00987193f3ac1bab73d1913b1754cdca6a22c33f412ab4221b068119bca6a672099338e1ffc67113a39e3aacebdf21087ee31022729b98039763dd3334ebde76
|
data/README.md
CHANGED
@@ -20,10 +20,12 @@ Now generate the thumbor basic client configuration:
|
|
20
20
|
rails g thumbor_rails:install
|
21
21
|
```
|
22
22
|
|
23
|
-
It will generate the basic configuration in `config/initializers/thumbor_rails.rb
|
24
|
-
|
23
|
+
It will generate the basic configuration in `config/initializers/thumbor_rails.rb`, which has the following configuration options available:
|
24
|
+
|
25
|
+
- `server_url`. _Required_. The location of your Thumbor server. If `server_url` contains `%d`, it will be interpolated to 0-3, [just like `asset_host` for Rails](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html).
|
26
|
+
- `sercurity_key`. Optional. This must match your [Thumbor server's security key](https://github.com/thumbor/thumbor/wiki/Security#stopping-tampering).
|
27
|
+
- `force_no_protocol_in_source_url`. Optional, defaults to `false`. If true, the protocol is removed from any image source passed into `thumbor_url`. This may be done for aesthetic reasons, or due to certain CDN/server configurations.
|
25
28
|
|
26
|
-
That's all.
|
27
29
|
|
28
30
|
## Usage
|
29
31
|
|
@@ -66,6 +68,8 @@ Will result in something like:
|
|
66
68
|
|
67
69
|
- Rafael Caricio ([@rafaelcaricio](https://coderwall.com/rafaelcaricio))
|
68
70
|
|
71
|
+
and [contributors](https://github.com/rafaelcaricio/thumbor_rails/graphs/contributors).
|
72
|
+
|
69
73
|
## Contributing
|
70
74
|
|
71
75
|
1. Fork it
|
@@ -5,6 +5,10 @@ module ThumborRails
|
|
5
5
|
include ActionView::Helpers::AssetTagHelper
|
6
6
|
|
7
7
|
def thumbor_url(image_url, options = {})
|
8
|
+
if ThumborRails.force_no_protocol_in_source_url
|
9
|
+
image_url.sub!(/^http(s|):\/\//, '')
|
10
|
+
end
|
11
|
+
|
8
12
|
options[:image] = image_url
|
9
13
|
thumbor_service = crypto_service
|
10
14
|
thumbor_service = unsafe_service if options[:unsafe]
|
data/lib/thumbor_rails.rb
CHANGED
@@ -25,6 +25,17 @@ describe ThumborRails::Helpers do
|
|
25
25
|
ThumborRails.server_url = original_url
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
it 'should automatically remove the protocol in source urls if configured to do so' do
|
30
|
+
begin
|
31
|
+
ThumborRails.force_no_protocol_in_source_url = true
|
32
|
+
expect(thumbor_url('http://test.img', unsafe: true)).to eq('http://thumbor.example.com/unsafe/test.img')
|
33
|
+
expect(thumbor_url('https://test.img', unsafe: true)).to eq('http://thumbor.example.com/unsafe/test.img')
|
34
|
+
expect(thumbor_url('www.test.img', unsafe: true)).to eq('http://thumbor.example.com/unsafe/www.test.img')
|
35
|
+
ensure
|
36
|
+
ThumborRails.force_no_protocol_in_source_url = false
|
37
|
+
end
|
38
|
+
end
|
28
39
|
end
|
29
40
|
|
30
41
|
describe '#thumbor_image_tag' do
|
data/spec/thumbor_rails_spec.rb
CHANGED
@@ -15,6 +15,10 @@ describe ThumborRails do
|
|
15
15
|
expect(subject).to respond_to 'server_url'
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'has force_no_protocol_in_source_url attibute' do
|
19
|
+
expect(subject).to respond_to 'force_no_protocol_in_source_url'
|
20
|
+
end
|
21
|
+
|
18
22
|
describe 'when configured' do
|
19
23
|
before do
|
20
24
|
subject.setup do |config|
|
metadata
CHANGED
@@ -1,52 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumbor_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Rafael Caricio
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ruby-thumbor
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.2.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.2.1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rb-fsevent
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,17 +55,15 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description: thumbor_rails is a client for the thumbor imaging service (http://github.com/globocom/thumbor)
|
@@ -95,6 +86,7 @@ files:
|
|
95
86
|
homepage: https://github.com/rafaelcaricio/thumbor_rails
|
96
87
|
licenses:
|
97
88
|
- MIT
|
89
|
+
metadata: {}
|
98
90
|
post_install_message:
|
99
91
|
rdoc_options:
|
100
92
|
- --main
|
@@ -102,22 +94,20 @@ rdoc_options:
|
|
102
94
|
require_paths:
|
103
95
|
- lib
|
104
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
97
|
requirements:
|
107
|
-
- -
|
98
|
+
- - '>='
|
108
99
|
- !ruby/object:Gem::Version
|
109
100
|
version: '0'
|
110
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
102
|
requirements:
|
113
|
-
- -
|
103
|
+
- - '>='
|
114
104
|
- !ruby/object:Gem::Version
|
115
105
|
version: '0'
|
116
106
|
requirements: []
|
117
107
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 2.1.3
|
119
109
|
signing_key:
|
120
|
-
specification_version:
|
110
|
+
specification_version: 4
|
121
111
|
summary: thumbor_rails is a client to manage and generate urls for the thumbor imaging
|
122
112
|
service (http://github.com/globocom/thumbor) for Ruby and Rails projects.
|
123
113
|
test_files:
|