thumbor_rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/lib/thumbor_rails/helpers.rb +6 -1
- data/lib/thumbor_rails/version.rb +1 -1
- data/spec/thumbor_rails/helpers_spec.rb +10 -0
- metadata +23 -13
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -21,6 +21,7 @@ rails g thumbor_rails:install
|
|
21
21
|
```
|
22
22
|
|
23
23
|
It will generate the basic configuration in `config/initializers/thumbor_rails.rb` and you have to update the values of `server_url` to point to your thumbor server and the `security_key` to have your security key.
|
24
|
+
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).
|
24
25
|
|
25
26
|
That's all.
|
26
27
|
|
@@ -63,7 +64,7 @@ Will result in something like:
|
|
63
64
|
|
64
65
|
## Maintainers
|
65
66
|
|
66
|
-
- Rafael Caricio (@rafaelcaricio
|
67
|
+
- Rafael Caricio ([@rafaelcaricio](https://coderwall.com/rafaelcaricio))
|
67
68
|
|
68
69
|
## Contributing
|
69
70
|
|
@@ -72,3 +73,7 @@ Will result in something like:
|
|
72
73
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
73
74
|
4. Push to the branch (`git push origin my-new-feature`)
|
74
75
|
5. Create new Pull Request
|
76
|
+
|
77
|
+
## Extras
|
78
|
+
|
79
|
+
If you do not have yet an instance of thumbor for you. You can get one for [free up and running](https://github.com/rafaelcaricio/thumbor-openshift-example) in the OpenShift Cloud.
|
@@ -8,7 +8,12 @@ module ThumborRails
|
|
8
8
|
options[:image] = image_url
|
9
9
|
thumbor_service = crypto_service
|
10
10
|
thumbor_service = unsafe_service if options[:unsafe]
|
11
|
-
|
11
|
+
host = ThumborRails.server_url
|
12
|
+
path = thumbor_service.generate(options)
|
13
|
+
if host =~ /%d/
|
14
|
+
host = host % (Zlib.crc32(path) % 4)
|
15
|
+
end
|
16
|
+
host + path
|
12
17
|
end
|
13
18
|
|
14
19
|
def thumbor_image_tag(image_url, options = {}, tag_attrs = {})
|
@@ -15,6 +15,16 @@ describe ThumborRails::Helpers do
|
|
15
15
|
it 'should pass arguments to thumbor' do
|
16
16
|
expect(thumbor_url('http://test.img', unsafe: true, width: 100, height: 200)).to eq('http://thumbor.example.com/unsafe/100x200/http://test.img')
|
17
17
|
end
|
18
|
+
|
19
|
+
it 'should interpolate thumbor hosts with %d to 0-3, like Rails asset_host' do
|
20
|
+
original_url = ThumborRails.server_url
|
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
|
27
|
+
end
|
18
28
|
end
|
19
29
|
|
20
30
|
describe '#thumbor_image_tag' do
|
metadata
CHANGED
@@ -1,46 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumbor_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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-07-10 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
|
@@ -48,6 +54,7 @@ dependencies:
|
|
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
|
@@ -55,15 +62,17 @@ dependencies:
|
|
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)
|
@@ -86,7 +95,6 @@ files:
|
|
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
|
@@ -94,20 +102,22 @@ rdoc_options:
|
|
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: 5f945ed803b05c9cd5c033721e72c3e5a948ef03
|
4
|
-
data.tar.gz: 98812b81213e952bbd2afa9fe7c7b7e5965b7789
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 3bef58317da733d42ce7271e8340e0570408d984580cbb09cc585cf90c7c9b6cad26709c638b7b218240aa0c00daf19e7ec02fbe1dcf57dad512046ad314a381
|
7
|
-
data.tar.gz: 44a48b1e8734047f3f2a2dedae7f5bb5b328a3335a46cf11ccf70a274e5bd9880ee3aff486cef5126ff00f28a73d8359fe8c4c2c52a95a23c8ccaa0a1a4da2b0
|