jekyll_frontmatter_tests 0.0.6 → 0.0.7
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 +4 -4
- data/lib/jekyll_frontmatter_tests.rb +8 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071d941ef890ecfb4bd5660d0181696439a3f160
|
4
|
+
data.tar.gz: 370d78ee91df6b28b14a689011a98112522122cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e89e8f1187c6958ed90a7c7781515775f381057ffe9a58155afcf03f10502feb8e3457f64a32e728ec4be3c21d929964b9b4a36ea963edf19e92fddebbb8e031
|
7
|
+
data.tar.gz: 123047a39baca06a1aa2f6cbae67359088e9f41daa18c2f61f389134274d67cc91b8004a590156fd0873a1a2561357bd07a36e5329dd55e51b217a5a8dd311dc
|
@@ -1,17 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
class FrontmatterTests < Jekyll::Command
|
3
3
|
class << self
|
4
|
-
# Public: load the configuration file
|
5
|
-
#
|
6
|
-
# Assumes this is a standard jekyll site
|
7
|
-
def config
|
8
|
-
config = Jekyll.configuration
|
9
|
-
if config.key('frontmatter_tests').nil?
|
10
|
-
config['frontmatter_tests'] = {'path' => File.join("deploy", "tests", "schema")}
|
11
|
-
end
|
12
|
-
@config ||= config['frontmatter_tests']
|
13
|
-
end
|
14
|
-
|
15
4
|
# Public: Load a schema from file.
|
16
5
|
#
|
17
6
|
# file - a string containing a filename
|
@@ -22,7 +11,7 @@ class FrontmatterTests < Jekyll::Command
|
|
22
11
|
# Returns a hash loaded from the YAML doc or exits 1 if no schema file
|
23
12
|
# exists.
|
24
13
|
def loadschema(file)
|
25
|
-
schema = File.join(
|
14
|
+
schema = File.join(@schema['path'], file)
|
26
15
|
if File.exists?(schema)
|
27
16
|
YAML.load_file(schema)
|
28
17
|
else
|
@@ -114,7 +103,7 @@ class FrontmatterTests < Jekyll::Command
|
|
114
103
|
# Public: Tests all collections described by a schema file at
|
115
104
|
# `deploy/tests/scema`
|
116
105
|
def test_everything
|
117
|
-
schema = Dir.open(
|
106
|
+
schema = Dir.open(@schema['path'])
|
118
107
|
yepnope = Array.new
|
119
108
|
schema.each { |s|
|
120
109
|
if s.start_with?('_')
|
@@ -140,6 +129,7 @@ class FrontmatterTests < Jekyll::Command
|
|
140
129
|
#
|
141
130
|
# The test runner pushes the result of each test into a `results` array and # exits `1` if any tests fail or `0` if all is well.
|
142
131
|
def test_frontmatter(args, options)
|
132
|
+
|
143
133
|
puts 'starting tests'
|
144
134
|
if options['posts']
|
145
135
|
results = test_posts
|
@@ -163,6 +153,11 @@ class FrontmatterTests < Jekyll::Command
|
|
163
153
|
# When `jekyll test` runs, `test_frontmatter` is fired with options and args
|
164
154
|
# passed from the command line.
|
165
155
|
def init_with_program(prog)
|
156
|
+
config = Jekyll.configuration
|
157
|
+
unless config.key?('frontmatter_tests')
|
158
|
+
config['frontmatter_tests'] = {'path' => File.join("deploy", "tests", "schema")}
|
159
|
+
end
|
160
|
+
@schema ||= config['frontmatter_tests']
|
166
161
|
prog.command(:test) do |c|
|
167
162
|
c.syntax "test [options]"
|
168
163
|
c.description 'Test your site for frontmatter.'
|