class AwsRsync::Watch

Public Class Methods

new(options) click to toggle source
# File lib/aws_rsync/watch.rb, line 5
def initialize(options)
  @options = options
end

Public Instance Methods

run() click to toggle source
# File lib/aws_rsync/watch.rb, line 9
def run
  Dir.chdir(@options[:cwd]) do
    puts "Watching dir #{@options[:cwd]}"
    ignore = %w[. .. .git log tmp] # TODO: dynamically look up ignores
    files = Dir.glob(['.*','*']) - ignore
    return false if @options[:noop]
    Sync.new(@options).run
    Filewatcher.new(files).watch() do |filename, event|
      Sync.new(@options).run
    end
  end
end