ruby-livesync 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby-livesync/live_sync/sync.rb +9 -3
- data/lib/ruby-livesync/live_sync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b752ff64938cd1e8c5abd600ce03aebc501b0a45088aea45d73f14f3cf1bd8f
|
4
|
+
data.tar.gz: a68ed7c8374b0e380d8dc183c222d42c904edbecaf4b198fc82a89e960e3419d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1e8e35696105846bde4cd4592f70bce67007e0cd570299993587a276845b4366cc71d91608637ae8745ded4c2b61ac247825190b9dbba87ff4d90e11ada15d
|
7
|
+
data.tar.gz: 930d1b2b01093cb90e06ed60316822b0c36d2e17f20089b0d0c30b54faeb358a65d77973c0ccfe30bc1d39960e28fb2d4e400cfd4844128952a5c5ada4ac3ff6
|
@@ -27,7 +27,7 @@ module LiveSync
|
|
27
27
|
|
28
28
|
dsl :user, default: :root
|
29
29
|
dsl :source do |source|
|
30
|
-
raise "#{ctx}: source
|
30
|
+
raise "#{ctx}: source isn't a directory" unless File.directory? source
|
31
31
|
fill_name source
|
32
32
|
@pathname = Pathname.new source
|
33
33
|
end
|
@@ -58,7 +58,7 @@ module LiveSync
|
|
58
58
|
@watcher = Watcher.new self
|
59
59
|
@scheduler = Rufus::Scheduler.new
|
60
60
|
|
61
|
-
|
61
|
+
watch source
|
62
62
|
@rsync.initial
|
63
63
|
schedule
|
64
64
|
sleep 1.day while true
|
@@ -66,7 +66,13 @@ module LiveSync
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def track event
|
69
|
-
|
69
|
+
path = event.absolute_name
|
70
|
+
watch path if File.directory?(path) and :create.in? event.flags
|
71
|
+
@to_sync << Pathname.new(path).relative_path_from(@pathname).to_s
|
72
|
+
end
|
73
|
+
|
74
|
+
def watch dir
|
75
|
+
@watcher.dir_rwatch dir, &method(:track)
|
70
76
|
end
|
71
77
|
|
72
78
|
def schedule
|