yarrow 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.travis.yml +16 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +65 -0
- data/Rakefile +4 -0
- data/SERVER.md +41 -0
- data/lib/yarrow.rb +3 -0
- data/lib/yarrow/content/graph.rb +41 -0
- data/lib/yarrow/content/source_collector.rb +55 -0
- data/lib/yarrow/output/context.rb +0 -2
- data/lib/yarrow/version.rb +1 -1
- data/yarrow.gemspec +31 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7360a9c100d2a45cbf57a77fcec6a02f21156a6af46d22a6c438dd43ab07557f
|
4
|
+
data.tar.gz: c71c2e48c2b3118b1d3d734430925f9bee7981a89462df9a8e05bfc5d12fc3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77ed4fe864b0ad9f7d4a73b9787619f166eb5aa2631c70377e57de4c1f781f8da2bca717dafd98a940aff2e637590335e0076894b99a2f4e7ebbf94151acaa56
|
7
|
+
data.tar.gz: 6732e24c0275884b3cfbab5a417ab755b900ca8d94ffa00d7a84a6c90a042325615221785085d1913f1a0b26b54399b500d90f5beb6b6cd1c7183236e12beade
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2010-2014 by Mark Rickerby <http://maetl.net>.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
Yarrow
|
2
|
+
======
|
3
|
+
|
4
|
+
[![Gem Version](http://img.shields.io/gem/v/yarrow.svg)][gem]
|
5
|
+
[![Build Status](http://img.shields.io/travis/maetl/yarrow.svg)][travis]
|
6
|
+
[![Dependency Status](http://img.shields.io/gemnasium/maetl/yarrow.svg)][gemnasium]
|
7
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/maetl/yarrow.svg)][codeclimate]
|
8
|
+
[![Coverage Status](http://img.shields.io/coveralls/maetl/yarrow.svg)][coveralls]
|
9
|
+
|
10
|
+
[gem]: https://rubygems.org/gems/yarrow
|
11
|
+
[travis]: https://travis-ci.org/maetl/yarrow
|
12
|
+
[gemnasium]: https://gemnasium.com/maetl/yarrow
|
13
|
+
[codeclimate]: https://codeclimate.com/github/maetl/yarrow
|
14
|
+
[coveralls]: https://coveralls.io/r/maetl/yarrow
|
15
|
+
|
16
|
+
Yarrow is a tool for generating well structured documentation from a variety of input sources.
|
17
|
+
|
18
|
+
Unlike most static site generators and code documentation tools, Yarrow is written with design and content-strategy in mind. It does not impose its own structure on your content. This makes it appropriate for building static sites and blogs as well as style guides and API docs.
|
19
|
+
|
20
|
+
Installation
|
21
|
+
------------
|
22
|
+
|
23
|
+
Install the library and command line tool via RubyGems:
|
24
|
+
|
25
|
+
```
|
26
|
+
gem install yarrow
|
27
|
+
```
|
28
|
+
|
29
|
+
Or embed it in an existing Ruby project by adding the following line to the `Gemfile` and running `bundle`:
|
30
|
+
|
31
|
+
```
|
32
|
+
gem 'yarrow'
|
33
|
+
```
|
34
|
+
|
35
|
+
Status
|
36
|
+
------
|
37
|
+
|
38
|
+
Yarrow is an extraction from several existing private documentation projects. This repo is in alpha state, which means that many of the useful features are not yet folded into this codebase.
|
39
|
+
|
40
|
+
Yarrow is being slowly developed as a part-time project to scratch a few itches. New features and bugfixes are pushed straight to master, and releases of the Gem are kept more or less in sync with the planned roadmap.
|
41
|
+
|
42
|
+
Roadmap
|
43
|
+
-------
|
44
|
+
|
45
|
+
A rough sketch of the project direction.
|
46
|
+
|
47
|
+
| Version | Features |
|
48
|
+
|---------|----------|
|
49
|
+
| `0.3` | **[Local dev server and asset pipeline](https://github.com/maetl/yarrow/issues/48)** |
|
50
|
+
| `0.4` | Default media type mapping, collector, markup converters |
|
51
|
+
| `0.5` | Content model/object mapping, template/site context |
|
52
|
+
| `0.6` | HTML tag helpers, default layout templates |
|
53
|
+
| `0.7` | Rake integration, task library |
|
54
|
+
| `0.8` | Generic command line runner |
|
55
|
+
| `0.9` | Refactoring, performance fixes, lock down API |
|
56
|
+
|
57
|
+
License
|
58
|
+
-------
|
59
|
+
|
60
|
+
MIT. See the `LICENSE` file in the source distribution.
|
61
|
+
|
62
|
+
Contact
|
63
|
+
-------
|
64
|
+
|
65
|
+
Author: Mark Rickerby <me@maetl.net>
|
data/Rakefile
ADDED
data/SERVER.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Local Dev Server
|
2
|
+
|
3
|
+
Yarrow provides a local dev server for quick previews and incremental development of documentation.
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
To start the server in the current working directory, run `yarrow-server`:
|
8
|
+
|
9
|
+
```
|
10
|
+
$ yarrow-server
|
11
|
+
```
|
12
|
+
|
13
|
+
## Directory Indexes
|
14
|
+
|
15
|
+
There are several options that control the behavior of directory indexes:
|
16
|
+
|
17
|
+
- `default_index` sets the name of the file used as a default directory index (usually `index.html`).
|
18
|
+
- `auto_index` generates a listing of files in the directory when no default index is provided.
|
19
|
+
|
20
|
+
## Default Content Type
|
21
|
+
|
22
|
+
To set a default content type for files without an automatically detected MIME type or extension, use `default_type`:
|
23
|
+
|
24
|
+
```
|
25
|
+
default_type: 'text/html'
|
26
|
+
```
|
27
|
+
|
28
|
+
## Rack Configuration
|
29
|
+
|
30
|
+
The following options are available under the `server` entry in the main configuration:
|
31
|
+
|
32
|
+
|Option|Type|Description|Default|
|
33
|
+
|-|-|-|-|
|
34
|
+
|**port**|Integer|Local port for the server to listen on|`8888`|
|
35
|
+
|**host**|String|Local host for the server to listen on|`localhost`|
|
36
|
+
|**handler**|Symbol (one of `:thin`, `:webrick`, etc)|Specifies the webserver implementation that handles requests|`:thin`|
|
37
|
+
|**middleware**|Array|List of Rack middleware to be injected as plugins|
|
38
|
+
|
39
|
+
Additional configuration options that are relevant:
|
40
|
+
|
41
|
+
`config.output_dir`: If specified, determines the docroot. Otherwise the server defaults to the current working directory.
|
data/lib/yarrow.rb
CHANGED
@@ -7,6 +7,9 @@ require 'yarrow/configuration'
|
|
7
7
|
require 'yarrow/console_runner'
|
8
8
|
require 'yarrow/generator'
|
9
9
|
require 'yarrow/assets'
|
10
|
+
require 'yarrow/content/graph'
|
11
|
+
#require 'yarrow/content/resource_expander'
|
12
|
+
require 'yarrow/content/source_collector'
|
10
13
|
require 'yarrow/html/asset_tags'
|
11
14
|
require 'yarrow/output/mapper'
|
12
15
|
require 'yarrow/output/generator'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "mementus"
|
2
|
+
|
3
|
+
module Mementus
|
4
|
+
module Pipeline
|
5
|
+
class Step
|
6
|
+
# Monkeypatch extension to ensure each pipeline step supports enumerable
|
7
|
+
# methods. Mostly used for #map. API needs to be fixed in the gem itself.
|
8
|
+
include Enumerable
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Yarrow
|
14
|
+
module Content
|
15
|
+
# A directed graph of every element of content in the project.
|
16
|
+
class Graph
|
17
|
+
# Construct a graph collected from source content files.
|
18
|
+
def self.from_source(config)
|
19
|
+
new(SourceCollector.collect(config.input_dir))
|
20
|
+
end
|
21
|
+
|
22
|
+
# List of source files.
|
23
|
+
def files
|
24
|
+
graph.nodes(:file)
|
25
|
+
end
|
26
|
+
|
27
|
+
# List of source directories.
|
28
|
+
def directories
|
29
|
+
graph.nodes(:directory)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def initialize(graph)
|
35
|
+
@graph = graph
|
36
|
+
end
|
37
|
+
|
38
|
+
attr_reader :graph
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Yarrow
|
2
|
+
module Content
|
3
|
+
# Collects a digraph of all directories and files underneath the given input
|
4
|
+
# directory.
|
5
|
+
class SourceCollector
|
6
|
+
def self.collect(input_dir)
|
7
|
+
Mementus::Graph.new(is_mutable: true) do
|
8
|
+
root = create_node do |root|
|
9
|
+
root.label = :root
|
10
|
+
end
|
11
|
+
|
12
|
+
directories = {
|
13
|
+
Pathname.new(input_dir).to_s => root.id
|
14
|
+
}
|
15
|
+
|
16
|
+
Pathname.glob("#{input_dir}/**/**").each do |entry|
|
17
|
+
if entry.directory?
|
18
|
+
#puts "Reading directory: #{entry}"
|
19
|
+
|
20
|
+
content_node = create_node do |dir|
|
21
|
+
dir.label = :directory
|
22
|
+
dir.props[:name] = entry.basename.to_s
|
23
|
+
dir.props[:slug] = entry.basename.to_s
|
24
|
+
dir.props[:path] = entry.to_s
|
25
|
+
dir.props[:entry] = entry
|
26
|
+
end
|
27
|
+
|
28
|
+
directories[entry.to_s] = content_node.id
|
29
|
+
else
|
30
|
+
#puts "Reading file: #{entry} (#{entry.basename.sub_ext('')})"
|
31
|
+
|
32
|
+
content_node = create_node do |file|
|
33
|
+
file.label = :file
|
34
|
+
file.props[:name] = entry.basename.to_s
|
35
|
+
file.props[:slug] = entry.basename.sub_ext('').to_s
|
36
|
+
file.props[:path] = entry.to_s
|
37
|
+
file.props[:entry] = entry
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if directories.key?(entry.dirname.to_s)
|
42
|
+
#puts "Create parent edge: #{directories[entry.dirname.to_s]}"
|
43
|
+
|
44
|
+
create_edge do |edge|
|
45
|
+
edge.label = :child
|
46
|
+
edge.from = directories[entry.dirname.to_s]
|
47
|
+
edge.to = content_node
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/yarrow/version.rb
CHANGED
data/yarrow.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'yarrow/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'yarrow'
|
7
|
+
spec.version = Yarrow::VERSION
|
8
|
+
spec.platform = Gem::Platform::RUBY
|
9
|
+
spec.summary = 'Documentation generator based on a fluent data model.'
|
10
|
+
spec.description = 'Yarrow is a tool for generating well structured documentation from a variety of input sources.'
|
11
|
+
spec.authors = ['Mark Rickerby']
|
12
|
+
spec.email = 'me@maetl.net'
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
14
|
+
spec.executables << 'yarrow'
|
15
|
+
spec.executables << 'yarrow-server'
|
16
|
+
spec.add_runtime_dependency 'hashie', '~> 3.5'
|
17
|
+
spec.add_runtime_dependency 'mementus', '~> 0.8'
|
18
|
+
spec.add_runtime_dependency 'activesupport', '~> 5.1'
|
19
|
+
spec.add_runtime_dependency 'rack', '~> 2.0'
|
20
|
+
spec.add_runtime_dependency 'rack-livereload', '~> 0.3'
|
21
|
+
spec.add_runtime_dependency 'eventmachine', '~> 1.2'
|
22
|
+
spec.add_runtime_dependency 'em-websocket', '~> 0.5.1'
|
23
|
+
spec.add_runtime_dependency 'sprockets', '~> 3.7'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
25
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
27
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.21'
|
28
|
+
spec.add_development_dependency 'rack-test', '~> 0.8'
|
29
|
+
spec.homepage = 'http://rubygemspec.org/gems/yarrow'
|
30
|
+
spec.license = 'MIT'
|
31
|
+
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickerby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -201,6 +201,13 @@ executables:
|
|
201
201
|
extensions: []
|
202
202
|
extra_rdoc_files: []
|
203
203
|
files:
|
204
|
+
- ".gitignore"
|
205
|
+
- ".travis.yml"
|
206
|
+
- Gemfile
|
207
|
+
- LICENSE
|
208
|
+
- README.md
|
209
|
+
- Rakefile
|
210
|
+
- SERVER.md
|
204
211
|
- bin/yarrow
|
205
212
|
- bin/yarrow-server
|
206
213
|
- lib/yarrow.rb
|
@@ -209,6 +216,8 @@ files:
|
|
209
216
|
- lib/yarrow/assets/pipeline.rb
|
210
217
|
- lib/yarrow/configuration.rb
|
211
218
|
- lib/yarrow/console_runner.rb
|
219
|
+
- lib/yarrow/content/graph.rb
|
220
|
+
- lib/yarrow/content/source_collector.rb
|
212
221
|
- lib/yarrow/content_map.rb
|
213
222
|
- lib/yarrow/defaults.yml
|
214
223
|
- lib/yarrow/generator.rb
|
@@ -224,6 +233,7 @@ files:
|
|
224
233
|
- lib/yarrow/tools/front_matter.rb
|
225
234
|
- lib/yarrow/tools/output_file.rb
|
226
235
|
- lib/yarrow/version.rb
|
236
|
+
- yarrow.gemspec
|
227
237
|
homepage: http://rubygemspec.org/gems/yarrow
|
228
238
|
licenses:
|
229
239
|
- MIT
|