synchrotron 0.0.8 → 0.1.0.beta.1
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 +4 -4
- data/bin/synchrotron +3 -1
- data/lib/synchrotron/version.rb +1 -1
- data/lib/synchrotron.rb +27 -9
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583a705e35b97685cd08344c090445d0b6b68186
|
4
|
+
data.tar.gz: 91a73f7b6ad82ef18c17e16c7b35ed11f4982569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bebcd99f0fc151e20c99877df1be2a01d4b49b83fd5c116138ce8b98d19fea88d2bff4a894fb4ed0491336791fd354b74053e9b3a76c587344b56d851fb566
|
7
|
+
data.tar.gz: 8e9a157e3b289b57f88a576bc0c43e6c5996a8828c4c68e6dddfb5b816796872d4b7261b146ca9769d9408dc911826c770c787bd203741effa8ae54d114d0b44
|
data/bin/synchrotron
CHANGED
data/lib/synchrotron/version.rb
CHANGED
data/lib/synchrotron.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
require 'find'
|
2
2
|
require 'pathname'
|
3
|
-
require 'thread'
|
4
|
-
|
5
3
|
require 'rb-fsevent'
|
4
|
+
require 'thread'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
require_relative 'synchrotron/ignore'
|
7
|
+
require_relative 'synchrotron/logger'
|
8
|
+
require_relative 'synchrotron/stream'
|
9
|
+
require_relative 'synchrotron/version'
|
11
10
|
|
12
11
|
module Synchrotron; class << self
|
12
|
+
# If more than this many paths change at once, we'll just do a full resync.
|
13
|
+
MAX_CHANGED_PATHS = 1
|
14
|
+
|
15
|
+
# If the change queue exceeds this size, we'll clear it and do a full resync.
|
16
|
+
MAX_QUEUE_SIZE = 1
|
17
|
+
|
13
18
|
attr_reader :config, :ignore, :log, :scanner
|
14
19
|
|
15
20
|
def init(config = {})
|
@@ -72,15 +77,28 @@ module Synchrotron; class << self
|
|
72
77
|
|
73
78
|
@sync_thread = Thread.new do
|
74
79
|
while changed = @queue.pop do
|
75
|
-
@log.verbose "
|
80
|
+
@log.verbose "#{changed.size} changed path(s) detected (change sets in queue: #{@queue.size})"
|
76
81
|
|
77
82
|
changed.each {|path| @log.verbose "--> #{path}" }
|
78
|
-
|
83
|
+
|
84
|
+
if @queue.size > MAX_QUEUE_SIZE
|
85
|
+
@log.verbose "Syncing the root path since the queue is too large (#{@queue.size})"
|
86
|
+
@queue.clear
|
87
|
+
sync
|
88
|
+
elsif changed.size > MAX_CHANGED_PATHS
|
89
|
+
@log.verbose "Syncing the root path since more than #{MAX_CHANGED_PATHS} path(s) changed"
|
90
|
+
sync
|
91
|
+
else
|
92
|
+
changed.each {|path| sync(path) if File.exist?(path) }
|
93
|
+
end
|
79
94
|
end
|
80
95
|
end
|
81
96
|
|
82
97
|
fsevent = FSEvent.new
|
83
|
-
fsevent.watch(@config[:local_path], {
|
98
|
+
fsevent.watch(@config[:local_path], {
|
99
|
+
:latency => 1,
|
100
|
+
:no_defer => false
|
101
|
+
}) do |paths|
|
84
102
|
changed = coalesce_changes(paths.reject {|path| @ignore.match(path) })
|
85
103
|
@queue << changed unless changed.empty?
|
86
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synchrotron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Grove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|
@@ -85,10 +85,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: 1.2.0
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.2.
|
88
|
+
rubygems_version: 2.5.2.3
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Synchrotron monitors a local directory tree and performs nearly instantaneous
|
92
92
|
one-way synchronization of changes to a remote directory using rsync.
|
93
93
|
test_files: []
|
94
|
-
has_rdoc:
|