nutils 0.11.0 → 0.11.1

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.
@@ -13,9 +13,6 @@ module Nutils
13
13
  #
14
14
  # @param [String] content The content to filter.
15
15
  #
16
- # @todo Use the content to build a Sprocket Asset instead of just get the
17
- # `@item[:content_filename]`.
18
- #
19
16
  # @return [String] The filtered content.
20
17
  def run(content, params={})
21
18
  require 'sprockets'
@@ -33,9 +30,9 @@ module Nutils
33
30
  tmp_filename.open('w') { |io| io.puts content }
34
31
 
35
32
  load_path = params[:load_path] || []
36
- load_path << tmp_filename.dirname.realpath
33
+ load_path << filename.dirname.realpath
37
34
 
38
- env = ::Sprockets::Environment.new(tmp_filename.dirname.realpath)
35
+ env = ::Sprockets::Environment.new(filename.dirname.realpath)
39
36
 
40
37
  # Assign load paths to Sprockets
41
38
  load_path.each do |path|
@@ -45,13 +42,18 @@ module Nutils
45
42
  # Get the Sprockets BundledAsset object for the content
46
43
  main_asset = env.find_asset(tmp_filename.realpath)
47
44
 
45
+ # Select just the possible items that can be dependencies
46
+ possible_items = @items.select do |i|
47
+ load_path.find { |p| Pathname.new(p).realpath.to_s == Pathname.new(i[:content_filename]).dirname.realpath.to_s }
48
+ end
49
+
48
50
  # Get Nanoc::Item equivalent for each dependence managed by Sprockets
49
51
  dependencies = main_asset.dependencies.inject([]) do |dep, asset|
50
- item = @items.find { |i| asset.pathname == Pathname.new(i[:content_filename]).realpath }
52
+ item = possible_items.find { |i| asset.pathname == Pathname.new(i[:content_filename]).realpath }
51
53
  dep << item unless item.nil?
52
54
  dep
53
55
  end
54
- # Register Nanoc dependencies
56
+ # # Register Nanoc dependencies
55
57
  depend_on(dependencies) unless dependencies.nil?
56
58
 
57
59
  # Output compiled asset
data/lib/nutils.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Nutils
4
4
 
5
5
  # The current nutils version.
6
- VERSION = '0.11.0'
6
+ VERSION = '0.11.1'
7
7
 
8
8
  end
9
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 0
10
- version: 0.11.0
9
+ - 1
10
+ version: 0.11.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Arnau Siches
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-30 00:00:00 -04:00
18
+ date: 2011-10-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency