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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d19adaa07cc52746ac91f99dc954b5b85c3d1150b41ffb4e789c453efe404ae
4
- data.tar.gz: bf4db87f65060754f52063a41dfc27094027fd8165e4b722f051e6af069dd6cf
3
+ metadata.gz: 5b752ff64938cd1e8c5abd600ce03aebc501b0a45088aea45d73f14f3cf1bd8f
4
+ data.tar.gz: a68ed7c8374b0e380d8dc183c222d42c904edbecaf4b198fc82a89e960e3419d
5
5
  SHA512:
6
- metadata.gz: 4caca9a0bb7a879d9133d0aadf74768f2252866f6b5729eb45935ee5d975bb7029a77a40d2e9ada50026ee196bf2ca1a54e5aa4169ca0e87892670a8dc818587
7
- data.tar.gz: 50b8a7101b60a5f4b29906f38b92a1cfc1671ebac8cd7aba1fe78ae879cda7d4f2a441ec248e68a7201959f356e12dc0e5583c8cee6e9ea234ba8290b0385e7a
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 not found" unless File.exist? 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
- @watcher.dir_rwatch source, &method(:track)
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
- @to_sync << Pathname.new(event.absolute_name).relative_path_from(@pathname).to_s
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
@@ -1,5 +1,5 @@
1
1
  module LiveSync
2
2
 
3
- VERSION = '1.0.0.beta2'
3
+ VERSION = '1.0.0.beta3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-livesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braulio Oliveira