Sha256: f092aa5dda0e1820676da53dbf6d7707dfaf07bbbfd988e386798203edcee342

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

require 'listen'

module GitOcd
  class Observer
  	def initialize(path, options)
      @listener = Listen.to(path, wait_for_delay: options['delay']) do |modified, added, removed|
        # puts "modified absolute path: #{modified}"
        # puts "added absolute path: #{added}"
        # puts "removed absolute path: #{removed}"
        git_command_result = `cd #{path} && git commit -a -m "updated on save" && git push`
      end
  	end

  	def start
  		@listener.start
  	end

  	def stop
  		@listener.stop
  	end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_ocd-0.1.2 lib/git_ocd/observer.rb
git_ocd-0.1.1 lib/git_ocd/observer.rb