vitrine 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/asset_compiler.rb +16 -11
- data/lib/sourcemaps.rb +1 -1
- data/lib/version.rb +1 -1
- data/test/test_vitrine_asset_compiler.rb +8 -3
- data/vitrine.gemspec +4 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91384529ab3b17a8f37ab9c2e78cecc2182cc091
|
4
|
+
data.tar.gz: 4031c3404bd57c1d9cf13e45193b60df945ac79e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 894d0915eab432b3bfd615792c924ab200ca7f3f9cfd6b74ff7ca3d4990e1353d37392f61a12636b2fa781d6fc4b21f8cdfdfd7b9c5a5df1b4ba5f0e48da05f4
|
7
|
+
data.tar.gz: 55f4a1a7a8d009fbe6ec9cee1bcadaa705e884362bbc3270bc667e71c668ec410df9e9b1a2dbf4295a86857a60e8f1c2fc1660560a3945701bed925d09355f7f
|
data/Gemfile
CHANGED
@@ -21,7 +21,7 @@ https://github.com/nex3/sass/pull/982
|
|
21
21
|
Better still, SASS authors should remove filesystem watching or implement
|
22
22
|
it in a portable/vendored manner.
|
23
23
|
=end
|
24
|
-
gem 'sass',
|
24
|
+
gem 'sass', '3.3.0.rc.3'
|
25
25
|
gem 'rack-contrib'
|
26
26
|
gem 'rack-livereload'
|
27
27
|
|
data/lib/asset_compiler.rb
CHANGED
@@ -42,14 +42,15 @@ class Vitrine::AssetCompiler < Sinatra::Base
|
|
42
42
|
rescue Errno::ENOENT # Missing SCSS
|
43
43
|
forward_or_halt "No such CSS or SCSS file found"
|
44
44
|
rescue Exception => e # CSS syntax error or something alike
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
cache_bust!
|
46
|
+
# Add a generated DOM element before <body/> to inject
|
47
|
+
# a visible error message
|
48
|
+
error_tpl = 'body:before {
|
49
|
+
background: white; padding: 3px; font-family: monospaced; color: red;
|
50
|
+
font-size: 14px; content: %s }'
|
51
|
+
css_message = error_tpl % [e.class, "\n", "--> ", e.message].join.inspect
|
52
|
+
# If we halt with 500 this will not be shown as CSS
|
53
|
+
halt 200, css_message
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
@@ -96,9 +97,7 @@ class Vitrine::AssetCompiler < Sinatra::Base
|
|
96
97
|
rescue Exception => e # CS syntax error or something alike
|
97
98
|
|
98
99
|
# Ensure the response with the exception gets reloaded on next request
|
99
|
-
|
100
|
-
response.headers['Pragma'] = 'no-cache'
|
101
|
-
response.headers.delete('ETag')
|
100
|
+
cache_bust!
|
102
101
|
|
103
102
|
# Inject the syntax error into the browser console
|
104
103
|
console_message = 'console.error(%s)' % [e.class, "\n", "--> ", e.message].join.inspect
|
@@ -107,6 +106,12 @@ class Vitrine::AssetCompiler < Sinatra::Base
|
|
107
106
|
end
|
108
107
|
end
|
109
108
|
|
109
|
+
def cache_bust!
|
110
|
+
response.headers['Cache-Control'] = 'private'
|
111
|
+
response.headers['Pragma'] = 'no-cache'
|
112
|
+
response.headers.delete('ETag')
|
113
|
+
end
|
114
|
+
|
110
115
|
def mtime_cache(path)
|
111
116
|
# Mix in the request URL into the cache key so that we can hash
|
112
117
|
# .map sourcemaps and .js compiles based off of the same file path
|
data/lib/sourcemaps.rb
CHANGED
@@ -6,7 +6,7 @@ module Vitrine
|
|
6
6
|
# We need to override the Sass importer
|
7
7
|
# so that it gives us URLs relative to the server root for sourcemaps
|
8
8
|
class SassImporter < Sass::Importers::Filesystem
|
9
|
-
def public_url(of_filesystem_path)
|
9
|
+
def public_url(of_filesystem_path, unknown_arg) # TODO: figure out what the second one does
|
10
10
|
# Importer defines a basic attribute called "root" which we set when initializing
|
11
11
|
# We have to return the server-relative URL of the path from here
|
12
12
|
'/' + Pathname.new(of_filesystem_path).relative_path_from(Pathname.new(root)).to_s
|
data/lib/version.rb
CHANGED
@@ -50,13 +50,13 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
|
|
50
50
|
|
51
51
|
get '/faulty.js'
|
52
52
|
|
53
|
-
assert_equal 200, last_response.status
|
54
|
-
assert_equal 'text/javascript;charset=utf-8', last_response.content_type, "Should set JS content type"
|
55
|
-
|
56
53
|
assert_equal 'private', last_response.headers['Cache-Control'], "Should be cache busting"
|
57
54
|
assert_equal 'no-cache', last_response.headers['Pragma'], "Should be cache busting with Pragma: no-cache"
|
58
55
|
assert_nil last_response.headers['ETag'], 'Should send no etag across'
|
59
56
|
|
57
|
+
assert_equal 200, last_response.status
|
58
|
+
assert_equal 'text/javascript;charset=utf-8', last_response.content_type, "Should set JS content type"
|
59
|
+
|
60
60
|
err = 'console.error("ExecJS::RuntimeError\n--> SyntaxError: :1:1: reserved word \"function\"")'
|
61
61
|
assert_equal err, last_response.body
|
62
62
|
end
|
@@ -110,6 +110,11 @@ class TestVitrineAssetCompiler < Test::Unit::TestCase
|
|
110
110
|
get '/faulty.css'
|
111
111
|
|
112
112
|
assert_equal 200, last_response.status
|
113
|
+
|
114
|
+
assert_equal 'private', last_response.headers['Cache-Control'], "Should be cache busting"
|
115
|
+
assert_equal 'no-cache', last_response.headers['Pragma'], "Should be cache busting with Pragma: no-cache"
|
116
|
+
assert_nil last_response.headers['ETag'], 'Should send no etag across'
|
117
|
+
|
113
118
|
assert last_response.body.include?('body:before {'), 'Should include the generated element selector'
|
114
119
|
assert last_response.body.include?('Sass::SyntaxError'), 'Should include the syntax error class'
|
115
120
|
end
|
data/vitrine.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "vitrine"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.25"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Julik Tarkhanov"]
|
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
50
|
s.add_runtime_dependency(%q<sinatra>, ["~> 1.4"])
|
51
51
|
s.add_runtime_dependency(%q<coffee-script>, ["~> 2.2"])
|
52
|
-
s.add_runtime_dependency(%q<sass>, ["
|
52
|
+
s.add_runtime_dependency(%q<sass>, ["= 3.3.0.rc.3"])
|
53
53
|
s.add_runtime_dependency(%q<rack-contrib>, [">= 0"])
|
54
54
|
s.add_runtime_dependency(%q<rack-livereload>, [">= 0"])
|
55
55
|
s.add_development_dependency(%q<guard>, ["~> 2.2"])
|
@@ -63,7 +63,7 @@ Gem::Specification.new do |s|
|
|
63
63
|
else
|
64
64
|
s.add_dependency(%q<sinatra>, ["~> 1.4"])
|
65
65
|
s.add_dependency(%q<coffee-script>, ["~> 2.2"])
|
66
|
-
s.add_dependency(%q<sass>, ["
|
66
|
+
s.add_dependency(%q<sass>, ["= 3.3.0.rc.3"])
|
67
67
|
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
68
68
|
s.add_dependency(%q<rack-livereload>, [">= 0"])
|
69
69
|
s.add_dependency(%q<guard>, ["~> 2.2"])
|
@@ -78,7 +78,7 @@ Gem::Specification.new do |s|
|
|
78
78
|
else
|
79
79
|
s.add_dependency(%q<sinatra>, ["~> 1.4"])
|
80
80
|
s.add_dependency(%q<coffee-script>, ["~> 2.2"])
|
81
|
-
s.add_dependency(%q<sass>, ["
|
81
|
+
s.add_dependency(%q<sass>, ["= 3.3.0.rc.3"])
|
82
82
|
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
83
83
|
s.add_dependency(%q<rack-livereload>, [">= 0"])
|
84
84
|
s.add_dependency(%q<guard>, ["~> 2.2"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vitrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: sass
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.3.0.rc.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - '
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.3.0.rc.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-contrib
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|