yarrow 0.1.3 → 0.1.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWU1MDIxZjg5N2Q5NjI5NjFiOTdiZDc3NjBiMzcyYmFlNDYwNDI2MA==
4
+ MjhlZjY5NTIyMWMwYTMzZGY3NmYxOWM0NjY1NDQwZmRlMmFkNDIzMw==
5
5
  data.tar.gz: !binary |-
6
- N2M2N2M0NDllMGQ3ZjI1M2ZhMTgzN2RiMjkyZWIxNjM4M2ExZmUxMw==
6
+ MjUzMjZkZGMzNmM1M2EzZTQyODVmODlmZTY4N2IwMWQ4OTdiYmZhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjdjMjQ0MGE2OWRiNTI5OTRkZDdlYjk0ZmNhNGU5NzRhN2NlYmFiMmRmMTc3
10
- MzlkMDc4YWJlZjdkMzk2MmI0NmU4NDlmNGE0YTg0YzQ0MzMzNTRmZTA0MjNh
11
- YTZhN2JjNzA2MTk2M2M4NTk4OWQyZjA4NjYwN2I1YjRhMzkxMjc=
9
+ NGRjN2FhOTk2MGQwZmYzZDhlNzhkNTY4YTgwNDQ4MGYyZGRjYWQ4NDg3MjEx
10
+ ZTc1OTEzZTgxZTU2YjU2NDYwZjU5NDJjMWRjNWYxY2ViZDRlZWM3NGU0ZDky
11
+ MjBmNGRmNmIwMmYzYTFhNzdhYzU2ZGMxOGY0MjkzOWQ3MzRlNDQ=
12
12
  data.tar.gz: !binary |-
13
- Y2Y4ZjcyNWIyMGIzNzlkZjQ1MjEwYjdmNjEzYjE0MWM2NzgwZjA2NTYxNjgz
14
- MDg3OTNjNGI5M2U3MjkxYmNlNTM5MTk2MThkNjY0NGViZTZjYzlhNTZiYTQz
15
- N2JmMWYzY2NlNmIwNjhkNjA3ZWY5YTg3YjQ0ZGYxNDVjMTg0OTc=
13
+ NmVjMzI3ZTYxYmVjNWE2MTJkZTNiMDdhYzkyYzcwYjM1NTE1YWUyM2QxMWVh
14
+ NzBmMjJhZWZlNWQ1NGQ4MjJkNWY4OTNkNWU2NjM4MmM5ZWZkMDBkZWQ3YzQ3
15
+ ZTJlZTMxMDZjNzc3MzcxYWVkOTFiZmVhZDI2MWZhYmNhZTYyMmI=
@@ -0,0 +1,33 @@
1
+ module Yarrow
2
+ class ContentMap
3
+
4
+ @@registry = {}
5
+
6
+ def self.[](name)
7
+ @@registry[name]
8
+ end
9
+
10
+ def self.define(name, &block)
11
+ content_map = ContentMap.new
12
+ content_map.instance_eval(&block)
13
+ @@registry[name] = content_map.objects
14
+ end
15
+
16
+ def self.build(&block)
17
+ content_map = ContentMap.new
18
+ content_map.instance_eval(&block)
19
+ content_map.objects
20
+ end
21
+
22
+ attr_reader :objects
23
+
24
+ def initialize
25
+ @objects = Hashie::Mash.new
26
+ end
27
+
28
+ def method_missing(method, *args, &block)
29
+ @objects[method] = block ? ContentMap.build(&block) : args.first
30
+ end
31
+
32
+ end
33
+ end
@@ -6,6 +6,21 @@ module Yarrow
6
6
  # to specify a particular file structure to output.
7
7
  class Generator
8
8
 
9
+ def initialize(target, site_tree)
10
+ ensure_dir_exists! target
11
+ @target = target
12
+ @site_tree = site_tree
13
+ end
14
+
15
+ def ensure_dir_exists!(target)
16
+ unless File.directory? target
17
+ Dir.mkdir target
18
+ end
19
+ end
20
+
21
+ def build_docs
22
+
23
+ end
9
24
 
10
25
  end
11
26
 
@@ -0,0 +1,28 @@
1
+ module Yarrow
2
+ module Tools
3
+ module FrontMatter
4
+
5
+ def read_split_content(path)
6
+ extract_split_content(File.read(path))
7
+ end
8
+
9
+ def extract_split_content(text)
10
+ pattern = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
11
+ if text =~ pattern
12
+ content = text.sub(pattern, "")
13
+
14
+ begin
15
+ meta = YAML.load($1)
16
+ return [content, meta]
17
+ rescue => e
18
+ puts "Parsing Exception: #{e.message}"
19
+ end
20
+
21
+ end
22
+
23
+ [text, nil]
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = "Yarrow"
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
data/lib/yarrow.rb CHANGED
@@ -4,4 +4,10 @@ require "yaml"
4
4
  require "yarrow/version"
5
5
  require "yarrow/configuration"
6
6
  require "yarrow/console_runner"
7
- require "yarrow/generator"
7
+ require "yarrow/generator"
8
+ require "yarrow/content_map"
9
+ require "yarrow/tools/front_matter"
10
+
11
+ # Dir[File.dirname(__FILE__) + "/yarrow/generators/*.rb"].each do |generator|
12
+ # require generator
13
+ # 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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-19 00:00:00.000000000 Z
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -34,8 +34,10 @@ files:
34
34
  - bin/yarrow
35
35
  - lib/yarrow/configuration.rb
36
36
  - lib/yarrow/console_runner.rb
37
+ - lib/yarrow/content_map.rb
37
38
  - lib/yarrow/defaults.yml
38
39
  - lib/yarrow/generator.rb
40
+ - lib/yarrow/tools/front_matter.rb
39
41
  - lib/yarrow/version.rb
40
42
  - lib/yarrow.rb
41
43
  homepage: http://rubygems.org/gems/yarrow