snippr 0.16.0 → 0.16.1
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/snippr/meta_data.rb +1 -1
- data/snippr.gemspec +1 -1
- data/spec/snippr/meta_data_spec.rb +6 -0
- 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: d9ae5d24a9ead1c45b8d22928517e1e8f0563923
|
4
|
+
data.tar.gz: 39a192234c2d04cb9fae477c5baea4099911920a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280b26f9e0173227be8f9b43cacc2ed0d7127f5eeb240942f1d86da983eed4ea831c804d0cd46b8de219844a0b9338c6d2346289f3dc1f380e9d1ca714197b33
|
7
|
+
data.tar.gz: 02041e9d5cbe66d244051f064aeb733880df88360752a426dea30565a1dbfd0e77a2e55bddcaebda124db0f81c94f305225bf0d8b70b3b9c2d5a0745b833c631
|
data/lib/snippr/meta_data.rb
CHANGED
@@ -15,7 +15,7 @@ module Snippr
|
|
15
15
|
if content =~ /^(---\s*\n.*?\n?)^(---\s*$?)/m
|
16
16
|
content = Regexp.last_match.post_match.strip
|
17
17
|
meta = yaml_load(name, $1)
|
18
|
-
if meta.keys.include?(INCLUDE)
|
18
|
+
if meta && meta.keys.include?(INCLUDE)
|
19
19
|
Array(meta[INCLUDE]).each do |includePath|
|
20
20
|
if (snippet && includePath.start_with?("./"))
|
21
21
|
includePath = snippet.name.gsub(/\/.*?$/,"") + "/" + includePath.gsub(/^\.\//, "")
|
data/snippr.gemspec
CHANGED
@@ -6,6 +6,7 @@ describe Snippr::MetaData do
|
|
6
6
|
|
7
7
|
TEST_CONTENT = 'Hier ist jede Menge Content.'
|
8
8
|
TEST_CONTENT_WITH_METABLOCK = "---\nyml_key: yml_value\n---\n#{TEST_CONTENT}"
|
9
|
+
TEST_CONTENT_WITH_EMPTY_METABLOCK = "---\n#nothing here but comments\n#{TEST_CONTENT}"
|
9
10
|
TEST_CONTENT_WITH_INCLUDE = "---\n_include:\n - include/test\n - include/test2\ntest: main\n---"
|
10
11
|
TEST_CONTENT_WITH_RELATIVE_INCLUDE = "---\n_include:\n - ./test\n - ./test2\ntest: main\n---"
|
11
12
|
|
@@ -38,6 +39,11 @@ describe Snippr::MetaData do
|
|
38
39
|
expect(result.first).to eq TEST_CONTENT
|
39
40
|
end
|
40
41
|
|
42
|
+
it "returns nil if the metadata is empty" do
|
43
|
+
result = Snippr::MetaData.extract([:content], TEST_CONTENT_WITH_EMPTY_METABLOCK)
|
44
|
+
expect(result.second).to eq({})
|
45
|
+
end
|
46
|
+
|
41
47
|
it "includes other front matter via the _include key" do
|
42
48
|
result = Snippr::MetaData.extract([:content], TEST_CONTENT_WITH_INCLUDE)
|
43
49
|
expect(result.second).to eq({"this_is_also"=>"included_from_include_test2_snippet", "test"=>"main", "this_is"=>"included_from_include_test_snippet", "_include"=>["include/test", "include/test2"]})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snippr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-07-
|
13
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|