stylus 0.6.0 → 0.6.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.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,17 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.6.2 (2012-06-01)
4
+ [Compare view](https://github.com/lucasmazza/ruby-stylus/compare/v0.6.1...v0.6.2)
5
+
6
+ * Fixes namespacing clashing between `Stylus::Sprockets` and the `Sprockets` modules.
7
+
8
+ ### 0.6.1 (2012-05-31) (yanked)
9
+ [Compare view](https://github.com/lucasmazza/ruby-stylus/compare/v0.6.0...v0.6.1)
10
+
11
+ * Skips `Sprockets::FileNotFound` errors on the ImportProcessor.
12
+
3
13
  ### 0.6.0 (2012-05-20)
4
- [Compare view](https://github.com/lucasmazza/ruby-stylus/compare/v0.5.1...v.0.6.0)
14
+ [Compare view](https://github.com/lucasmazza/ruby-stylus/compare/v0.5.1...v0.6.0)
5
15
 
6
16
  * Sprockets configuration extracted to `Stylus.setup` - you can use this on a Sinatra or Rack app;
7
17
  * When `node` isn't available, Stylus will raise a exception of it's own instead of blowing up inside ExecJS.
@@ -23,7 +23,7 @@ module Stylus
23
23
  dependencies = data.scan(IMPORT_SCANNER).flatten.compact.uniq
24
24
 
25
25
  dependencies.each do |path|
26
- asset = context.resolve(path, :content_type => 'text/css')
26
+ asset = resolve(context, path)
27
27
 
28
28
  if asset
29
29
  context.depend_on(asset)
@@ -31,5 +31,16 @@ module Stylus
31
31
  end
32
32
  data
33
33
  end
34
+
35
+ # Internal: Resolves the given 'path' with the Sprockets context, but
36
+ # avoids 'Sprockets::FileNotFound' exceptions since we might be importing
37
+ # files outside the Sprockets load path - like "nib".
38
+ #
39
+ # Returns the resolved 'Asset' or nil if it can't be found.
40
+ def resolve(context, path)
41
+ context.resolve(path, :content_type => 'text/css')
42
+ rescue ::Sprockets::FileNotFound
43
+ nil
44
+ end
34
45
  end
35
46
  end
@@ -1,3 +1,3 @@
1
1
  module Stylus
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -10,4 +10,15 @@ describe Stylus::ImportProcessor do
10
10
  sprockets.should_receive(:depend_on).with(dependency)
11
11
  template.render(sprockets)
12
12
  end
13
+
14
+ it "swallows errors from files outside the Sprockets paths" do
15
+ source = "@import 'nib'"
16
+ template = Stylus::ImportProcessor.new { source }
17
+ sprockets = double()
18
+ sprockets.should_receive(:resolve).and_raise(::Sprockets::FileNotFound)
19
+
20
+ expect {
21
+ template.render(sprockets)
22
+ }.to_not raise_error(::Sprockets::FileNotFound)
23
+ end
13
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-20 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs