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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb890c962e1b152e81d7a896a716b1bc95d71cf3d338bd21eae5e5ffdc42d99c
4
- data.tar.gz: 5e8e94e90d2e89d7e39d88fa7261061c6b819a93fa50abf0404b9c505badf79c
3
+ metadata.gz: 7360a9c100d2a45cbf57a77fcec6a02f21156a6af46d22a6c438dd43ab07557f
4
+ data.tar.gz: c71c2e48c2b3118b1d3d734430925f9bee7981a89462df9a8e05bfc5d12fc3c7
5
5
  SHA512:
6
- metadata.gz: 6d4b8dfecfa7740c5a6cef0d2441fdb0d7b7b0b28e0e92506a20f3f32ad826460b5c11142f6f62ea6da3ca5db61b5791cffa334feb8d397fa287e74134683f0a
7
- data.tar.gz: f70d14e7b308a606194f1f79ea20d35241cc27d46d98bd2aa02ae8f5f754c6315c2fa25c310671a787114ac32c3dfd438c79484f62abb33d94baafc0eb387c2e
6
+ metadata.gz: 77ed4fe864b0ad9f7d4a73b9787619f166eb5aa2631c70377e57de4c1f781f8da2bca717dafd98a940aff2e637590335e0076894b99a2f4e7ebbf94151acaa56
7
+ data.tar.gz: 6732e24c0275884b3cfbab5a417ab755b900ca8d94ffa00d7a84a6c90a042325615221785085d1913f1a0b26b54399b500d90f5beb6b6cd1c7183236e12beade
@@ -0,0 +1,7 @@
1
+ *.tgz
2
+ fabfile.py
3
+ fabfile.pyc
4
+ pirum.xml
5
+ Gemfile.lock
6
+ yarrow-*.gem
7
+ coverage
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+
3
+ cache: bundler
4
+
5
+ rvm:
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - ruby-head
10
+ - jruby
11
+ - rbx-3
12
+
13
+ script: bundle exec rspec
14
+
15
+ before_install:
16
+ - gem install bundler
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
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.
@@ -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>
@@ -0,0 +1,4 @@
1
+
2
+ task :clean do
3
+ sh 'rm yarrow-*.gem'
4
+ end
@@ -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.
@@ -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
@@ -6,7 +6,6 @@ module Yarrow
6
6
  # Mustache templates.
7
7
  #
8
8
  # Includes the library of helpers for dynamically generating HTML tags.
9
- #
10
9
  class Context
11
10
  include Yarrow::HTML::AssetTags
12
11
 
@@ -17,6 +16,5 @@ module Yarrow
17
16
  end
18
17
  end
19
18
  end
20
-
21
19
  end
22
20
  end
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = 'Yarrow'.freeze
3
- VERSION = '0.4.3'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
@@ -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.3
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 00:00:00.000000000 Z
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