daybreak 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ profile
6
6
  .yardoc
7
7
  Gemfile.lock
8
8
  *.rbc
9
+ *.gem
data/daybreak.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ["lib"]
15
15
  gem.licenses = ["MIT"]
16
16
  gem.version = Daybreak::VERSION
17
+ gem.add_development_dependency 'minitest'
17
18
  gem.add_development_dependency 'simplecov'
18
19
  gem.add_development_dependency 'ruby-prof'
19
20
  end
data/lib/daybreak/db.rb CHANGED
@@ -145,6 +145,7 @@ module Daybreak
145
145
 
146
146
  # Empty this database
147
147
  empty!
148
+ close!
148
149
 
149
150
  # Move the copy into place
150
151
  tmp_file.close
@@ -152,7 +153,6 @@ module Daybreak
152
153
  tmp_file.unlink
153
154
 
154
155
  # Reset this database
155
- close!
156
156
  reset!
157
157
  read!
158
158
  end
@@ -1,4 +1,4 @@
1
1
  module Daybreak
2
2
  # Updated using SemVer
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
@@ -45,8 +45,10 @@ module Daybreak
45
45
  @fd = File.open @file, 'a'
46
46
  @fd.binmode
47
47
 
48
- f = @fd.fcntl(Fcntl::F_GETFL, 0)
49
- @fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | f)
48
+ if defined?(Fcntl::O_NONBLOCK)
49
+ f = @fd.fcntl(Fcntl::F_GETFL, 0)
50
+ @fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | f)
51
+ end
50
52
  end
51
53
 
52
54
  # Workers handle the actual fiddly bits of asynchronous io and
@@ -89,7 +91,11 @@ module Daybreak
89
91
  # If the write fails try again.
90
92
  def try_write(fd, buf)
91
93
  begin
92
- s = fd.write_nonblock(buf)
94
+ if defined?(Fcntl::O_NONBLOCK)
95
+ s = fd.write_nonblock(buf)
96
+ else
97
+ s = fd.write(buf)
98
+ end
93
99
  if s < buf.length
94
100
  buf = buf[s..-1] # didn't finish
95
101
  else
data/test/test.rb CHANGED
@@ -80,8 +80,5 @@ describe "database functions" do
80
80
  after do
81
81
  @db.empty!
82
82
  @db.close!
83
- File.unlink(DB_PATH)
84
83
  end
85
84
  end
86
-
87
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daybreak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: minitest
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: simplecov
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
107
  version: '0'
92
108
  requirements: []
93
109
  rubyforge_project:
94
- rubygems_version: 1.8.23
110
+ rubygems_version: 1.8.24
95
111
  signing_key:
96
112
  specification_version: 3
97
113
  summary: Daybreak provides an in memory key-value store that is easily enumerable