yarrow 0.7.6 → 0.8.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.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/lib/{yarrow/extensions → extensions}/mementus.rb +0 -0
- data/lib/yarrow/config.rb +20 -14
- data/lib/yarrow/configuration.rb +2 -4
- data/lib/yarrow/console_runner.rb +28 -55
- data/lib/yarrow/content/graph.rb +1 -1
- data/lib/yarrow/content/policy.rb +2 -0
- data/lib/yarrow/content/tree_expansion.rb +5 -9
- data/lib/yarrow/defaults.yml +3 -5
- data/lib/yarrow/generator.rb +18 -6
- data/lib/yarrow/help.txt +35 -0
- data/lib/yarrow/schema/definitions.rb +45 -9
- data/lib/yarrow/schema/entity.rb +29 -1
- data/lib/yarrow/schema/registry.rb +14 -0
- data/lib/yarrow/schema/types.rb +10 -10
- data/lib/yarrow/schema/value.rb +26 -0
- data/lib/yarrow/server.rb +1 -1
- data/lib/yarrow/version.rb +2 -2
- data/lib/yarrow/web/document.rb +42 -0
- data/lib/yarrow/web/generator.rb +57 -0
- data/lib/yarrow/web/manifest.rb +56 -0
- data/lib/yarrow/web/template.rb +21 -1
- data/lib/yarrow.rb +44 -40
- data/yarrow.gemspec +3 -0
- metadata +49 -9
- data/lib/yarrow/content/manifest.rb +0 -61
- data/lib/yarrow/extensions.rb +0 -1
- data/lib/yarrow/output/generator.rb +0 -43
- data/lib/yarrow/output/mapper.rb +0 -23
- data/lib/yarrow/output/result.rb +0 -13
- data/lib/yarrow/web/html_document.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d26941f2b464c551d825b73999b0365637b9e4feec159ee74de51a1abca3416e
|
4
|
+
data.tar.gz: 34081172c945cf83e97ab3ee03484436ba380de6c809c2dd87caaa50f1bba315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6300e2c0f83c741862cf6c49acc42118636a3832401706057b483d942c07a947ea1124b2c10e056cc5052e25a28a59f896216d0156911026639d16e0faa5ba73
|
7
|
+
data.tar.gz: 0b897183df8712cbc08d0a479ed1e1d129a90305ad76f9bc802ea262707026ff5ffa57890d0d26d49955f55721ffd0887510671c86430e4780564266758ebaed
|
data/.gitignore
CHANGED
File without changes
|
data/lib/yarrow/config.rb
CHANGED
@@ -37,17 +37,23 @@ module Yarrow
|
|
37
37
|
:port,
|
38
38
|
:host,
|
39
39
|
:handler,
|
40
|
-
|
41
|
-
:middleware,
|
42
|
-
#:root_dir
|
40
|
+
:middleware
|
43
41
|
)
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
class Output < Yarrow::Schema::Entity[:output]
|
44
|
+
attribute :generator, :string
|
45
|
+
attribute :template_dir, :path
|
46
|
+
#attribute :scripts, :array
|
47
|
+
end
|
49
48
|
|
50
49
|
# Top level root config namespace.
|
50
|
+
class Instance < Yarrow::Schema::Entity
|
51
|
+
attribute :source_dir, :path
|
52
|
+
attribute :output_dir, :path
|
53
|
+
attribute :meta, :any
|
54
|
+
attribute :server, :any
|
55
|
+
#attribute :output, :output
|
56
|
+
end
|
51
57
|
#
|
52
58
|
# `content_dir` and `output_dir` are placeholders and should be overriden
|
53
59
|
# with more fine-grained config for web and book outputs in future.
|
@@ -56,12 +62,12 @@ module Yarrow
|
|
56
62
|
# server locally.
|
57
63
|
#
|
58
64
|
# TODO: meta should be union of Type::Optional and Config::Meta
|
59
|
-
Instance = Yarrow::Schema::Value.new(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
)
|
65
|
+
# Instance = Yarrow::Schema::Value.new(
|
66
|
+
# project_dir: :path,
|
67
|
+
# content_dir: :path,
|
68
|
+
# output_dir: :path,
|
69
|
+
# meta: :any,
|
70
|
+
# server: :any
|
71
|
+
# )
|
66
72
|
end
|
67
73
|
end
|
data/lib/yarrow/configuration.rb
CHANGED
@@ -52,13 +52,11 @@ module Yarrow
|
|
52
52
|
# automated as part of the schema types or a default value should be
|
53
53
|
# generated here (eg: `"#{Dir.pwd}/docs"`)
|
54
54
|
out_dir_or_string = config[:output_dir] || ""
|
55
|
-
source_dir_or_string = config[:
|
56
|
-
content_dir_or_string = config[:content_dir] || ""
|
55
|
+
source_dir_or_string = config[:source_dir] || ""
|
57
56
|
|
58
57
|
Yarrow::Config::Instance.new(
|
59
58
|
output_dir: Pathname.new(File.expand_path(out_dir_or_string)),
|
60
|
-
|
61
|
-
content_dir: Pathname.new(File.expand_path(content_dir_or_string)),
|
59
|
+
source_dir: Pathname.new(File.expand_path(source_dir_or_string)),
|
62
60
|
meta: meta_obj,
|
63
61
|
server: server_obj
|
64
62
|
)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Yarrow
|
2
2
|
class ConsoleRunner
|
3
|
-
|
4
3
|
SUCCESS = 0
|
5
4
|
FAILURE = 1
|
6
5
|
|
@@ -12,20 +11,20 @@ module Yarrow
|
|
12
11
|
}
|
13
12
|
|
14
13
|
ALLOWED_CONFIG_FILES = [
|
15
|
-
|
16
|
-
|
14
|
+
".yarrowdoc",
|
15
|
+
"Yarrowdoc",
|
16
|
+
"yarrow.yml"
|
17
17
|
]
|
18
18
|
|
19
|
-
def initialize(
|
19
|
+
def initialize(args, io=STDOUT)
|
20
|
+
@arguments = args
|
20
21
|
@out = io
|
21
|
-
@arguments = arguments
|
22
22
|
@options = {}
|
23
23
|
@targets = []
|
24
|
-
@config = Configuration.load_defaults
|
25
24
|
end
|
26
25
|
|
27
26
|
def config
|
28
|
-
@config
|
27
|
+
@config ||= Configuration.load_defaults
|
29
28
|
end
|
30
29
|
|
31
30
|
def run_application
|
@@ -45,9 +44,7 @@ module Yarrow
|
|
45
44
|
|
46
45
|
process_configuration
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
run_output_process
|
47
|
+
run_generation_process
|
51
48
|
|
52
49
|
print_footer
|
53
50
|
|
@@ -80,17 +77,29 @@ module Yarrow
|
|
80
77
|
|
81
78
|
def process_configuration
|
82
79
|
# load_configuration(Dir.pwd)
|
80
|
+
default_config = Yarrow::Configuration.load_defaults
|
81
|
+
|
82
|
+
if @targets.empty?
|
83
|
+
@config = default_config
|
84
|
+
else
|
85
|
+
@config = Yarrow::Config::Instance.new(
|
86
|
+
output_dir: default_config.output_dir,
|
87
|
+
source_dir: @targets.first,
|
88
|
+
meta: default_config.meta,
|
89
|
+
server: default_config.meta
|
90
|
+
)
|
91
|
+
end
|
83
92
|
|
84
93
|
# @targets.each do |input_path|
|
85
94
|
# @config.deep_merge! load_configuration(input_path)
|
86
95
|
# end
|
87
96
|
|
88
|
-
if has_option?(:config)
|
89
|
-
|
90
|
-
|
91
|
-
end
|
97
|
+
# if has_option?(:config)
|
98
|
+
# path = @options[:config]
|
99
|
+
# @config.deep_merge! Configuration.load(path)
|
100
|
+
# end
|
92
101
|
|
93
|
-
|
102
|
+
#@config.options = @options.to_hash
|
94
103
|
|
95
104
|
# normalize_theme_path
|
96
105
|
|
@@ -139,9 +148,7 @@ module Yarrow
|
|
139
148
|
|
140
149
|
def run_generation_process
|
141
150
|
generator = Generator.new(@config)
|
142
|
-
generator.
|
143
|
-
p manifest
|
144
|
-
end
|
151
|
+
generator.generate
|
145
152
|
end
|
146
153
|
|
147
154
|
def print_header
|
@@ -149,7 +156,7 @@ module Yarrow
|
|
149
156
|
end
|
150
157
|
|
151
158
|
def print_footer
|
152
|
-
@out.puts "Content generated at {
|
159
|
+
@out.puts "Content generated at #{@config.output_dir}"
|
153
160
|
end
|
154
161
|
|
155
162
|
def print_error(e)
|
@@ -157,42 +164,8 @@ module Yarrow
|
|
157
164
|
end
|
158
165
|
|
159
166
|
def print_help
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
Usage:
|
164
|
-
|
165
|
-
$ yarrow [options]
|
166
|
-
$ yarrow [options] <input>
|
167
|
-
$ yarrow [options] <input input> <output>
|
168
|
-
|
169
|
-
Arguments
|
170
|
-
|
171
|
-
<input> - Path to source directory or an individual source file. If not supplied
|
172
|
-
defaults to the current working directory. Multiple directories
|
173
|
-
can be specified by repeating arguments, separated by whitespace.
|
174
|
-
|
175
|
-
<output> - Path to the generated documentation. If not supplied, defaults to
|
176
|
-
./docs in the current working directory. If it does not exist, it
|
177
|
-
is created. If it does exist it remains in place, but existing
|
178
|
-
files are overwritten by new files with the same name.
|
179
|
-
|
180
|
-
Options
|
181
|
-
|
182
|
-
Use -o or --option for boolean switches and --option=value or --option:value
|
183
|
-
for options that require an explicit value to be set.
|
184
|
-
|
185
|
-
-h --help [switch] Display this help message and exit
|
186
|
-
-v --version [switch] Display version header and exit
|
187
|
-
-c --config [string] Path to a config properties file
|
188
|
-
-p --packages [string] Defines package convention for the model
|
189
|
-
-t --theme [string] Template theme for generated docs
|
190
|
-
|
191
|
-
|
192
|
-
HELP
|
193
|
-
@out.puts help
|
167
|
+
help_path = Pathname.new(__dir__) + "help.txt"
|
168
|
+
@out.puts(help_path.read)
|
194
169
|
end
|
195
|
-
|
196
170
|
end
|
197
|
-
|
198
171
|
end
|
data/lib/yarrow/content/graph.rb
CHANGED
@@ -6,11 +6,6 @@ module Yarrow
|
|
6
6
|
#policy.match()
|
7
7
|
|
8
8
|
#p graph.n(:root).out(:directory).first.props[:name]
|
9
|
-
|
10
|
-
expand_impl(policy)
|
11
|
-
end
|
12
|
-
|
13
|
-
def expand_impl(policy)
|
14
9
|
type = policy.container
|
15
10
|
|
16
11
|
# If match path represents entire content dir, then include the entire
|
@@ -18,13 +13,14 @@ module Yarrow
|
|
18
13
|
# the collection.
|
19
14
|
#start_node = if policy.match_path == "."
|
20
15
|
start_node = if true
|
21
|
-
|
16
|
+
# TODO: match against source_dir
|
17
|
+
graph.n(:root).out(:directory)
|
22
18
|
else
|
23
|
-
graph.n(:root).out(name:
|
19
|
+
graph.n(:root).out(name: policy.container.to_s)
|
24
20
|
end
|
25
21
|
|
26
22
|
# Extract metadata from given start node
|
27
|
-
collection_metadata = extract_metadata(start_node,
|
23
|
+
collection_metadata = extract_metadata(start_node, policy.container)
|
28
24
|
|
29
25
|
# Collect all nested collections in the subgraph for this content type
|
30
26
|
subcollections = {}
|
@@ -37,7 +33,7 @@ module Yarrow
|
|
37
33
|
# Create a collection node representing a collection of documents
|
38
34
|
index = graph.create_node do |collection_node|
|
39
35
|
collection_node.label = :collection
|
40
|
-
collection_node.props[:type] =
|
36
|
+
collection_node.props[:type] = policy.container
|
41
37
|
collection_node.props[:name] = node.props[:name]
|
42
38
|
|
43
39
|
# TODO: title needs to be defined from metadata
|
data/lib/yarrow/defaults.yml
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# Default configuration settings for Yarrow.
|
2
2
|
# This is loaded when the configuration is initialized.
|
3
|
-
|
4
|
-
output_dir:
|
3
|
+
source_dir: content
|
4
|
+
output_dir: docs
|
5
5
|
meta:
|
6
6
|
title: Default Project
|
7
7
|
author: Default Name
|
8
8
|
output:
|
9
|
-
|
9
|
+
generator: web
|
10
10
|
template_dir: templates
|
11
|
-
object_map:
|
12
|
-
page: Yarrow::Model::Site.pages
|
13
11
|
assets:
|
14
12
|
input_dir: assets
|
15
13
|
output_dir: public/assets
|
data/lib/yarrow/generator.rb
CHANGED
@@ -21,17 +21,17 @@ module Yarrow
|
|
21
21
|
|
22
22
|
class FlattenManifest < Process::StepProcessor
|
23
23
|
accepts Content::Graph
|
24
|
-
provides
|
24
|
+
provides Web::Manifest
|
25
25
|
|
26
26
|
def step(content)
|
27
|
-
|
27
|
+
Web::Manifest.build(content.graph)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
class BuildOutput < Process::StepProcessor
|
32
|
-
|
33
|
-
|
34
|
-
end
|
31
|
+
# class BuildOutput < Process::StepProcessor
|
32
|
+
# accepts Output::Manifest
|
33
|
+
# provides Output::Result
|
34
|
+
# end
|
35
35
|
|
36
36
|
# Generates documentation from a model.
|
37
37
|
class Generator
|
@@ -50,8 +50,20 @@ module Yarrow
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
def generate
|
54
|
+
process do |manifest|
|
55
|
+
generators.each do |generator|
|
56
|
+
generator.generate(manifest)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
53
61
|
private
|
54
62
|
|
55
63
|
attr_reader :config, :workflow
|
64
|
+
|
65
|
+
def generators
|
66
|
+
[Web::Generator.new(config)]
|
67
|
+
end
|
56
68
|
end
|
57
69
|
end
|
data/lib/yarrow/help.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
See https://github.com/maetl/yarrow for more information.
|
2
|
+
|
3
|
+
Usage: yarrow [options] <source_dir...> <output_dir>
|
4
|
+
|
5
|
+
yarrow [options]
|
6
|
+
yarrow [options] <source_dir>
|
7
|
+
yarrow [options] <source_dir> <output_dir>
|
8
|
+
yarrow [options] <source_dir source_dir> <output_dir>
|
9
|
+
|
10
|
+
Arguments
|
11
|
+
|
12
|
+
<source_dir> - Path to source directory or an individual source file. If not
|
13
|
+
supplied defaults to the current working directory. Multiple
|
14
|
+
directories can be specified by repeating arguments, separated
|
15
|
+
by whitespace.
|
16
|
+
|
17
|
+
<output_dir> - Path to the generated documentation. If not supplied, defaults
|
18
|
+
to `./docs` in the current working directory. If it does not
|
19
|
+
exist, it is created. If it does exist it remains in place, but
|
20
|
+
existing files are overwritten by new files with the same name.
|
21
|
+
|
22
|
+
Options
|
23
|
+
|
24
|
+
Use -o or --option for boolean switches and --option=value or --option:value
|
25
|
+
for options that require an explicit value to be set.
|
26
|
+
|
27
|
+
-h --help [switch] Display this help message and exit
|
28
|
+
-v --version [switch] Display version header and exit
|
29
|
+
-c --config [string] Path to a config properties file
|
30
|
+
-p --packages [string] Defines package convention for the model
|
31
|
+
-t --theme [string] Template theme for generated docs
|
32
|
+
|
33
|
+
Not all these options currently work as they date back to when this library
|
34
|
+
was used for generating documentation for PHP codebases, before it was
|
35
|
+
generalised into a static site generator.
|
@@ -2,12 +2,18 @@ module Yarrow
|
|
2
2
|
module Schema
|
3
3
|
module Definitions
|
4
4
|
DEFINED_TYPES = {
|
5
|
-
#string: Types::String,
|
6
5
|
string: Types::Instance.of(String),
|
7
|
-
#integer: Types::Integer,
|
8
6
|
integer: Types::Instance.of(Integer),
|
9
|
-
|
10
|
-
|
7
|
+
symbol: Types::Instance.of(Symbol).accept(String, :to_sym),
|
8
|
+
path: Types::Instance.of(Pathname).accept(String),
|
9
|
+
any: Types::Any.new,
|
10
|
+
array: Types::List.of(Types::Any),
|
11
|
+
hash: Types::Map.of(Symbol => Types::Any)
|
12
|
+
}
|
13
|
+
|
14
|
+
TEMPLATE_TYPES = {
|
15
|
+
list: Types::List,
|
16
|
+
map: Types::Map
|
11
17
|
}
|
12
18
|
|
13
19
|
def self.register(identifier, type_class)
|
@@ -19,13 +25,43 @@ module Yarrow
|
|
19
25
|
end
|
20
26
|
|
21
27
|
def resolve_type(identifier)
|
22
|
-
#
|
28
|
+
# Type is directly resolvable from the definition table
|
29
|
+
return DEFINED_TYPES[identifier] if DEFINED_TYPES.key?(identifier)
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
31
|
+
if identifier.is_a?(Hash)
|
32
|
+
# If type identifier is a compound template extract its key and value mapping
|
33
|
+
key_id = identifier.keys.first
|
34
|
+
value_id = identifier.values.first
|
27
35
|
|
28
|
-
|
36
|
+
# Check if the given key is defined as a template type
|
37
|
+
unless TEMPLATE_TYPES.key?(key_id)
|
38
|
+
raise "compound type #{key_id} is not defined"
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get reference to the type class we want to resolve
|
42
|
+
template_type = TEMPLATE_TYPES[key_id]
|
43
|
+
|
44
|
+
# Resolve the type to an instance depending on structure of its template args
|
45
|
+
resolved_type = if value_id.is_a?(Hash)
|
46
|
+
# Map template with two argument constructor
|
47
|
+
template_type.new(
|
48
|
+
resolve_type(value_id.keys.first),
|
49
|
+
resolve_type(value_id.values.first)
|
50
|
+
)
|
51
|
+
else
|
52
|
+
# Use the single arg constructor with the given unit type
|
53
|
+
template_type.of(resolve_type(value_id).unit)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Cache the resolved type for later reference
|
57
|
+
DEFINED_TYPES[identifier] = resolved_type
|
58
|
+
|
59
|
+
# Return the resolve type
|
60
|
+
resolved_type
|
61
|
+
else
|
62
|
+
# Not a compound template so we know it’s missing in the lookup table
|
63
|
+
raise "type #{identifier} is not defined"
|
64
|
+
end
|
29
65
|
end
|
30
66
|
end
|
31
67
|
end
|
data/lib/yarrow/schema/entity.rb
CHANGED
@@ -13,6 +13,19 @@ module Yarrow
|
|
13
13
|
def dictionary
|
14
14
|
@dictionary ||= Dictionary.new({})
|
15
15
|
end
|
16
|
+
|
17
|
+
def [](label)
|
18
|
+
@label = label
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def inherited(class_name)
|
23
|
+
if @label
|
24
|
+
class_type = Yarrow::Schema::Types::Instance.of(class_name)
|
25
|
+
Yarrow::Schema::Definitions.register(@label, class_type)
|
26
|
+
@label = nil
|
27
|
+
end
|
28
|
+
end
|
16
29
|
end
|
17
30
|
|
18
31
|
def initialize(config)
|
@@ -33,11 +46,26 @@ module Yarrow
|
|
33
46
|
|
34
47
|
def to_h
|
35
48
|
dictionary.attr_names.reduce({}) do |attr_dict, name|
|
36
|
-
|
49
|
+
value = instance_variable_get("@#{name}")
|
50
|
+
|
51
|
+
attr_dict[name] = if value.respond_to?(:to_h)
|
52
|
+
value.to_h
|
53
|
+
else
|
54
|
+
value
|
55
|
+
end
|
56
|
+
|
37
57
|
attr_dict
|
38
58
|
end
|
39
59
|
end
|
40
60
|
|
61
|
+
def merge(other)
|
62
|
+
unless other.is_a?(self.class)
|
63
|
+
raise ArgumentError.new("cannot merge entities that are not the same type")
|
64
|
+
end
|
65
|
+
|
66
|
+
self.class.new(to_h.merge(other.to_h))
|
67
|
+
end
|
68
|
+
|
41
69
|
private
|
42
70
|
|
43
71
|
def dictionary
|
data/lib/yarrow/schema/types.rb
CHANGED
@@ -18,20 +18,20 @@ module Yarrow
|
|
18
18
|
new("#{t} does not implement #{m}")
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
class TypeClass
|
23
23
|
def self.of(unit_type)
|
24
24
|
new(unit_type)
|
25
25
|
end
|
26
26
|
|
27
27
|
attr_reader :unit, :accepts
|
28
|
-
|
28
|
+
|
29
29
|
def initialize(unit_type=nil)
|
30
30
|
@unit = unit_type
|
31
31
|
@accepts = {}
|
32
32
|
end
|
33
33
|
|
34
|
-
def accept(type, constructor)
|
34
|
+
def accept(type, constructor=:new)
|
35
35
|
accepts[type] = constructor
|
36
36
|
self
|
37
37
|
end
|
@@ -44,7 +44,7 @@ module Yarrow
|
|
44
44
|
constructor = accepts[input.class]
|
45
45
|
unit.send(constructor, input)
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def check_instance_of!(input)
|
49
49
|
unless input.instance_of?(unit)
|
50
50
|
raise CastError.instance_of(input.class, unit)
|
@@ -74,27 +74,27 @@ module Yarrow
|
|
74
74
|
check(input)
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
class Any < TypeClass
|
79
79
|
def cast(input)
|
80
80
|
input
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
class Instance < TypeClass
|
85
85
|
def check(input)
|
86
86
|
check_instance_of!(input)
|
87
87
|
input
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
class Kind < TypeClass
|
92
92
|
def check(input)
|
93
93
|
check_kind_of!(input)
|
94
94
|
input
|
95
95
|
end
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
class Interface < TypeClass
|
99
99
|
def self.any(*args)
|
100
100
|
interface_type = new(args)
|
@@ -117,7 +117,7 @@ module Yarrow
|
|
117
117
|
when :any then check_respond_to_any!(input, members)
|
118
118
|
when :all then check_respond_to_all!(input, members)
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
input
|
122
122
|
end
|
123
123
|
end
|
@@ -192,4 +192,4 @@ module Yarrow
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
195
|
-
end
|
195
|
+
end
|
data/lib/yarrow/schema/value.rb
CHANGED
@@ -50,6 +50,32 @@ module Yarrow
|
|
50
50
|
freeze
|
51
51
|
end
|
52
52
|
|
53
|
+
struct.define_method(:merge) do |other|
|
54
|
+
unless other.is_a?(self.class)
|
55
|
+
raise ArgumentError.new("cannot merge incompatible values")
|
56
|
+
end
|
57
|
+
|
58
|
+
kwargs = validator.attr_names.reduce({}) do |data, attr_name|
|
59
|
+
current_val = self.send(attr_name)
|
60
|
+
other_val = other.send(attr_name)
|
61
|
+
|
62
|
+
# TODO: handle optional types better
|
63
|
+
# call out to dictionary?
|
64
|
+
# validator.merge(attr_name, current_val, other_val)
|
65
|
+
data[attr_name] = if current_val.nil?
|
66
|
+
other_val
|
67
|
+
elsif other_val.nil?
|
68
|
+
current_val
|
69
|
+
else
|
70
|
+
other_val
|
71
|
+
end
|
72
|
+
|
73
|
+
data
|
74
|
+
end
|
75
|
+
|
76
|
+
struct.new(**kwargs)
|
77
|
+
end
|
78
|
+
|
53
79
|
struct
|
54
80
|
end
|
55
81
|
end
|
data/lib/yarrow/server.rb
CHANGED
data/lib/yarrow/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Yarrow
|
2
|
+
module Web
|
3
|
+
class Document
|
4
|
+
# This class is somewhat verbose for simplicity and long-term maintainability
|
5
|
+
# (having a clear and easy to follow construction, rather than doing anything
|
6
|
+
# too clever which has burned this lib in the past).
|
7
|
+
def initialize(item, parent, is_index)
|
8
|
+
@item = item
|
9
|
+
@parent = parent
|
10
|
+
@is_index = is_index
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
@item.props[:name]
|
15
|
+
end
|
16
|
+
|
17
|
+
def title
|
18
|
+
@item.props[:title]
|
19
|
+
end
|
20
|
+
|
21
|
+
def type
|
22
|
+
@item.props[:type]
|
23
|
+
end
|
24
|
+
|
25
|
+
def url
|
26
|
+
if @parent.nil?
|
27
|
+
"/"
|
28
|
+
else
|
29
|
+
segments = [@item.props[:name]]
|
30
|
+
current = @parent
|
31
|
+
|
32
|
+
until current.in(:collection).first.nil? do
|
33
|
+
segments << current.props[:name]
|
34
|
+
current = current.in(:collection).first
|
35
|
+
end
|
36
|
+
|
37
|
+
"/" + segments.reverse.join("/")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Yarrow
|
2
|
+
module Web
|
3
|
+
class Generator
|
4
|
+
attr_reader :config
|
5
|
+
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
# Config is here but we haven’t decided on schema for web publishing fields
|
9
|
+
# so hard-code the needed values as part of this prototype
|
10
|
+
@default_host = "http://example.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate(manifest)
|
14
|
+
Parallel.each(manifest.documents) do |document|
|
15
|
+
write_document(document)
|
16
|
+
end
|
17
|
+
#generate_sitemap(manifest)
|
18
|
+
end
|
19
|
+
|
20
|
+
def write_document(document)
|
21
|
+
template = Template.for_document(document)
|
22
|
+
write_output_file(document.url, template.render(document))
|
23
|
+
end
|
24
|
+
|
25
|
+
def write_output_file(url, content)
|
26
|
+
# If the target path is a directory,
|
27
|
+
# generate a default index filename.
|
28
|
+
if url[url.length-1] == '/'
|
29
|
+
url = "#{url}index"
|
30
|
+
end
|
31
|
+
|
32
|
+
# Construct full path to file in output dir
|
33
|
+
path = @config.output_dir.join(url.delete_prefix("/")).sub_ext('.html')
|
34
|
+
|
35
|
+
# Create directory path if it doesn’t exist
|
36
|
+
FileUtils.mkdir_p(path.dirname)
|
37
|
+
|
38
|
+
# Write out the file
|
39
|
+
File.open(path.to_s, 'w+:UTF-8') do |file|
|
40
|
+
file.puts(content)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_sitemap(manifest)
|
45
|
+
# SitemapGenerator::Sitemap.default_host = @default_host
|
46
|
+
# SitemapGenerator::Sitemap.public_path = @public_dir
|
47
|
+
# SitemapGenerator::Sitemap.create do
|
48
|
+
# manifest.documents.each do |document|
|
49
|
+
# # Options: :changefreq, :lastmod, :priority, :expires
|
50
|
+
# #add(document.url, lastmod: document.published_at)
|
51
|
+
# add(document.url)
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/yarrow/web/manifest.rb
CHANGED
@@ -1,8 +1,64 @@
|
|
1
1
|
module Yarrow
|
2
2
|
module Web
|
3
3
|
class Manifest
|
4
|
+
def self.build(graph)
|
5
|
+
manifest = new
|
6
|
+
|
7
|
+
graph.n(:collection).each do |collection|
|
8
|
+
# TODO: raise error if both content_only and index_only are set
|
9
|
+
index = nil
|
10
|
+
|
11
|
+
# If the collection is tagged :index_only then skip adding individual documents
|
12
|
+
unless collection.props[:index_only]
|
13
|
+
collection.out(:item).each do |item|
|
14
|
+
#if item[:entity].status.to_sym == :published
|
15
|
+
if item.props[:name] == "index"
|
16
|
+
index = item
|
17
|
+
else
|
18
|
+
manifest.add_document(item_context(item))
|
19
|
+
end
|
20
|
+
#end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# If the collection is tagged :content_only then skip top level listing/index
|
25
|
+
unless collection.props[:content_only]
|
26
|
+
if index
|
27
|
+
manifest.add_document(collection_index_context(collection, index))
|
28
|
+
else
|
29
|
+
manifest.add_document(collection_context(collection))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
manifest
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_reader :documents, :assets
|
38
|
+
|
4
39
|
def initialize
|
40
|
+
@documents = []
|
41
|
+
@assets = []
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_document(document)
|
45
|
+
@documents << document
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_asset(asset)
|
49
|
+
@assets << asset
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.collection_context(collection)
|
53
|
+
Document.new(collection, collection.in(:collection).first, true)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.collection_index_context(collection, item)
|
57
|
+
Document.new(item, collection.in(:collection).first, false)
|
58
|
+
end
|
5
59
|
|
60
|
+
def self.item_context(item)
|
61
|
+
Document.new(item, item.in(:collection).first, false)
|
6
62
|
end
|
7
63
|
end
|
8
64
|
end
|
data/lib/yarrow/web/template.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
1
|
module Yarrow
|
2
2
|
module Web
|
3
3
|
class Template
|
4
|
-
def
|
4
|
+
def self.for_document(document)
|
5
|
+
layout_name = if document.respond_to?(:layout)
|
6
|
+
document.layout || document.type
|
7
|
+
else
|
8
|
+
document.type
|
9
|
+
end
|
5
10
|
|
11
|
+
@template_dir = "./spec/fixtures/templates/doctest"
|
12
|
+
@template_ext = ".html"
|
13
|
+
|
14
|
+
template_file = "#{layout_name}#{@template_ext}"
|
15
|
+
template_path = Pathname.new(@template_dir) + template_file
|
16
|
+
|
17
|
+
new(template_path.read)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(source)
|
21
|
+
@source = source
|
22
|
+
end
|
23
|
+
|
24
|
+
def render(document)
|
25
|
+
Mustache.render(@source, document)
|
6
26
|
end
|
7
27
|
end
|
8
28
|
end
|
data/lib/yarrow.rb
CHANGED
@@ -1,46 +1,50 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "pathname"
|
2
|
+
require "yaml"
|
3
|
+
require "mustache"
|
4
|
+
require "parallel"
|
3
5
|
|
4
|
-
require
|
5
|
-
require 'yarrow/extensions'
|
6
|
-
require 'yarrow/symbols'
|
7
|
-
require 'yarrow/logging'
|
8
|
-
require 'yarrow/schema/types'
|
9
|
-
require 'yarrow/schema/definitions'
|
10
|
-
require 'yarrow/schema/dictionary'
|
11
|
-
require 'yarrow/schema/entity'
|
12
|
-
require 'yarrow/schema/value'
|
13
|
-
require 'yarrow/config'
|
14
|
-
require 'yarrow/configuration'
|
15
|
-
require 'yarrow/console_runner'
|
16
|
-
require 'yarrow/tools/front_matter'
|
17
|
-
require 'yarrow/tools/content_utils'
|
18
|
-
require 'yarrow/content/graph'
|
19
|
-
require 'yarrow/content/source'
|
20
|
-
require 'yarrow/content/expansion'
|
21
|
-
require 'yarrow/content/expansion_strategy'
|
22
|
-
require 'yarrow/content/tree_expansion'
|
23
|
-
require 'yarrow/content/manifest'
|
24
|
-
require 'yarrow/content/resource'
|
25
|
-
require 'yarrow/content/model'
|
26
|
-
require 'yarrow/content/policy'
|
27
|
-
require 'yarrow/output/mapper'
|
28
|
-
require 'yarrow/output/generator'
|
29
|
-
require 'yarrow/output/context'
|
30
|
-
require 'yarrow/output/result'
|
31
|
-
require 'yarrow/output/web/indexed_file'
|
32
|
-
require 'yarrow/content_map'
|
33
|
-
require 'yarrow/server'
|
34
|
-
require 'yarrow/server/livereload'
|
6
|
+
require "extensions/mementus"
|
35
7
|
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
39
|
-
require
|
40
|
-
require
|
8
|
+
require "yarrow/version"
|
9
|
+
require "yarrow/symbols"
|
10
|
+
require "yarrow/logging"
|
11
|
+
require "yarrow/schema/types"
|
12
|
+
require "yarrow/schema/definitions"
|
13
|
+
require "yarrow/schema/dictionary"
|
14
|
+
require "yarrow/schema/entity"
|
15
|
+
require "yarrow/schema/value"
|
16
|
+
require "yarrow/schema/registry"
|
17
|
+
require "yarrow/config"
|
18
|
+
require "yarrow/configuration"
|
19
|
+
require "yarrow/console_runner"
|
20
|
+
require "yarrow/tools/front_matter"
|
21
|
+
require "yarrow/tools/content_utils"
|
22
|
+
require "yarrow/content/graph"
|
23
|
+
require "yarrow/content/source"
|
24
|
+
require "yarrow/content/expansion"
|
25
|
+
require "yarrow/content/expansion_strategy"
|
26
|
+
require "yarrow/content/tree_expansion"
|
27
|
+
require "yarrow/content/resource"
|
28
|
+
require "yarrow/content/model"
|
29
|
+
require "yarrow/content/policy"
|
30
|
+
require "yarrow/web/manifest"
|
31
|
+
require "yarrow/web/document"
|
32
|
+
require "yarrow/web/generator"
|
33
|
+
require "yarrow/web/template"
|
34
|
+
require "yarrow/output/context"
|
35
|
+
require "yarrow/output/web/indexed_file"
|
36
|
+
require "yarrow/content_map"
|
37
|
+
require "yarrow/server"
|
38
|
+
require "yarrow/server/livereload"
|
41
39
|
|
42
|
-
require
|
40
|
+
require "yarrow/process/workflow"
|
41
|
+
require "yarrow/process/step_processor"
|
42
|
+
require "yarrow/process/expand_content"
|
43
|
+
require "yarrow/process/extract_source"
|
44
|
+
require "yarrow/process/project_manifest"
|
43
45
|
|
44
|
-
|
46
|
+
require "yarrow/generator"
|
47
|
+
|
48
|
+
# Dir[File.dirname(__FILE__) + "/yarrow/generators/*.rb"].each do |generator|
|
45
49
|
# require generator
|
46
50
|
# end
|
data/yarrow.gemspec
CHANGED
@@ -13,12 +13,15 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
14
14
|
spec.executables << 'yarrow'
|
15
15
|
spec.executables << 'yarrow-server'
|
16
|
+
spec.add_runtime_dependency 'addressable', '~> 2.8'
|
16
17
|
spec.add_runtime_dependency 'mementus', '~> 0.8'
|
17
18
|
spec.add_runtime_dependency 'rack', '~> 3.0'
|
18
19
|
spec.add_runtime_dependency 'rackup', '~> 0.2'
|
19
20
|
spec.add_runtime_dependency 'rack-livereload', '~> 0.3'
|
20
21
|
spec.add_runtime_dependency 'eventmachine', '~> 1.2'
|
21
22
|
spec.add_runtime_dependency 'em-websocket', '~> 0.5.1'
|
23
|
+
spec.add_runtime_dependency 'mustache', '~> 1.1.1'
|
24
|
+
spec.add_runtime_dependency 'parallel', '~> 1.22.1'
|
22
25
|
spec.add_runtime_dependency 'strings-inflection', '~> 0.1'
|
23
26
|
spec.add_runtime_dependency 'strings-case', '~> 0.3'
|
24
27
|
spec.add_runtime_dependency 'kramdown', '~> 2.4.0'
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yarrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickerby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.8'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: mementus
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,34 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: 0.5.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mustache
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.1.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.1.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: parallel
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.22.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.22.1
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
140
|
name: strings-inflection
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,6 +252,7 @@ files:
|
|
210
252
|
- SERVER.md
|
211
253
|
- bin/yarrow
|
212
254
|
- bin/yarrow-server
|
255
|
+
- lib/extensions/mementus.rb
|
213
256
|
- lib/yarrow.rb
|
214
257
|
- lib/yarrow/assets.rb
|
215
258
|
- lib/yarrow/assets/manifest.rb
|
@@ -220,7 +263,6 @@ files:
|
|
220
263
|
- lib/yarrow/content/expansion.rb
|
221
264
|
- lib/yarrow/content/expansion_strategy.rb
|
222
265
|
- lib/yarrow/content/graph.rb
|
223
|
-
- lib/yarrow/content/manifest.rb
|
224
266
|
- lib/yarrow/content/model.rb
|
225
267
|
- lib/yarrow/content/policy.rb
|
226
268
|
- lib/yarrow/content/resource.rb
|
@@ -228,14 +270,10 @@ files:
|
|
228
270
|
- lib/yarrow/content/tree_expansion.rb
|
229
271
|
- lib/yarrow/content_map.rb
|
230
272
|
- lib/yarrow/defaults.yml
|
231
|
-
- lib/yarrow/extensions.rb
|
232
|
-
- lib/yarrow/extensions/mementus.rb
|
233
273
|
- lib/yarrow/generator.rb
|
274
|
+
- lib/yarrow/help.txt
|
234
275
|
- lib/yarrow/logging.rb
|
235
276
|
- lib/yarrow/output/context.rb
|
236
|
-
- lib/yarrow/output/generator.rb
|
237
|
-
- lib/yarrow/output/mapper.rb
|
238
|
-
- lib/yarrow/output/result.rb
|
239
277
|
- lib/yarrow/output/web/indexed_file.rb
|
240
278
|
- lib/yarrow/process/expand_content.rb
|
241
279
|
- lib/yarrow/process/extract_source.rb
|
@@ -245,6 +283,7 @@ files:
|
|
245
283
|
- lib/yarrow/schema/definitions.rb
|
246
284
|
- lib/yarrow/schema/dictionary.rb
|
247
285
|
- lib/yarrow/schema/entity.rb
|
286
|
+
- lib/yarrow/schema/registry.rb
|
248
287
|
- lib/yarrow/schema/types.rb
|
249
288
|
- lib/yarrow/schema/validations/array.rb
|
250
289
|
- lib/yarrow/schema/validations/object.rb
|
@@ -257,7 +296,8 @@ files:
|
|
257
296
|
- lib/yarrow/tools/content_utils.rb
|
258
297
|
- lib/yarrow/tools/front_matter.rb
|
259
298
|
- lib/yarrow/version.rb
|
260
|
-
- lib/yarrow/web/
|
299
|
+
- lib/yarrow/web/document.rb
|
300
|
+
- lib/yarrow/web/generator.rb
|
261
301
|
- lib/yarrow/web/manifest.rb
|
262
302
|
- lib/yarrow/web/static_asset.rb
|
263
303
|
- lib/yarrow/web/template.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module Yarrow
|
2
|
-
module Content
|
3
|
-
class Manifest
|
4
|
-
def self.build(graph)
|
5
|
-
manifest = new
|
6
|
-
|
7
|
-
graph.n(:collection).each do |collection|
|
8
|
-
|
9
|
-
unless collection.props[:content_only]
|
10
|
-
manifest.add_document(collection_context(collection))
|
11
|
-
end
|
12
|
-
|
13
|
-
unless collection.props[:index_only]
|
14
|
-
collection.out(:item).each do |item|
|
15
|
-
#if item[:entity].status.to_sym == :published
|
16
|
-
manifest.add_document(item_context(item))
|
17
|
-
#end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
manifest
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_reader :documents, :assets
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@documents = []
|
29
|
-
@assets = []
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.collection_context(collection)
|
33
|
-
Yarrow::Output::Context.new(
|
34
|
-
parent: collection.in(:collection).first,
|
35
|
-
name: collection.props[:name],
|
36
|
-
#url: collection.props[:url],
|
37
|
-
title: collection.props[:title],
|
38
|
-
type: collection.props[:type]
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.item_context(item)
|
43
|
-
Yarrow::Output::Context.new(
|
44
|
-
parent: item.in(:collection).first,
|
45
|
-
name: item.props[:name],
|
46
|
-
#url: item.props[:url],
|
47
|
-
title: item.props[:title],
|
48
|
-
type: item.props[:type]
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
|
-
def add_document(document)
|
53
|
-
@documents << document
|
54
|
-
end
|
55
|
-
|
56
|
-
def add_asset(asset)
|
57
|
-
@assets << asset
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/lib/yarrow/extensions.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "yarrow/extensions/mementus"
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Yarrow
|
2
|
-
module Output
|
3
|
-
# Generates documentation from an object model.
|
4
|
-
class Generator
|
5
|
-
def initialize(config={})
|
6
|
-
@config = config
|
7
|
-
end
|
8
|
-
|
9
|
-
# Mapping between template types and provided object model
|
10
|
-
def object_map
|
11
|
-
@config[:output][:object_map]
|
12
|
-
end
|
13
|
-
|
14
|
-
# Mapping between template types and provided output templates.
|
15
|
-
def template_map
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
# Template converter used by this generator instance.
|
20
|
-
def converter
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
def write_output_file(filename, content)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Builds the output documentation.
|
28
|
-
def build_docs
|
29
|
-
object_map.each do |index, objects|
|
30
|
-
objects.each do |object|
|
31
|
-
template_context = {
|
32
|
-
#:meta => Site
|
33
|
-
index => object
|
34
|
-
}
|
35
|
-
content = converter.render(template_map[index], template_context)
|
36
|
-
filename = converter.filename_for(object)
|
37
|
-
write_output_file(filename, content)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/yarrow/output/mapper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Yarrow
|
2
|
-
module Output
|
3
|
-
class Mapper
|
4
|
-
|
5
|
-
def initialize(config)
|
6
|
-
@config = config
|
7
|
-
end
|
8
|
-
|
9
|
-
def object_map
|
10
|
-
@config.output.object_map
|
11
|
-
end
|
12
|
-
|
13
|
-
def template_map
|
14
|
-
@config.output.template_map
|
15
|
-
end
|
16
|
-
|
17
|
-
def model
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/yarrow/output/result.rb
DELETED