yarrow 0.2.7 → 0.2.8

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjkyNjg4NmRiYzY3OTc4YTI2ZTMxYjhjZjZjMDFkMDY0YmFhMDlhYQ==
4
+ NzRkODFhYjRmMDAyMTQ1OWJiOTdiYmJiNTZkMmJkOWM1NWEyODFmZQ==
5
5
  data.tar.gz: !binary |-
6
- Yjc1NzE0YzRiYzQzNjk5OTFiNjQ2MzQ3ZWU2ZWQzODc2MWI3NGRkNQ==
6
+ MmZhNjI3NGRlMGI2ZGY5YTQ3ZmVhMTMyOWQ1YzZmNTg2NzEyYTQ5Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGE5NTdmNDViN2MwY2JmMGQyY2Y5ZGM2OTAyNmNmNTZjZjg1Y2E1Mjg5OGM5
10
- YWVlZDUzOTg4ZDM2OTM0MmM3Y2VjMDA5YTI4MmNkYmVlYmNhNTEyNDg2MmI5
11
- NThkZDM4YjQ4NTk4OTVhMzg4Yjk4OTVjOTJmODRjMzVlNmU3ZmY=
9
+ YTI2ZGMwNmMzOTg3N2Q0YTAxNmEyYzI3YWU4ZDE5YTAwMjM5YjJjYmQxZDMy
10
+ NzI2YjRhNjA4YTVkYTU1ZDkyMTU1M2YwNzJmMGZhZDYyOTc0ODg4YjliOWEy
11
+ MTNkYTYyZDE4YWI0MmU0NjdiNmU4Y2MwZGQ3MWE3ZmZjMGUzNWM=
12
12
  data.tar.gz: !binary |-
13
- ZjVmZGY3ZDBiOGE5MjI5YmFhOWZiZWViNzM3MjhmZGM3NDAwYjAwMGJlNmU3
14
- NGM3NDA1YTliNDVhNzg5MjRhNzk1OTlmZjY1ODJmZTA3MTM0ZWU0OTU3ZDBk
15
- YzhiOTZiMzA5NWMwNzdjNDcyZjIwNWQ1ZjgxMjFjZTZiMzAzNGQ=
13
+ ZjgyYjU1NWM4OWQ0YTdjYjUwYWY4ODFkYzA4MWJlMzMzMDM4YmJmMTUwMjYx
14
+ YmEyZjA0YjhhNjE4NDVmOGU3ZjE3YTBjOTM4MGYwZGViYmI0YzA2ZWI2ZDhm
15
+ MzYxMzg5MGVkMDUwNzkyNjYwMGU0ODdhY2ZmNDg5NTE0ZmZkYjI=
@@ -50,6 +50,28 @@ module Yarrow
50
50
  @manifest_index['files'].values
51
51
  end
52
52
 
53
+ def css_logical_paths
54
+ select_by_extension(logical_paths, '.css')
55
+ end
56
+
57
+ def js_logical_paths
58
+ select_by_extension(logical_paths, '.js')
59
+ end
60
+
61
+ def css_digest_paths
62
+ select_by_extension(digest_paths, '.css')
63
+ end
64
+
65
+ def js_digest_paths
66
+ select_by_extension(digest_paths, '.js')
67
+ end
68
+
69
+ private
70
+
71
+ def select_by_extension(collection, ext)
72
+ collection.select { |asset| asset.end_with?(ext) }
73
+ end
74
+
53
75
  end
54
76
  end
55
77
  end
@@ -1,27 +1,23 @@
1
1
  module Yarrow
2
2
  module HTML
3
- module AssetTags
4
-
5
- def config
6
- Yarrow::Configuration.instance
7
- end
3
+ module AssetTags
4
+ include Yarrow::Configurable
8
5
 
9
6
  # TODO: make sprockets manifest optional/pluggable
10
7
  def manifest
11
8
  Yarrow::Assets::Manifest.new(config || {})
12
9
  end
13
10
 
14
- def all_script_tags
15
- out = []
16
- manifest.digest_paths.each do |asset|
17
- out << script_tag(:asset => asset)
18
- end
19
- out.join["\n"]
11
+ def script_tags
12
+ manifest.js_logical_paths.map { |asset_path| script_tag(asset: asset_path) }.join("\n")
20
13
  end
21
14
 
15
+ # TODO: support asset path option?
22
16
  def script_tag(options)
23
- if options.has_key? :asset and manifest.exists?(options[:asset])
24
- src_path = manifest.digest_path(options[:asset])
17
+ if options.has_key? :asset and manifest.exists? options[:asset]
18
+ script_path = manifest.digest_path(options[:asset])
19
+ assets_path = config.assets_path || ''
20
+ src_path = [assets_path, script_path].join('/')
25
21
  else
26
22
  src_path = options[:src]
27
23
  end
@@ -29,9 +25,12 @@ module Yarrow
29
25
  "<script src=\"#{src_path}\"></script>"
30
26
  end
31
27
 
28
+ # TODO: support asset path option?
32
29
  def link_tag(options)
33
- if options.has_key? :asset and manifest.exists?(options[:asset])
34
- href_path = manifest.digest_path(options[:asset])
30
+ if options.has_key? :asset and manifest.exists? options[:asset]
31
+ stylesheet_path = manifest.digest_path(options[:asset])
32
+ assets_path = config.assets_path || ''
33
+ href_path = [assets_path, stylesheet_path].join('/')
35
34
  else
36
35
  href_path = options[:href]
37
36
  end
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = "Yarrow"
3
- VERSION = "0.2.7"
3
+ VERSION = "0.2.8"
4
4
  end
data/lib/yarrow.rb CHANGED
@@ -1,20 +1,22 @@
1
- require "hashie"
2
- require "yaml"
1
+ require 'hashie'
2
+ require 'yaml'
3
3
 
4
- require_relative "yarrow/version"
5
- require_relative "yarrow/logging"
6
- require_relative "yarrow/configuration"
7
- require_relative "yarrow/console_runner"
8
- require_relative "yarrow/generator"
9
- require_relative "yarrow/model/index"
10
- require_relative "yarrow/model/base"
11
- require_relative "yarrow/output/mapper"
12
- require_relative "yarrow/output/generator"
13
- require_relative "yarrow/content_map"
14
- require_relative "yarrow/assets"
15
- require_relative "yarrow/html"
16
- require_relative "yarrow/tools/front_matter"
4
+ require 'yarrow/version'
5
+ require 'yarrow/logging'
6
+ require 'yarrow/configuration'
7
+ require 'yarrow/console_runner'
8
+ require 'yarrow/generator'
9
+ require 'yarrow/model/index'
10
+ require 'yarrow/model/base'
11
+ require 'yarrow/html/asset_tags'
12
+ require 'yarrow/output/mapper'
13
+ require 'yarrow/output/generator'
14
+ require 'yarrow/output/context'
15
+ require 'yarrow/content_map'
16
+ require 'yarrow/assets'
17
+ require 'yarrow/html'
18
+ require 'yarrow/tools/front_matter'
17
19
 
18
- # Dir[File.dirname(__FILE__) + "/yarrow/generators/*.rb"].each do |generator|
20
+ # Dir[File.dirname(__FILE__) + '/yarrow/generators/*.rb'].each do |generator|
19
21
  # require generator
20
22
  # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie