snippr 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04987e98947b0190ff1c5d80e54f0f10d5261c79
4
- data.tar.gz: a901855ac7e59a75c478b9d5fdd26f7efe7a55fe
3
+ metadata.gz: d9ae5d24a9ead1c45b8d22928517e1e8f0563923
4
+ data.tar.gz: 39a192234c2d04cb9fae477c5baea4099911920a
5
5
  SHA512:
6
- metadata.gz: 726583051abb204696a534c43e9eed5d4e6ed59af7e1f88b9f2bd871747b6594c66defd52070e64001bd8ef6d25bfd6bd81f58165c296e15909ceeb370317f64
7
- data.tar.gz: b2df93eef30d90fe05410c9e95f6aef81b22f5c4fbad7cb7cfc63440689168c239761a4e7a8749a8c1baa7cea571afbdcc2e46792479e8d036b488d381805b14
6
+ metadata.gz: 280b26f9e0173227be8f9b43cacc2ed0d7127f5eeb240942f1d86da983eed4ea831c804d0cd46b8de219844a0b9338c6d2346289f3dc1f380e9d1ca714197b33
7
+ data.tar.gz: 02041e9d5cbe66d244051f064aeb733880df88360752a426dea30565a1dbfd0e77a2e55bddcaebda124db0f81c94f305225bf0d8b70b3b9c2d5a0745b833c631
@@ -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
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "snippr"
4
- s.version = '0.16.0'
4
+ s.version = '0.16.1'
5
5
  s.date = Time.now
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Daniel Harrington", "Thomas Jachmann", "Frank Schumacher"]
@@ -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.0
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-23 00:00:00.000000000 Z
13
+ date: 2014-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n