yarrow 0.5.1 → 0.6.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf4a0ff53beff8749c36f82844efeefec5463ec6ea6ebc9126fc4e0928b4d4c0
4
- data.tar.gz: 2d4c1e187e40f5e6f6e6316e5908c1630129c28fa419c4216f06c6566d27854b
3
+ metadata.gz: 7b1a14b73412ec27fad2ff75bd7944f1ef25f241779c532d3449339a436e4c32
4
+ data.tar.gz: 2cf2db75cc8c107b1d1bcbb6a79ad7fd92a6ba32e27413f2057158f7b8bb3c8a
5
5
  SHA512:
6
- metadata.gz: 9624eb95caeb74e736c561d1bdfc18387d2e308427661073147b46377f35add1fd5aa7b03f758107e902fbbb741b6a7a070fd1cfc71a2371f3965774d1ddb128
7
- data.tar.gz: 3ae340c7e995e51b6a09ef86bf1faa191565a73bd61660d8276f9f77c6722633717dd027e137b0de2eab3f8a320befc1903ed2ef3f5287a83e99ad6d0eda761b
6
+ metadata.gz: 436cec2447208c2641d4ac332cbb1910b7b016983a0630782282a28fe34e7a929b4661f424f0002d937854316d00f6d822ec05407f40185a7d5bbd642a2b88d2
7
+ data.tar.gz: bd798c5d999b7d2665209778d507bfe9b54da98473850dd66b62c60391a270f93aa00d913315a7b29e6c92e7cb436f64fb89b692ecb4ea2da8bad5387d43b0b6
data/README.md CHANGED
@@ -2,15 +2,11 @@ Yarrow
2
2
  ======
3
3
 
4
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]
5
+ [![Build Status](http://img.shields.io/github/workflow/status/:user/maetl/yarrow/workflow)][github]
8
6
  [![Coverage Status](http://img.shields.io/coveralls/maetl/yarrow.svg)][coveralls]
9
7
 
10
8
  [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
9
+ [github]: https://github.com/maetl/yarrow
14
10
  [coveralls]: https://coveralls.io/r/maetl/yarrow
15
11
 
16
12
  Yarrow is a tool for generating well structured documentation from a variety of input sources.
data/Rakefile CHANGED
@@ -1,4 +1,18 @@
1
+ $LOAD_PATH.unshift File.expand_path("./lib", __dir__)
2
+ require "yarrow"
3
+
4
+ task :version do
5
+ puts Yarrow::VERSION
6
+ end
7
+
8
+ task :build do
9
+ sh "gem build yarrow.gemspec"
10
+ end
11
+
12
+ task :publish do
13
+ sh "gem push yarrow-#{Yarrow::VERSION}.gem"
14
+ end
1
15
 
2
16
  task :clean do
3
- sh 'rm yarrow-*.gem'
17
+ sh "rm yarrow-*.gem"
4
18
  end
@@ -1,5 +1,3 @@
1
- puts "CollectionExpander!!!"
2
-
3
1
  module Yarrow
4
2
  module Content
5
3
  class CollectionExpander
@@ -0,0 +1,109 @@
1
+ module Yarrow
2
+ module Schema
3
+ module Type
4
+ class Any
5
+ end
6
+ end
7
+
8
+ ##
9
+ # Checks values plugged into each slot and runs any required validations
10
+ # (validations not yet implemented).
11
+ #
12
+ # Current design throws on error rather than returns a boolean result.
13
+ class Validator
14
+ # @param slots [Array<Symbol>, <Hash>] defines the slots in the schema to validate against
15
+ def initialize(slots)
16
+ @keys = slots.reduce({}) do |keys, slot|
17
+ if slot.is_a?(Array)
18
+ keys[slot[0]] = slot[1]
19
+ else
20
+ keys[slot.to_sym] = Type::Any
21
+ end
22
+
23
+ keys
24
+ end
25
+ end
26
+
27
+ def check(fields)
28
+ raise "wrong number of args" unless fields.keys.length == @keys.keys.length
29
+
30
+ fields.keys.each do |key|
31
+ raise "key does not exist" unless @keys.key?(key)
32
+ end
33
+ end
34
+ end
35
+
36
+ ##
37
+ # Value object (with comparison by value equality). This just chucks back a
38
+ # Ruby struct but wraps the constructor with method advice that handles
39
+ # validation (and eventually type coercion if !yagni).
40
+ class Value
41
+ def self.new(*slots, &block)
42
+ factory(*slots, &block)
43
+ end
44
+
45
+ def self.factory(*slots, &block)
46
+ validator = Validator.new(slots)
47
+
48
+ struct = Struct.new(*slots, keyword_init: true, &block)
49
+
50
+ struct.define_method :initialize do |kwargs|
51
+ validator.check(kwargs)
52
+ # TODO: type coercion or mapping decision goes here
53
+ super(**kwargs)
54
+ freeze
55
+ end
56
+
57
+ struct
58
+ end
59
+ end
60
+
61
+ ##
62
+ # Entity with comparison by reference equality. Generates attribute helpers
63
+ # for a declared set of props. Used to replace Hashie::Mash without dragging
64
+ # in a whole new library.
65
+ class Entity
66
+ class << self
67
+ def attribute(name, value_type)
68
+ # define_method("map_#{name}".to_sym) do |input|
69
+ # value_type.coerce(input)
70
+ # end
71
+ dictionary[name] = value_type
72
+ attr_reader(name)
73
+ end
74
+
75
+ def dictionary
76
+ @dictionary ||= Hash.new
77
+ end
78
+ end
79
+
80
+ def dictionary
81
+ self.class.dictionary
82
+ end
83
+
84
+ def initialize(config)
85
+ dictionary.each_key do |name|
86
+ raise "missing declared attribute #{name}" unless dictionary.key?(name)
87
+ end
88
+
89
+ config.each_pair do |key, value|
90
+ raise "#{key} not a declared attribute" unless dictionary.key?(key)
91
+
92
+ defined_type = dictionary[key]
93
+
94
+ unless value.is_a?(defined_type)
95
+ raise "#{key} accepts #{defined_type} but #{value.class} given"
96
+ end
97
+
98
+ instance_variable_set("@#{key}", value)
99
+ end
100
+ end
101
+ end
102
+
103
+ def to_h
104
+ dictionary.keys.reduce({}) do |h, name|
105
+ h[name] = instance_variable_get("@#{name}")
106
+ end
107
+ end
108
+ end
109
+ end
File without changes
File without changes
File without changes
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module Yarrow
2
- APP_NAME = 'Yarrow'.freeze
3
- VERSION = '0.5.1'.freeze
3
+ APP_NAME = 'Yarrow'
4
+ VERSION = '0.6.0'
4
5
  end
@@ -0,0 +1,9 @@
1
+ module Yarrow
2
+ module Web
3
+ class HTMLDocument
4
+ def initialize
5
+
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Yarrow
2
+ module Web
3
+ class Manifest
4
+ def initialize
5
+
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Yarrow
2
+ module Web
3
+ class StaticAsset
4
+ def initialize
5
+
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Yarrow
2
+ module Web
3
+ class Template
4
+ def initialize
5
+
6
+ end
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
@@ -236,12 +236,20 @@ files:
236
236
  - lib/yarrow/process/project_manifest.rb
237
237
  - lib/yarrow/process/step_processor.rb
238
238
  - lib/yarrow/process/workflow.rb
239
+ - lib/yarrow/schema.rb
240
+ - lib/yarrow/schema/validations/array.rb
241
+ - lib/yarrow/schema/validations/object.rb
242
+ - lib/yarrow/schema/validations/string.rb
239
243
  - lib/yarrow/server.rb
240
244
  - lib/yarrow/server/livereload.rb
241
245
  - lib/yarrow/source/graph.rb
242
246
  - lib/yarrow/tools/front_matter.rb
243
247
  - lib/yarrow/tools/output_file.rb
244
248
  - lib/yarrow/version.rb
249
+ - lib/yarrow/web/html_document.rb
250
+ - lib/yarrow/web/manifest.rb
251
+ - lib/yarrow/web/static_asset.rb
252
+ - lib/yarrow/web/template.rb
245
253
  - yarrow.gemspec
246
254
  homepage: http://rubygemspec.org/gems/yarrow
247
255
  licenses: