Skip to content

Commit

Permalink
Ensure fswatch dependency only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbaudino committed May 15, 2017
1 parent b0a4daf commit 72dd4eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
docker-sync (0.4.5.beta1)
docker-sync (0.4.5)
daemons (~> 1.2, >= 1.2.3)
docker-compose (~> 1.0, >= 1.0.2)
dotenv (~> 2.1, >= 2.1.1)
Expand Down
5 changes: 5 additions & 0 deletions lib/docker-sync/config/project_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def rsync_required?
}
end

def fswatch_required?
config['syncs'].any? { |name, sync_config|
sync_config['watch_strategy'] == 'fswatch'
}
end

private

Expand Down
12 changes: 3 additions & 9 deletions lib/docker-sync/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ def self.ensure_all!(config)
def self.ensure_all_for_mac!(config)
PackageManager.ensure!
Docker.ensure!

if config.unison_required?
Unison.ensure!
end

if config.rsync_required?
Rsync.ensure!
Fswatch.ensure!
end
Unison.ensure! if config.unison_required?
Rsync.ensure! if config.rsync_required?
Fswatch.ensure! if config.fswatch_required?
end

def self.ensure_all_for_linux!(_config)
Expand Down

0 comments on commit 72dd4eb

Please sign in to comment.