yarrow 0.9.2 → 0.9.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.
@@ -1,45 +0,0 @@
1
- module Yarrow
2
- module Output
3
- module Web
4
- class IndexedFile
5
- WRITE_MODE = 'w+:UTF-8'.freeze
6
-
7
- # @return [String] Basename reflecting the server convention (usually: index.html)
8
- def index_name
9
- @index_name ||= config.index_name || 'index.html'
10
- end
11
-
12
- # @return [String] Docroot of the output target
13
- def docroot
14
- @docroot ||= config.output_dir || 'public'
15
- end
16
-
17
- # Write an output file to the specified path under the docroot.
18
- #
19
- # @param path [String]
20
- # @param content [String]
21
- def write(path, content)
22
- # If the target path is a directory,
23
- # generate a default index filename.
24
- if path[path.length-1] == '/'
25
- path = "#{path}#{index_name}"
26
- end
27
-
28
- target_path = Pathname.new("#{docroot}#{path}")
29
-
30
- ensure_dir_exists!(target_path.dirname)
31
-
32
- File.open(target_path.to_s, WRITE_MODE) do |file|
33
- file.puts(content)
34
- end
35
- end
36
-
37
- def ensure_dir_exists!(target)
38
- unless File.directory?(target)
39
- FileUtils.mkdir_p(target)
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,6 +0,0 @@
1
- module Yarrow
2
- module Source
3
- class Graph
4
- end
5
- end
6
- end
@@ -1,37 +0,0 @@
1
- module Yarrow
2
- module Tools
3
- # @deprecated
4
- # Maintained here as it is still used in a number of places but needs to be removed soon
5
- module FrontMatter
6
-
7
- def read_split_content(path, options={})
8
- extract_split_content(File.read(path, :encoding => 'utf-8'), options)
9
- end
10
-
11
- def extract_split_content(text, options={})
12
- pattern = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
13
- if text =~ pattern
14
- content = text.sub(pattern, "")
15
-
16
- begin
17
- if options.key?(:symbolize_keys)
18
- meta = YAML.load($1, symbolize_names: true)
19
- else
20
- meta = YAML.load($1)
21
- end
22
- return [content, meta]
23
- rescue Psych::SyntaxError => error
24
- if defined? ::Logger
25
- # todo: application wide logger
26
- #logger = ::Logger.new(STDOUT)
27
- #logger.error "#{error.message}"
28
- end
29
- return [content, nil]
30
- end
31
- end
32
-
33
- [text, nil]
34
- end
35
- end
36
- end
37
- end