roadie 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +12 -1
- data/README.md +4 -4
- data/lib/roadie/asset_provider.rb +1 -1
- data/lib/roadie/errors.rb +10 -6
- data/lib/roadie/filesystem_provider.rb +2 -2
- data/lib/roadie/provider_list.rb +8 -0
- data/lib/roadie/url_generator.rb +3 -1
- data/lib/roadie/version.rb +1 -1
- data/spec/lib/roadie/css_not_found_spec.rb +7 -0
- data/spec/lib/roadie/provider_list_spec.rb +14 -0
- data/spec/lib/roadie/url_generator_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e46e63eac0d8ed2687129918a809ae20203b1e3
|
4
|
+
data.tar.gz: 5e6e1a556dbc197c61b5d209f85c123ae1075e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dd556c62999f098e98863d52292b7bb80752695ba68fe9d2309c791334f5ae950b47717482a7f1a18fd00284f84c5eae404f7747d26287ee8a34891bd1c7759
|
7
|
+
data.tar.gz: 1bbd2fbc9ef860af00a4b1da17507e341679ee555e11447749103958383d5713fed349cd73b68e928103309283dea9342c35a49a69d7d1dfc4b549c1e3fe1d14
|
data/Changelog.md
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
-
[full changelog](https://github.com/Mange/roadie/compare/v3.0.
|
3
|
+
[full changelog](https://github.com/Mange/roadie/compare/v3.0.1...master)
|
4
4
|
|
5
5
|
* Nothing yet.
|
6
6
|
|
7
|
+
### 3.0.1
|
8
|
+
|
9
|
+
[full changelog](https://github.com/Mange/roadie/compare/v3.0.0...v3.0.1)
|
10
|
+
|
11
|
+
* Enhancements:
|
12
|
+
* `CssNotFound` can take a provider which will be shown in error messages.
|
13
|
+
* Bug fixes:
|
14
|
+
* URL rewriter no longer raises on absolute URLs that cannot be parsed by `URI`. Absolute URLs are completely ignored.
|
15
|
+
* URL rewriter supports urls without a scheme (like `//assets.myapp.com/foo`).
|
16
|
+
* URL rewriter no longer crashes on absolute URLs without a path (like `myapp://`).
|
17
|
+
|
7
18
|
### 3.0.0
|
8
19
|
|
9
20
|
[full changelog](https://github.com/Mange/roadie/compare/v3.0.0.pre1...v3.0.0)
|
data/README.md
CHANGED
@@ -107,7 +107,7 @@ Example:
|
|
107
107
|
|
108
108
|
```ruby
|
109
109
|
# /home/user/foo/stylesheets/primary.css
|
110
|
-
body { color:
|
110
|
+
body { color: green; }
|
111
111
|
|
112
112
|
# /home/user/foo/script.rb
|
113
113
|
html = <<-HTML
|
@@ -176,7 +176,7 @@ class UserAssetsProvider
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def find_stylesheet!(name)
|
179
|
-
find_stylesheet(name) or raise Roadie::CssNotFound.new(name)
|
179
|
+
find_stylesheet(name) or raise Roadie::CssNotFound.new(name, "does not match a user stylesheet", self)
|
180
180
|
end
|
181
181
|
|
182
182
|
# Instead of implementing #find_stylesheet!, you could also:
|
@@ -243,7 +243,7 @@ Tested with [Travis CI](http://travis-ci.org) using:
|
|
243
243
|
|
244
244
|
Let me know if you want any other VM supported officially.
|
245
245
|
|
246
|
-
Rubinius support is experimental since it
|
246
|
+
Rubinius support is experimental since it is currently hindered by a Rubinius bug that will probably be fixed shortly.
|
247
247
|
|
248
248
|
### Versioning ###
|
249
249
|
|
@@ -274,7 +274,7 @@ Documentation
|
|
274
274
|
|
275
275
|
* [Online documentation for gem](http://rubydoc.info/gems/roadie/frames)
|
276
276
|
* [Online documentation for master](http://rubydoc.info/github/Mange/roadie/master/frames)
|
277
|
-
* [Online documentation for Roadie 2.4](http://rubydoc.info/gems/roadie/2.4/frames)
|
277
|
+
* [Online documentation for Roadie 2.4.3](http://rubydoc.info/gems/roadie/2.4.3/frames)
|
278
278
|
* [Changelog](https://github.com/Mange/roadie/blob/master/Changelog.md)
|
279
279
|
|
280
280
|
Running specs
|
@@ -5,7 +5,7 @@ module Roadie
|
|
5
5
|
# It helps you by declaring {#find_stylesheet!} in the terms of #find_stylesheet in your own class.
|
6
6
|
module AssetProvider
|
7
7
|
def find_stylesheet!(name)
|
8
|
-
find_stylesheet(name) or raise CssNotFound,
|
8
|
+
find_stylesheet(name) or raise CssNotFound.new(name, nil, self)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/roadie/errors.rb
CHANGED
@@ -40,18 +40,22 @@ module Roadie
|
|
40
40
|
# The name of the stylesheet that cannot be found
|
41
41
|
attr_reader :css_name
|
42
42
|
|
43
|
-
|
43
|
+
# Provider used when finding
|
44
|
+
attr_reader :provider
|
45
|
+
|
46
|
+
# TODO: Change signature in the next major version of Roadie.
|
47
|
+
def initialize(css_name, extra_message = nil, provider = nil)
|
44
48
|
@css_name = css_name
|
49
|
+
@provider = provider
|
45
50
|
super build_message(extra_message)
|
46
51
|
end
|
47
52
|
|
48
53
|
private
|
49
54
|
def build_message(extra_message)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
+
message = %(Could not find stylesheet "#{css_name}")
|
56
|
+
message << ": #{extra_message}" if extra_message
|
57
|
+
message << "\nUsed provider:\n#{provider}" if provider
|
58
|
+
message
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -30,8 +30,8 @@ module Roadie
|
|
30
30
|
if File.exist? file_path
|
31
31
|
Stylesheet.new file_path, File.read(file_path)
|
32
32
|
else
|
33
|
-
|
34
|
-
raise CssNotFound.new(
|
33
|
+
basename = File.basename file_path
|
34
|
+
raise CssNotFound.new(basename, %{#{file_path} does not exist. (Original name was "#{name}")}, self)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
data/lib/roadie/provider_list.rb
CHANGED
@@ -44,6 +44,14 @@ module Roadie
|
|
44
44
|
nil
|
45
45
|
end
|
46
46
|
|
47
|
+
def to_s
|
48
|
+
list = @providers.map { |provider|
|
49
|
+
# Indent every line one level
|
50
|
+
provider.to_s.split("\n").join("\n\t")
|
51
|
+
}
|
52
|
+
"ProviderList: [\n\t#{list.join(",\n\t")}\n]"
|
53
|
+
end
|
54
|
+
|
47
55
|
# ProviderList can be coerced to an array. This makes Array#flatten work
|
48
56
|
# with it, among other things.
|
49
57
|
def to_ary() to_a end
|
data/lib/roadie/url_generator.rb
CHANGED
@@ -105,7 +105,9 @@ module Roadie
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def path_is_absolute?(path)
|
108
|
-
|
108
|
+
# Ruby's URI is pretty unforgiving, but roadie aims to be. Don't involve
|
109
|
+
# URI for URLs that's easy to determine to be absolute.
|
110
|
+
path =~ %r{^(\w+:)?//} || !parse_path(path).relative?
|
109
111
|
end
|
110
112
|
|
111
113
|
def parse_path(path)
|
data/lib/roadie/version.rb
CHANGED
@@ -13,5 +13,12 @@ module Roadie
|
|
13
13
|
'Could not find stylesheet "file.css": directory is missing'
|
14
14
|
)
|
15
15
|
end
|
16
|
+
|
17
|
+
it "shows information about used provider when given" do
|
18
|
+
provider = double("Some cool provider")
|
19
|
+
expect(CssNotFound.new('style.css', nil, provider).message).to eq(
|
20
|
+
%(Could not find stylesheet "style.css"\nUsed provider:\n#{provider})
|
21
|
+
)
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
@@ -64,6 +64,20 @@ module Roadie
|
|
64
64
|
}.to change(provider, :size).by(-1)
|
65
65
|
end
|
66
66
|
|
67
|
+
it "has a readable string represenation" do
|
68
|
+
provider = double("Provider", to_s: "Some provider")
|
69
|
+
sublist = ProviderList.new([provider, provider])
|
70
|
+
list = ProviderList.new([provider, sublist, provider])
|
71
|
+
expect(list.to_s).to eql "ProviderList: [\n" +
|
72
|
+
"\tSome provider,\n" +
|
73
|
+
"\tProviderList: [\n" +
|
74
|
+
"\t\tSome provider,\n" +
|
75
|
+
"\t\tSome provider\n" +
|
76
|
+
"\t],\n" +
|
77
|
+
"\tSome provider\n" +
|
78
|
+
"]"
|
79
|
+
end
|
80
|
+
|
67
81
|
describe "wrapping" do
|
68
82
|
it "creates provider lists with the arguments" do
|
69
83
|
expect(ProviderList.wrap(test_provider)).to be_instance_of(ProviderList)
|
@@ -84,6 +84,21 @@ module Roadie
|
|
84
84
|
it "does not touch data: URIs" do
|
85
85
|
expect(url("data:deadbeef", host: "example.com")).to eq("data:deadbeef")
|
86
86
|
end
|
87
|
+
|
88
|
+
it "does not touch absolute URLs without schemes" do
|
89
|
+
expect(url("//assets.myapp.com/foo.jpg", host: "example.com")).to eq("//assets.myapp.com/foo.jpg")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "does not touch custom schemes" do
|
93
|
+
expect(url("myapp://", host: "example.com")).to eq("myapp://")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "does not care if absolute URLs have parse errors" do
|
97
|
+
# Pipe character is invalid inside URLs, but that does not stop a whole
|
98
|
+
# lot of templating/emailing systems for using them as template
|
99
|
+
# markers.
|
100
|
+
expect(url("https://foo.com/%|MARKETING_TOKEN|%", host: "example.com")).to eq("https://foo.com/%|MARKETING_TOKEN|%")
|
101
|
+
end
|
87
102
|
end
|
88
103
|
|
89
104
|
# URLs in resources that are not based inside the root requires that we may
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roadie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Bergmark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|