summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tapicero/couch_changes.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/tapicero/couch_changes.rb b/lib/tapicero/couch_changes.rb
index 3b7da59..55a5489 100644
--- a/lib/tapicero/couch_changes.rb
+++ b/lib/tapicero/couch_changes.rb
@@ -9,13 +9,7 @@ module Tapicero
def initialize(db, seq_filename)
@db = db
@seq_filename = seq_filename
- FileUtils.touch(seq_filename)
- unless File.writable?(seq_filename)
- raise StandardError.new("Can't access sequence file")
- end
- @since = File.read(seq_filename)
- rescue Errno::ENOENT => e
- puts "No sequence file found. Starting from scratch"
+ read_seq(seq_filename)
end
def created(hash = {}, &block)
@@ -49,6 +43,16 @@ module Tapicero
#updated callback
end
+ def read_seq(seq_filename)
+ FileUtils.touch(seq_filename)
+ unless File.writable?(seq_filename)
+ raise StandardError.new("Can't access sequence file")
+ end
+ @since = File.read(seq_filename)
+ rescue Errno::ENOENT => e
+ puts "No sequence file found. Starting from scratch"
+ end
+
def store_seq(seq)
File.write(@seq_filename, seq)
end