vagrant-fsevents 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff3c027295a82cc4458e19498c34f67405a6d7b499b9d92ce5f1734c03180fc2
4
- data.tar.gz: 94e3895892dfe5720a339870e9b8cb51fd9400cad118b629be231156c66601cb
3
+ metadata.gz: 98217ab4f20b02c03c844a5a085062017c72b5ea12b5410ec1fc25ff0fb00d5b
4
+ data.tar.gz: 673b9b21240ba2859381cd36939f2e5f5b81ec7af262dd324bc69bcef06c690a
5
5
  SHA512:
6
- metadata.gz: 1d6eb87e0ca897174facbd5bbea0a2f117b6e4c956408dee6f5fec7c9b2c7fea7e8681e9bd8b6098691380a144957c69204f20bb7c94eb5c23849616781c5686
7
- data.tar.gz: c7b42f798582d22e07d118b3140860002507afc67fba4542a970e2adacba1c6f40497c96743a131705664dd59a8c8da0fefff6b729e08a6bc74862db62d0edf7
6
+ metadata.gz: eceace66c2f6bac16d288069da84aa8e00265741e190c3085ee821b03334d5ae8cd777e9ed818aa3f98fa481022c36ffaa30701464ff8d1dee074a56fcb697b7
7
+ data.tar.gz: 8dd5bf1e0388d3a3aa27c304702e7b9d7d79a280c76cc127761c5b610faecf3111cfe09d2baae2e7ac58772c4d8e0f4dd57b8c5206003debd2b14549756f896d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 - 2019-04-01
4
+
5
+ - Bugfix with new 'include' keyword - guest path wasn't always correct using includes
6
+ - Updated version to semantically indicate addition of 'include' keyword
7
+
3
8
  ## 0.4.3 - 2019-03-31
4
9
 
5
10
  - Added new 'include' keyword (complimenting the 'exclude' keyword) to help work around symlink issues with guard/listen
@@ -7,6 +7,7 @@ module VagrantPlugins
7
7
  attr_reader :path
8
8
  attr_reader :type
9
9
  attr_reader :watch
10
+ attr_reader :sync_path
10
11
  attr_reader :watch_path
11
12
  attr_reader :relative_path
12
13
  attr_reader :full_path_on_guest
@@ -14,24 +15,25 @@ module VagrantPlugins
14
15
  # Takes the output of a listen callback (as arrays of strings of
15
16
  # files split by type of change) and converts them into single events
16
17
  # for a specific watch definition
17
- def self.make(mods, adds, removes, watch_path, watch)
18
+ def self.make(mods, adds, removes, watch)
18
19
  change_events = []
19
20
  structure = { modified: mods, added: adds, removed: removes }
20
21
  structure.each do |type, files|
21
22
  files.each do |path|
22
- change_events.push new(path, type, watch_path, watch)
23
+ change_events.push new(path, type, watch)
23
24
  end
24
25
  end
25
26
  change_events
26
27
  end
27
28
 
28
- def initialize(path, type, watch_path, watch)
29
+ def initialize(path, type, watch)
29
30
  @path = path
30
31
  @type = type
31
- @watch_path = watch_path
32
+ @sync_path = watch[:sync_path]
33
+ @watch_path = watch[:watch_path]
32
34
  @watch = watch
33
35
 
34
- @relative_path = path.sub(watch_path, '')
36
+ @relative_path = path.sub(sync_path, '')
35
37
  @full_path_on_guest = File.join(
36
38
  (watch[:opts][:override_guestpath] || watch[:opts][:guestpath]),
37
39
  @relative_path
@@ -21,15 +21,24 @@ module VagrantPlugins
21
21
  folder.each do |id, opts|
22
22
  next unless active_for_folder? opts[:fsevents]
23
23
 
24
- hostpaths = get_hostpaths(opts, machine)
25
-
26
- hostpaths.each do |hostpath|
27
- @watch[hostpath] = { id: id, machine: machine, opts: opts }
28
- end
24
+ add_folder_to_watch(id, opts, machine)
29
25
  end
30
26
  end
31
27
  end
32
28
 
29
+ # Populates `@watch` attribute from a single watch
30
+ def add_folder_to_watch(id, opts, machine)
31
+ get_paths(opts, machine).each do |paths|
32
+ @watch[paths[:hostpath]] = {
33
+ id: id,
34
+ machine: machine,
35
+ opts: opts,
36
+ sync_path: paths[:syncpath],
37
+ watch_path: paths[:hostpath]
38
+ }
39
+ end
40
+ end
41
+
33
42
  # Populates `@ignore` attribute from a single VM instance
34
43
  def add_folders_to_ignore(folders)
35
44
  folders.values.each do |folder|
@@ -69,19 +78,28 @@ module VagrantPlugins
69
78
  end
70
79
 
71
80
  # Get the hostpath(s) for a given synced folder
72
- def get_hostpaths(options, machine)
81
+ def get_paths(options, machine)
73
82
  paths = (options[:include] || [options[:hostpath]])
74
83
  hostpaths = []
84
+ syncpath = get_host_path(options[:hostpath], machine)
75
85
  paths.each do |path|
76
- hostpath = File.expand_path(path, machine.env.root_path)
77
- hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
78
-
79
- # Avoid creating a nested directory
80
- hostpath += '/' unless hostpath.end_with?('/')
81
- hostpaths << hostpath
86
+ hostpaths << {
87
+ hostpath: get_host_path(path, machine),
88
+ syncpath: syncpath
89
+ }
82
90
  end
83
91
  hostpaths
84
92
  end
93
+
94
+ # Convert a path to a full path on the host machine
95
+ def get_host_path(path, machine)
96
+ hostpath = File.expand_path(path, machine.env.root_path)
97
+ hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
98
+
99
+ # Avoid creating a nested directory
100
+ hostpath += '/' unless hostpath.end_with?('/')
101
+ hostpath
102
+ end
85
103
  end
86
104
  end
87
105
  end
@@ -16,8 +16,8 @@ module VagrantPlugins
16
16
 
17
17
  clear_expired_change_locks
18
18
 
19
- events_to_sync = watches.map do |watch_path, watch|
20
- events = ChangeEvents.make(mods, adds, removes, watch_path, watch)
19
+ events_to_sync = watches.map do |_, watch|
20
+ events = ChangeEvents.make(mods, adds, removes, watch)
21
21
  add_locks(remove_locked_events(select_by_relevance(events)))
22
22
  end
23
23
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Fsevents
3
- VERSION = '0.4.3'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-fsevents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolf Hatch