lib/gitdocs/runner.rb in gitdocs-0.3.0 vs lib/gitdocs/runner.rb in gitdocs-0.3.1
- old
+ new
@@ -1,8 +1,8 @@
module Gitdocs
class Runner
- attr_accessor :root
+ attr_reader :root, :listener
def initialize(share)
@share = share
@root = share.path
@polling_interval = share.polling_interval
@@ -27,19 +27,19 @@
sleep @polling_interval
end
end.abort_on_exception = true
# Listen for changes in local repository
- listener = FSEvent.new
- listener.watch(@root) do |directories|
+ @listener = FSEvent.new
+ @listener.watch(@root) do |directories|
directories.uniq!
directories.delete_if {|d| d =~ /\/\.git/}
unless directories.empty?
mutex.synchronize { push_changes }
end
end
- at_exit { listener.stop }
- listener.run
+ at_exit { @listener.stop }
+ @listener.run
end
def sync_changes
out, status = sh_with_code("git fetch --all && git merge #{@current_remote}/#{@current_branch}")
if status.success?