imgix 1.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -2
- data/CHANGELOG.md +5 -0
- data/imgix.gemspec +2 -2
- data/lib/imgix.rb +1 -0
- data/lib/imgix/client.rb +6 -1
- data/lib/imgix/version.rb +1 -1
- data/test/units/domains_test.rb +12 -18
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c065af1834dc3934c519fffe6ade364cae32993e
|
4
|
+
data.tar.gz: 96ea6ed38526442c99b6ff62a655ba75f8e44992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0272a45ae8ce8e0d496c345aa97228807f38aff0858aac459ffae0d1a166222f2dafc608c6e4f6a4bdc605e792795c89aded140fb56f9c38689de54f10868d3
|
7
|
+
data.tar.gz: 7c56ae3fd51c9d45dc2b37ca5d917ca9e3787e3101b43d169e6948d1437ef23fca425ce81b3d0176cd906125397a342d9c91aa2977531c0c864a4fec25aa93d6
|
data/.travis.yml
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
bundler_args: --without development
|
3
3
|
before_install:
|
4
|
-
|
5
|
-
-
|
4
|
+
# Extracts the ruby version number
|
5
|
+
- RUBY_VERS="$(bc -l<<<$(ruby -v | cut -d' ' -f 2 | cut -d'.' -f 1,2))"
|
6
|
+
# Bundler 2.0 requires at least ruby vers 2.3.0
|
7
|
+
- LATEST_VERS=2.3
|
8
|
+
# Based on a given job's ruby version, install either
|
9
|
+
# Bundler 2.x or 1.17
|
10
|
+
- if (( $(echo "$RUBY_VERS >= $LATEST_VERS" | bc -l) ));
|
11
|
+
then echo $(gem install bundler);
|
12
|
+
else echo $(gem install bundler -v '< 2');
|
13
|
+
fi
|
6
14
|
rvm:
|
7
15
|
- 2.3.0
|
8
16
|
- 2.2.4
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [2.0.0] - February 25, 2019
|
7
|
+
|
8
|
+
* Add domain validation during Client initialization [#42](https://github.com/imgix/imgix-rb/pull/42)
|
9
|
+
* Expand Travis CI config to include bundler v2.x [#41](https://github.com/imgix/imgix-rb/pull/41)
|
10
|
+
|
6
11
|
## [1.2.2] - November 14, 2018
|
7
12
|
|
8
13
|
* Improvements to memory usage [#35](https://github.com/imgix/imgix-rb/pull/35)
|
data/imgix.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'imgix/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'imgix'
|
8
8
|
spec.version = Imgix::VERSION
|
9
|
-
spec.authors = ['Kelly Sutton', 'Sam Soffes', 'Ryan LeFevre', 'Antony Denyer', 'Paul Straw']
|
10
|
-
spec.email = ['kelly@imgix.com', 'sam@soff.es', 'ryan@layervault.com', 'email@antonydenyer.co.uk', 'paul@imgix.com']
|
9
|
+
spec.authors = ['Kelly Sutton', 'Sam Soffes', 'Ryan LeFevre', 'Antony Denyer', 'Paul Straw', 'Sherwin Heydarbeygi']
|
10
|
+
spec.email = ['kelly@imgix.com', 'sam@soff.es', 'ryan@layervault.com', 'email@antonydenyer.co.uk', 'paul@imgix.com', 'sherwin@imgix.com']
|
11
11
|
spec.description = 'Easily create and sign imgix URLs.'
|
12
12
|
spec.summary = 'Official Ruby Gem for easily creating and signing imgix URLs.'
|
13
13
|
spec.homepage = 'https://github.com/imgix/imgix-rb'
|
data/lib/imgix.rb
CHANGED
data/lib/imgix/client.rb
CHANGED
@@ -49,7 +49,7 @@ module Imgix
|
|
49
49
|
def get_host(path)
|
50
50
|
host = host_for_crc(path) if @shard_strategy == :crc
|
51
51
|
host = host_for_cycle if @shard_strategy == :cycle
|
52
|
-
host
|
52
|
+
host
|
53
53
|
end
|
54
54
|
|
55
55
|
def host_for_crc(path)
|
@@ -75,6 +75,11 @@ module Imgix
|
|
75
75
|
unless @hosts.length > 0
|
76
76
|
raise ArgumentError, "The :host or :hosts option must be specified"
|
77
77
|
end
|
78
|
+
@hosts.each do |host|
|
79
|
+
if host.match(DOMAIN_REGEX) == nil
|
80
|
+
raise ArgumentError, "Domains must be passed in as fully-qualified domain names and should not include a protocol or any path element, i.e. \"example.imgix.net\"."
|
81
|
+
end
|
82
|
+
end
|
78
83
|
end
|
79
84
|
|
80
85
|
end
|
data/lib/imgix/version.rb
CHANGED
data/test/units/domains_test.rb
CHANGED
@@ -42,24 +42,6 @@ class DomainsTest < Imgix::Test
|
|
42
42
|
assert_equal 'https://demos-1.imgix.net/bridge.png?s=0233fd6de51f20f11cff6b452b7a9a05', path.to_url
|
43
43
|
end
|
44
44
|
|
45
|
-
def test_strips_out_protocol
|
46
|
-
client = Imgix::Client.new(host: "http://demos-1.imgix.net",
|
47
|
-
secure_url_token: '10adc394',
|
48
|
-
include_library_param: false)
|
49
|
-
|
50
|
-
path = client.path('/bridge.png')
|
51
|
-
assert_equal 'https://demos-1.imgix.net/bridge.png?s=0233fd6de51f20f11cff6b452b7a9a05', path.to_url
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_strips_out_trailing_slash
|
55
|
-
client = Imgix::Client.new(host: "http://demos-1.imgix.net/",
|
56
|
-
secure_url_token: '10adc394',
|
57
|
-
include_library_param: false)
|
58
|
-
|
59
|
-
path = client.path('/bridge.png')
|
60
|
-
assert_equal 'https://demos-1.imgix.net/bridge.png?s=0233fd6de51f20f11cff6b452b7a9a05', path.to_url
|
61
|
-
end
|
62
|
-
|
63
45
|
def test_with_full_paths
|
64
46
|
client = Imgix::Client.new(hosts: [
|
65
47
|
"demos-1.imgix.net",
|
@@ -73,4 +55,16 @@ class DomainsTest < Imgix::Test
|
|
73
55
|
path = 'https://google.com/cats.gif'
|
74
56
|
assert_equal "https://demos-1.imgix.net/#{CGI.escape(path)}?s=e686099fbba86fc2b8141d3c1ff60605", client.path(path).to_url
|
75
57
|
end
|
58
|
+
|
59
|
+
def test_invalid_domain_append_slash
|
60
|
+
assert_raises(ArgumentError) {Imgix::Client.new(hosts: ["assets.imgix.net/"])}
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_invalid_domain_prepend_scheme
|
64
|
+
assert_raises(ArgumentError) {Imgix::Client.new(hosts: ["https://assets.imgix.net"])}
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_invalid_domain_append_dash
|
68
|
+
assert_raises(ArgumentError) {Imgix::Client.new(hosts: ["assets.imgix.net-"])}
|
69
|
+
end
|
76
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Sutton
|
@@ -9,10 +9,11 @@ authors:
|
|
9
9
|
- Ryan LeFevre
|
10
10
|
- Antony Denyer
|
11
11
|
- Paul Straw
|
12
|
+
- Sherwin Heydarbeygi
|
12
13
|
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
|
-
date:
|
16
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: addressable
|
@@ -49,6 +50,7 @@ email:
|
|
49
50
|
- ryan@layervault.com
|
50
51
|
- email@antonydenyer.co.uk
|
51
52
|
- paul@imgix.com
|
53
|
+
- sherwin@imgix.com
|
52
54
|
executables: []
|
53
55
|
extensions: []
|
54
56
|
extra_rdoc_files: []
|
@@ -92,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
94
|
version: '0'
|
93
95
|
requirements: []
|
94
96
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.6.13
|
96
98
|
signing_key:
|
97
99
|
specification_version: 4
|
98
100
|
summary: Official Ruby Gem for easily creating and signing imgix URLs.
|