one_inch_punch 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.2.1 2008-11-20
2
+
3
+ * 1 enhancement:
4
+ * A missing or empty .punch.yml file no longer causes an exception
5
+ (thanks to Jamie van Dyke for finding this problem)
6
+
1
7
  == 0.2.0 2008-11-05
2
8
 
3
9
  * 2 enhancements:
data/lib/punch.rb CHANGED
@@ -21,9 +21,9 @@ class Punch
21
21
  def load
22
22
  begin
23
23
  raw = File.read(File.expand_path('~/.punch.yml'))
24
- @data = YAML.load(raw)
24
+ @data = YAML.load(raw) || {}
25
25
  rescue Errno::ENOENT
26
- return false
26
+ @data = {}
27
27
  end
28
28
 
29
29
  true
data/lib/punch/version.rb CHANGED
@@ -2,7 +2,7 @@ class Punch
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/punch_spec.rb CHANGED
@@ -55,6 +55,21 @@ describe Punch do
55
55
  it 'should return true' do
56
56
  Punch.load.should == true
57
57
  end
58
+
59
+ describe 'and is empty' do
60
+ before :each do
61
+ File.stubs(:read).returns('')
62
+ end
63
+
64
+ it 'should load the data as yaml' do
65
+ Punch.load
66
+ Punch.data.should == {}
67
+ end
68
+
69
+ it 'should return true' do
70
+ Punch.load.should == true
71
+ end
72
+ end
58
73
  end
59
74
 
60
75
  describe 'when no file is found' do
@@ -62,13 +77,13 @@ describe Punch do
62
77
  File.stubs(:read).raises(Errno::ENOENT)
63
78
  end
64
79
 
65
- it 'should leave the data blank' do
80
+ it 'should set the data to an empty hash' do
66
81
  Punch.load
67
- Punch.data.should be_nil
82
+ Punch.data.should == {}
68
83
  end
69
84
 
70
85
  it 'should return false' do
71
- Punch.load.should == false
86
+ Punch.load.should == true
72
87
  end
73
88
  end
74
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one_inch_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yossef Mendelssohn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-05 00:00:00 -06:00
12
+ date: 2008-11-20 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency