snippr 0.15.8 → 0.15.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzY1OGZmOGEzZmU0MjQyMTg3ZWJhZDc4NmY3N2RhNzEyMGQ4MGM5Ng==
4
+ NTQ4YTMwOTVhODM2N2ExOGI4YTU0ZWViNTZiOTFmYzJhNDJkMzg0Mg==
5
5
  data.tar.gz: !binary |-
6
- NjU0NTNiZWExNDY0MWZhMDdjMDllYjM4NWIyMGYzY2U3MGMwYmRkYg==
6
+ YzU2MTNkZDYzYTFkZGEwNzhmZjRkYzM5M2U4OTJmODVjYmFhNzE0YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWJjYzQ2ODQ0NmEwNzNhMjkxZTcxODUwMWU5NmQ5N2Q3MDFiOTAwZTUyYjQw
10
- OTJlZGU1MDYyMjM5MTFkMDg3NmNkNGFhMzYwMDc4ODQ4YTAyMTZjOTU2MmQy
11
- NjkxMjQyYjZkYjM5ODEwOTQ2ZTllNGYyYWM0ZWRiYzU0NmU3MDQ=
9
+ Yjc5OThiZDEwZWVlODk3ZDY5OTVkNDNlYjFkOGM2OGUwMTUxNGU1YTI2MjMy
10
+ ZmI0Y2Y2NGUxYzk2ZDlkMzZjNzA2NDhiNDhjODEyMDJjZThlNDBiNTkwYWY1
11
+ ZGUzNTI4Zjg4NWMxNjBkZWJkMzg5ODUxMzg4MWJlZTBjMzY5ZmI=
12
12
  data.tar.gz: !binary |-
13
- NTA4MTQwZjNjNDBhMThhOWU0ZDAxZmRhOWFkZTM5NjEzNTU0MDM5YWNkMjI2
14
- MWJhZDhmZDlmOWJhN2QyYjU5MzYwMTRjMTc3ZDAwOWEyOTUyN2RmZjY5N2I0
15
- Yjk4Y2M5YzI3MTJkMDAwZjFmMGQ3ZjQzZDQ2Zjg4ZTBmNDk4OTQ=
13
+ MDgzY2RlZDUyODQ5MjVkZjUyY2E1N2JjOTBlMDIxNTEyODNjOGE1NTNjNTA1
14
+ NWMzZTExY2U0NjM1NmY0OGMxNzc2YWMxOTNkOGU2MGZlMjc2Mzg0NDE3YTQ5
15
+ NzkyZDUwNTAzM2Y1ODg0MWExMTYyNDgwYmM3YTdlZTQ4YTI2YjE=
@@ -9,7 +9,7 @@ module Snippr
9
9
  end
10
10
 
11
11
  def content
12
- @content ||= @raw_content.scan(/[=✄]{4}$\n(.*?)\n?(?:\z|[=✄]{4})/m)[find_active_segment][0]
12
+ @content ||= @raw_content.scan(/[=✄]{4}$\n?(.*?)\n?(?:\z|[=✄]{4})/m)[find_active_segment][0]
13
13
  end
14
14
 
15
15
  private
data/lib/snippr/snip.rb CHANGED
@@ -34,7 +34,7 @@ module Snippr
34
34
  alias :to_s :content
35
35
 
36
36
  def raw_content
37
- @raw_content ||= missing? ? '' : File.read(@path).strip
37
+ @raw_content ||= missing? ? '' : File.read(@path).rstrip
38
38
  end
39
39
 
40
40
  # Returns whether the snip is missing or not.
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.15.8"
4
+ s.version = "0.15.9"
5
5
  s.date = Time.now
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Daniel Harrington", "Thomas Jachmann", "Frank Schumacher"]
@@ -4,26 +4,30 @@ require "spec_helper"
4
4
  describe "SegmentParser" do
5
5
 
6
6
  it "allows scissor symbols to be the delimiter. yay!" do
7
- actual = Snippr::SegmentParser.new("a\n=✄== valid_from: 3099-05-01 09:00:00 ====\nb").content.should == "a"
7
+ Snippr::SegmentParser.new("a\n=✄== valid_from: 3099-05-01 09:00:00 ====\nb").content.should == "a"
8
8
  end
9
9
 
10
10
  it "chooses the correct segment if no condition is given" do
11
- actual = Snippr::SegmentParser.new("a\nb").content.should == "a\nb"
11
+ Snippr::SegmentParser.new("a\nb").content.should == "a\nb"
12
12
  end
13
13
 
14
14
  it "chooses the correct segment if no valid condition is given" do
15
- actual = Snippr::SegmentParser.new("a\n==== valid_from: 3099-05-01 09:00:00 ====\nb").content.should == "a"
15
+ Snippr::SegmentParser.new("a\n==== valid_from: 3099-05-01 09:00:00 ====\nb").content.should == "a"
16
16
  end
17
17
 
18
18
  it "chooses the correct segment if a valid condition is given" do
19
- actual = Snippr::SegmentParser.new("a\n==== valid_from: 1099-05-01 09:00:00 ====\nb").content.should == "b"
19
+ Snippr::SegmentParser.new("a\n==== valid_from: 1099-05-01 09:00:00 ====\nb").content.should == "b"
20
20
  end
21
21
 
22
22
  it "returns the first matching segment if multiple segments are given" do
23
- actual = Snippr::SegmentParser.new("a\n==== valid_from: 1099-05-01 09:00:00 ====\nb\n==== valid_from: 1100-05-01 09:00:00 ====\nc").content.should == "b"
23
+ Snippr::SegmentParser.new("a\n==== valid_from: 1099-05-01 09:00:00 ====\nb\n==== valid_from: 1100-05-01 09:00:00 ====\nc").content.should == "b"
24
24
  end
25
25
 
26
26
  it "can handle more than two segments" do
27
- actual = Snippr::SegmentParser.new("a\n==== valid_from: 6099-05-01 09:00:00 ====\nb\n==== valid_from: 1100-05-01 09:00:00 ====\nc").content.should == "c"
27
+ Snippr::SegmentParser.new("a\n==== valid_from: 6099-05-01 09:00:00 ====\nb\n==== valid_from: 1100-05-01 09:00:00 ====\nc").content.should == "c"
28
+ end
29
+
30
+ it "doesn't need a newline after the last segment" do
31
+ Snippr::SegmentParser.new("a\n==== valid_from: 1099-05-01 09:00:00 ====").content.should be_empty
28
32
  end
29
33
  end
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.15.8
4
+ version: 0.15.9
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: 2013-07-18 00:00:00.000000000 Z
13
+ date: 2013-08-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  requirements: []
214
214
  rubyforge_project: snippr
215
- rubygems_version: 2.0.4
215
+ rubygems_version: 2.0.6
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: File based content management