Class: AwsRsync::Watch

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_rsync/watch.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Watch

Returns a new instance of Watch.



5
6
7
# File 'lib/aws_rsync/watch.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
# 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