yarrow 0.2.8 → 0.2.9
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 +5 -13
- data/lib/yarrow/assets/manifest.rb +7 -4
- data/lib/yarrow/assets/pipeline.rb +33 -8
- data/lib/yarrow/configuration.rb +6 -1
- data/lib/yarrow/defaults.yml +13 -2
- data/lib/yarrow/html/asset_tags.rb +16 -5
- data/lib/yarrow/model/index.rb +0 -1
- data/lib/yarrow/version.rb +1 -1
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmZhNjI3NGRlMGI2ZGY5YTQ3ZmVhMTMyOWQ1YzZmNTg2NzEyYTQ5Yg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a67be8972c7ab61211651896258120b27485152
|
4
|
+
data.tar.gz: 09c34931e14fdc5099565347d47b8876df831102
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NzI2YjRhNjA4YTVkYTU1ZDkyMTU1M2YwNzJmMGZhZDYyOTc0ODg4YjliOWEy
|
11
|
-
MTNkYTYyZDE4YWI0MmU0NjdiNmU4Y2MwZGQ3MWE3ZmZjMGUzNWM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZjgyYjU1NWM4OWQ0YTdjYjUwYWY4ODFkYzA4MWJlMzMzMDM4YmJmMTUwMjYx
|
14
|
-
YmEyZjA0YjhhNjE4NDVmOGU3ZjE3YTBjOTM4MGYwZGViYmI0YzA2ZWI2ZDhm
|
15
|
-
MzYxMzg5MGVkMDUwNzkyNjYwMGU0ODdhY2ZmNDg5NTE0ZmZkYjI=
|
6
|
+
metadata.gz: 17007867d65925330adf3f5cf13ae1c15cd72d407c808cfa2908044ac348e3e1b430b71c9c1cb6d73078d22450d5bbad20d665f6547ec68b624a706017f49f69
|
7
|
+
data.tar.gz: 9a912fe2206f7d061f286e6dba240aaf45642b79af3d19d59d9e252c2be542f0a91ff2e0fa93cd3af23f1ca7cb57efa7f436967fcf1b704c6fcf15aea1ee0948
|
@@ -6,14 +6,17 @@ module Yarrow
|
|
6
6
|
|
7
7
|
##
|
8
8
|
# Provides access to the bundle of compiled CSS and JS assets.
|
9
|
-
#
|
10
9
|
class Manifest
|
11
10
|
|
11
|
+
##
|
12
|
+
# @param config [Yarrow::Configuration]
|
12
13
|
def initialize(config)
|
13
|
-
|
14
|
-
|
14
|
+
raise Yarrow::ConfigurationError if config.assets.nil?
|
15
|
+
|
16
|
+
if config.assets.output_dir
|
17
|
+
manifest_path = Pathname.new(config.assets.output_dir) + config.assets.manifest_file
|
15
18
|
else
|
16
|
-
manifest_path =
|
19
|
+
manifest_path = Pathname.new(config.output_dir) + config.assets.manifest_file
|
17
20
|
end
|
18
21
|
|
19
22
|
if File.exists?(manifest_path)
|
@@ -4,6 +4,7 @@ require 'sprockets'
|
|
4
4
|
|
5
5
|
module Yarrow
|
6
6
|
module Assets
|
7
|
+
##
|
7
8
|
# A framework for processing and compressing static assets using Sprockets.
|
8
9
|
class Pipeline
|
9
10
|
|
@@ -11,17 +12,24 @@ module Yarrow
|
|
11
12
|
|
12
13
|
attr_reader :input_dir, :output_dir, :append_paths, :bundles, :assets
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
##
|
16
|
+
# @param config [Yarrow::Configuration]
|
17
|
+
def initialize(config)
|
18
|
+
raise Yarrow::ConfigurationError if config.assets.nil?
|
16
19
|
|
17
|
-
@input_dir =
|
18
|
-
|
20
|
+
@input_dir = config.assets.input_dir || default_input_dir
|
21
|
+
|
22
|
+
if config.assets.output_dir
|
23
|
+
@output_dir = config.assets.output_dir
|
24
|
+
else
|
25
|
+
@output_dir = config.output_dir || default_output_dir
|
26
|
+
end
|
19
27
|
|
20
28
|
@append_paths = []
|
21
29
|
|
22
|
-
case
|
30
|
+
case config.assets.append_paths
|
23
31
|
when Array
|
24
|
-
@append_paths =
|
32
|
+
@append_paths = config.assets.append_paths
|
25
33
|
when '*'
|
26
34
|
@append_paths = Dir[@input_dir + '/*'].select do |path|
|
27
35
|
File.directory?(path)
|
@@ -29,7 +37,7 @@ module Yarrow
|
|
29
37
|
File.basename(path)
|
30
38
|
end
|
31
39
|
when String
|
32
|
-
@append_paths <<
|
40
|
+
@append_paths << config.assets.append_paths
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
@@ -37,7 +45,6 @@ module Yarrow
|
|
37
45
|
# Also generates a manifest linking each output bundle to its given input name.
|
38
46
|
# @param bundles [Array<String>]
|
39
47
|
def compile(bundles = [])
|
40
|
-
manifest = Sprockets::Manifest.new(environment, manifest_file_path)
|
41
48
|
bundles.each do |bundle|
|
42
49
|
if bundle.include? '*'
|
43
50
|
Dir["#{@input_dir}/#{bundle}"].each do |asset|
|
@@ -59,7 +66,21 @@ module Yarrow
|
|
59
66
|
end
|
60
67
|
end
|
61
68
|
|
69
|
+
##
|
70
|
+
# Purges redundant compiled assets from the output path.
|
71
|
+
#
|
72
|
+
# @example Purge all assets except those created in the last 10 minutes
|
73
|
+
# pipeline.purge(0, )
|
74
|
+
#
|
75
|
+
# @param keep [Integer] Number of previous revisions to keep. Defaults to 2.
|
76
|
+
# @param age [Integer] Purge all assets older than this date. Defaults to 1 hour.
|
77
|
+
def purge(keep = 2, age = 3600)
|
78
|
+
# TODO: upgrade to Sprockets 3.0 to support the age arg
|
79
|
+
manifest.clean(keep)
|
80
|
+
end
|
81
|
+
|
62
82
|
# Access instance of the Sprockets environment.
|
83
|
+
# TODO: make this private to avoid forcing a dependency on Sprockets
|
63
84
|
def environment
|
64
85
|
@environment ||= create_environment
|
65
86
|
end
|
@@ -78,6 +99,10 @@ module Yarrow
|
|
78
99
|
"#{@output_dir}/manifest.json"
|
79
100
|
end
|
80
101
|
|
102
|
+
def manifest
|
103
|
+
Sprockets::Manifest.new(environment, manifest_file_path)
|
104
|
+
end
|
105
|
+
|
81
106
|
def create_environment
|
82
107
|
environment = Sprockets::Environment.new(@input_dir)
|
83
108
|
|
data/lib/yarrow/configuration.rb
CHANGED
data/lib/yarrow/defaults.yml
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
# Default configuration settings for Yarrow.
|
2
2
|
# This is loaded when the configuration is initialized.
|
3
|
+
input_dir: content
|
4
|
+
output_dir: public
|
3
5
|
meta:
|
4
6
|
title: Default Project
|
5
|
-
author:
|
7
|
+
author: Default Name
|
6
8
|
output:
|
9
|
+
target_dir: public
|
10
|
+
template_dir: templates
|
7
11
|
object_map:
|
8
|
-
page: Yarrow::Model::Site.pages
|
12
|
+
page: Yarrow::Model::Site.pages
|
13
|
+
assets:
|
14
|
+
input_dir: assets
|
15
|
+
output_dir: public/assets
|
16
|
+
append_paths:
|
17
|
+
- css
|
18
|
+
- js
|
19
|
+
manifest_file: manifest.json
|
@@ -5,7 +5,20 @@ module Yarrow
|
|
5
5
|
|
6
6
|
# TODO: make sprockets manifest optional/pluggable
|
7
7
|
def manifest
|
8
|
-
Yarrow::Assets::Manifest.new(config
|
8
|
+
Yarrow::Assets::Manifest.new(config)
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# Computes the base URL path to assets in the public web directory.
|
13
|
+
def base_url_path
|
14
|
+
raise Yarrow::ConfigurationError if config.assets.nil?
|
15
|
+
raise Yarrow::ConfigurationError if config.output_dir.nil?
|
16
|
+
|
17
|
+
# TODO: prepend configurable CDN URL for host path
|
18
|
+
# TODO: dev/production mode switch
|
19
|
+
|
20
|
+
assets_path = config.assets.output_dir
|
21
|
+
assets_path.gsub(config.output_dir, '')
|
9
22
|
end
|
10
23
|
|
11
24
|
def script_tags
|
@@ -16,8 +29,7 @@ module Yarrow
|
|
16
29
|
def script_tag(options)
|
17
30
|
if options.has_key? :asset and manifest.exists? options[:asset]
|
18
31
|
script_path = manifest.digest_path(options[:asset])
|
19
|
-
|
20
|
-
src_path = [assets_path, script_path].join('/')
|
32
|
+
src_path = "#{base_url_path}/#{script_path}"
|
21
33
|
else
|
22
34
|
src_path = options[:src]
|
23
35
|
end
|
@@ -29,8 +41,7 @@ module Yarrow
|
|
29
41
|
def link_tag(options)
|
30
42
|
if options.has_key? :asset and manifest.exists? options[:asset]
|
31
43
|
stylesheet_path = manifest.digest_path(options[:asset])
|
32
|
-
|
33
|
-
href_path = [assets_path, stylesheet_path].join('/')
|
44
|
+
href_path = "#{base_url_path}/#{stylesheet_path}"
|
34
45
|
else
|
35
46
|
href_path = options[:href]
|
36
47
|
end
|
data/lib/yarrow/model/index.rb
CHANGED
data/lib/yarrow/version.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yarrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickerby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sprockets
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mementus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
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
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: coveralls
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Yarrow is a tool for generating well structured documentation from a
|
@@ -131,17 +131,18 @@ extensions: []
|
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
133
|
- bin/yarrow
|
134
|
+
- lib/yarrow.rb
|
135
|
+
- lib/yarrow/assets.rb
|
134
136
|
- lib/yarrow/assets/manifest.rb
|
135
137
|
- lib/yarrow/assets/pipeline.rb
|
136
|
-
- lib/yarrow/assets.rb
|
137
138
|
- lib/yarrow/configuration.rb
|
138
139
|
- lib/yarrow/console_runner.rb
|
139
140
|
- lib/yarrow/content_map.rb
|
140
141
|
- lib/yarrow/defaults.yml
|
141
142
|
- lib/yarrow/generator.rb
|
143
|
+
- lib/yarrow/html.rb
|
142
144
|
- lib/yarrow/html/asset_tags.rb
|
143
145
|
- lib/yarrow/html/content_tags.rb
|
144
|
-
- lib/yarrow/html.rb
|
145
146
|
- lib/yarrow/logging.rb
|
146
147
|
- lib/yarrow/model/base.rb
|
147
148
|
- lib/yarrow/model/index.rb
|
@@ -150,7 +151,6 @@ files:
|
|
150
151
|
- lib/yarrow/output/mapper.rb
|
151
152
|
- lib/yarrow/tools/front_matter.rb
|
152
153
|
- lib/yarrow/version.rb
|
153
|
-
- lib/yarrow.rb
|
154
154
|
homepage: http://rubygemspec.org/gems/yarrow
|
155
155
|
licenses:
|
156
156
|
- MIT
|
@@ -161,17 +161,17 @@ require_paths:
|
|
161
161
|
- lib
|
162
162
|
required_ruby_version: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- -
|
169
|
+
- - ">="
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.
|
174
|
+
rubygems_version: 2.4.2
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Documentation generator based on a fluent data model.
|