Class: Docker_Sync::WatchStrategy::Fswatch
- Inherits:
-
Object
- Object
- Docker_Sync::WatchStrategy::Fswatch
- Includes:
- Execution, Thor::Shell
- Defined in:
- lib/docker_sync/watch_strategy/fswatch.rb
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(sync_name, options) ⇒ Fswatch
constructor
A new instance of Fswatch.
- #run ⇒ Object
- #stop ⇒ Object
- #watch ⇒ Object
- #watch_options ⇒ Object
- #watch_thread ⇒ Object
Methods included from Execution
Constructor Details
#initialize(sync_name, options) ⇒ Fswatch
Returns a new instance of Fswatch.
12 13 14 15 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 12 def initialize(sync_name, ) @sync_name = sync_name = end |
Instance Method Details
#clean ⇒ Object
24 25 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 24 def clean end |
#run ⇒ Object
17 18 19 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 17 def run watch end |
#stop ⇒ Object
21 22 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 21 def stop end |
#watch ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 27 def watch args = say_status 'ok', "Starting to watch #{@options['src']} - Press CTRL-C to stop", :green cmd = 'fswatch ' + args.join(' ') say_status 'command', cmd, :white if ['verbose'] @watch_thread = threadexec(cmd, "Sync #{@sync_name}", :blue) end |
#watch_options ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 36 def args = [] unless ['watch_excludes'].nil? args = ['watch_excludes'].map { |pattern| "--exclude='#{pattern}'" } + args end args.push('-orIE') args.push(['watch_args']) if .key?('watch_args') args.push(['src']) args.push(" | xargs -I -n1 thor sync:sync -n #{@sync_name} --config='#{@options['config_path']}'") end |
#watch_thread ⇒ Object
47 48 49 |
# File 'lib/docker_sync/watch_strategy/fswatch.rb', line 47 def watch_thread return @watch_thread end |