jekyll_frontmatter_tests 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll_frontmatter_tests.rb +10 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4487b50216c807a939eb3cfef2a03452454eb09f
|
4
|
+
data.tar.gz: b5282b256753b7d09bf2f1b7de6869de8d78a095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5176b451341b3871085b631929469e4ba31e2686f9e4ae81cc78d016bc74085c250dede044e366857459b79513d623bcc003225e54f87df9528be71b7064382c
|
7
|
+
data.tar.gz: bcd58e5fb6ad835d3c2c97a41bd6c3b70b8d83dbbdee7d615a674a8c56e4a9a64d350060cfa595e5b45d2fdb21a577df428a3a441043f9a96e3eebbf9477a7de
|
@@ -38,18 +38,20 @@ class FrontmatterTests < Jekyll::Command
|
|
38
38
|
# Returns true or false depending on the success of the check.
|
39
39
|
def process(schema)
|
40
40
|
dir = File.join(schema['config']['path'])
|
41
|
-
passfail =
|
41
|
+
passfail = Array.new
|
42
42
|
Dir.open(dir).each do |f|
|
43
43
|
file = File.open(File.join(dir, f))
|
44
44
|
unless schema['config']['ignore'].include?(f)
|
45
45
|
data = YAML.load_file(file)
|
46
|
-
passfail
|
47
|
-
passfail
|
46
|
+
passfail.push check_keys(data, schema.keys, f)
|
47
|
+
passfail.push check_types(data, schema)
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
passfail.keep_if { |p| p == false }
|
51
|
+
if passfail.empty?
|
51
52
|
return true
|
52
53
|
else
|
54
|
+
puts "There were #{passfail.count} errors".red
|
53
55
|
return false
|
54
56
|
end
|
55
57
|
end
|
@@ -67,12 +69,12 @@ class FrontmatterTests < Jekyll::Command
|
|
67
69
|
return false
|
68
70
|
end
|
69
71
|
diff = keys - target.keys
|
70
|
-
|
72
|
+
if diff.empty?
|
71
73
|
return true
|
72
74
|
else
|
73
|
-
puts "
|
75
|
+
puts "\nThe file #{title} is missing the following keys:".red
|
74
76
|
for k in diff
|
75
|
-
puts " * #{k}
|
77
|
+
puts " * #{k}".red
|
76
78
|
end
|
77
79
|
return false
|
78
80
|
end
|
@@ -97,9 +99,6 @@ class FrontmatterTests < Jekyll::Command
|
|
97
99
|
# processed against its respective schema.
|
98
100
|
def test_collections(collections)
|
99
101
|
yepnope = Array.new
|
100
|
-
unless collections.class == Array
|
101
|
-
require 'pry'; binding.pry
|
102
|
-
end
|
103
102
|
for c in collections
|
104
103
|
puts "Testing #{c}".green
|
105
104
|
yepnope.push process(loadschema("_#{c}.yml"))
|
@@ -148,7 +147,7 @@ class FrontmatterTests < Jekyll::Command
|
|
148
147
|
results.push test_everything
|
149
148
|
end
|
150
149
|
results.keep_if { |t| t == false }
|
151
|
-
if results
|
150
|
+
if results.empty?
|
152
151
|
puts 'Tests finished!'
|
153
152
|
exit 0
|
154
153
|
else
|
@@ -200,7 +199,6 @@ class FrontmatterTests < Jekyll::Command
|
|
200
199
|
elsif type == "String" and data[key].class == String
|
201
200
|
return true
|
202
201
|
elsif type == "Date"
|
203
|
-
require 'pry'; binding.pry
|
204
202
|
return true
|
205
203
|
else
|
206
204
|
puts " * Data is of the wrong type for key #{key}, expected #{type} but was #{data[key].class}\n\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_frontmatter_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Boone
|
@@ -19,7 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- lib/jekyll_frontmatter_tests.rb
|
22
|
-
homepage: https://
|
22
|
+
homepage: https://rubygems.org/gems/jekyll_frontmatter_tests
|
23
23
|
licenses:
|
24
24
|
- CC0
|
25
25
|
metadata: {}
|