soup 0.9.9 → 0.9.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/soup.rb +7 -4
  3. metadata +3 -3
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
 
21
21
  # Change these as appropriate
22
22
  s.name = "soup"
23
- s.version = "0.9.9"
23
+ s.version = "0.9.9.1"
24
24
  s.summary = "A super-simple data store"
25
25
  s.author = "James Adam"
26
26
  s.email = "james@lazyatom.com"
@@ -91,7 +91,7 @@ class Soup
91
91
  File.open(path_for(attributes[:name]), 'w') do |f|
92
92
  content = attributes.delete(:content)
93
93
  f.write content
94
- f.write attributes.to_yaml.gsub(/^---\s/, attribute_token)
94
+ f.write attributes.to_yaml.gsub(/^---\s/, attribute_token) if attributes.any?
95
95
  end
96
96
  end
97
97
 
@@ -99,9 +99,12 @@ class Soup
99
99
  path = path_for(name)
100
100
  if File.exist?(path)
101
101
  file = File.read(path)
102
- attribute_start = file.index(attribute_token)
103
- content = file.slice(0...attribute_start)
104
- attributes = YAML.load(file.slice(attribute_start..-1)).merge(:content => content)
102
+ if attribute_start = file.index(attribute_token)
103
+ content = file.slice(0...attribute_start)
104
+ attributes = YAML.load(file.slice(attribute_start..-1)).merge(:content => content)
105
+ else
106
+ attributes = {:content => file, :name => name}
107
+ end
105
108
  Snip.new(attributes, self)
106
109
  else
107
110
  nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-12 00:00:00 +01:00
12
+ date: 2009-11-10 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  requirements: []
55
55
 
56
56
  rubyforge_project: soup
57
- rubygems_version: 1.3.3
57
+ rubygems_version: 1.3.5
58
58
  signing_key:
59
59
  specification_version: 3
60
60
  summary: A super-simple data store