entangler 1.3.3 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/entangler.gemspec +1 -0
- data/exe/entangler +19 -7
- data/lib/entangler/entangled_file.rb +1 -1
- data/lib/entangler/executor/background/base.rb +6 -6
- data/lib/entangler/executor/base.rb +8 -2
- data/lib/entangler/executor/validation/master.rb +4 -4
- data/lib/entangler/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f771c45fb004582c9d0dd513078d868968799eced4329ffb12ae26af25edc9
|
4
|
+
data.tar.gz: 2099f06c0b478738ed7486c2d8af0baf7e8ec9eb44844e3cc367ca2ed669ac13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f79f9ec42e30d2a3c033cbf350fa3f6ca158c43f62290a8f9a67ebc02feb2cdf1b36b8cef461fa28e43dbbb88080a10453be4a7ae966feef7354b34c4ec9a540
|
7
|
+
data.tar.gz: cb83a67740893ae8d0e972be608e6aab64f80f31e47b126faf1f5b0f830148e53986c51fd877343541264dd9b92461137c3dff71839f62989f0c47914ca75d54
|
data/README.md
CHANGED
@@ -30,6 +30,8 @@ Options:
|
|
30
30
|
All paths should be relative to the base sync directory.
|
31
31
|
-p, --port PORT Overwrite the SSH port (usually 22)
|
32
32
|
(doesn't do anything in slave mode)
|
33
|
+
--force-polling Forces the use of the listen polling adapter
|
34
|
+
(works cross-platform, generally slower, doesn't do anything in slave mode)
|
33
35
|
--no-rvm Skip attempting to load RVM on remote
|
34
36
|
-v, --verbose Log Debug lines
|
35
37
|
-q, --quiet Don't log to stdout in master process
|
data/entangler.gemspec
CHANGED
data/exe/entangler
CHANGED
@@ -18,26 +18,36 @@ def value_opt(options, opts, key, *args)
|
|
18
18
|
end
|
19
19
|
|
20
20
|
options = {}
|
21
|
+
# rubocop:disable Metrics/BlockLength
|
21
22
|
OptionParser.new do |opts|
|
22
|
-
opts.banner =
|
23
|
+
opts.banner = <<~BANNER
|
24
|
+
Entangler v#{Entangler::VERSION}
|
23
25
|
|
24
|
-
Usage:
|
25
|
-
|
26
|
-
|
26
|
+
Usage:
|
27
|
+
entangler master <base_dir> <remote_user>@<remote_host>:<remote_base_dir> [options]
|
28
|
+
entangler master <base_dir> <other_synced_base_dir> [options]
|
29
|
+
BANNER
|
27
30
|
|
28
31
|
opts.separator ''
|
29
32
|
opts.separator 'Options:'
|
30
33
|
|
31
34
|
opts.on('-i', "--ignore '.git'", "Ignore path when syncing, string is regex if surrounded by '/'",
|
32
|
-
'All paths should be relative to the base sync directory
|
35
|
+
'All paths should be relative to the base sync directory') do |ignore|
|
33
36
|
options[:ignore] ||= []
|
34
37
|
options[:ignore] << ignore
|
35
38
|
end
|
36
39
|
|
37
40
|
value_opt(options, opts, :port, '-p', '--port PORT', 'Overwrite the SSH port (usually 22)',
|
38
41
|
"(doesn't do anything in slave mode)")
|
42
|
+
|
43
|
+
bool_opt(options, opts, :force_polling, '--force-polling',
|
44
|
+
'Forces the use of the listen polling adapter',
|
45
|
+
"(works cross-platform, generally slower, doesn't do anything in slave mode)")
|
46
|
+
|
39
47
|
bool_opt(options, opts, :no_rvm, '--no-rvm', 'Skip attempting to load RVM on remote')
|
48
|
+
|
40
49
|
bool_opt(options, opts, :verbose, '-v', '--verbose', 'Log Debug lines')
|
50
|
+
|
41
51
|
bool_opt(options, opts, :quiet, '-q', '--quiet', "Don't log to stdout in master process")
|
42
52
|
|
43
53
|
opts.on_tail('--version', 'Show version number') do
|
@@ -50,6 +60,7 @@ Usage:
|
|
50
60
|
exit
|
51
61
|
end
|
52
62
|
end.parse!
|
63
|
+
# rubocop:enable Metrics/BlockLength
|
53
64
|
|
54
65
|
mode = ARGV.shift
|
55
66
|
unless mode && %w[master slave].include?(mode)
|
@@ -102,17 +113,18 @@ end
|
|
102
113
|
|
103
114
|
if options[:ignore]
|
104
115
|
opts[:ignore] = options[:ignore].map do |opt|
|
105
|
-
opt = opt[1..-2] if opt.start_with?('"') && opt.end_with?('"') || opt.start_with?("'") && opt.end_with?("'")
|
116
|
+
opt = opt[1..-2] if (opt.start_with?('"') && opt.end_with?('"')) || (opt.start_with?("'") && opt.end_with?("'"))
|
106
117
|
|
107
118
|
if ToRegexp::String.literal? opt
|
108
119
|
source, *rest = opt.as_regexp(detect: true)
|
109
|
-
|
120
|
+
Regexp.new "^#{source}(?:/[^/]+)*$", *rest
|
110
121
|
else
|
111
122
|
opt.to_regexp(detect: true)
|
112
123
|
end
|
113
124
|
end
|
114
125
|
end
|
115
126
|
|
127
|
+
opts[:force_polling] = options[:force_polling]
|
116
128
|
opts[:no_rvm] = options[:no_rvm]
|
117
129
|
opts[:quiet] = options[:quiet]
|
118
130
|
opts[:verbose] = options[:verbose]
|
@@ -47,7 +47,7 @@ module Entangler
|
|
47
47
|
|
48
48
|
def write_contents
|
49
49
|
delete_file if file_exists? && File.directory?(full_path)
|
50
|
-
File.
|
50
|
+
File.write(full_path, contents)
|
51
51
|
File.utime(File.atime(full_path), desired_modtime, full_path)
|
52
52
|
end
|
53
53
|
|
@@ -42,12 +42,12 @@ module Entangler
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def listener
|
45
|
-
@listener ||=
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
@listener ||= Listen::Listener.new(base_dir,
|
46
|
+
ignore!: @opts[:ignore],
|
47
|
+
force_polling: @opts[:force_polling]) do |modified, added, removed|
|
48
|
+
process_local_changes(generate_entangled_files(added, :create) +
|
49
|
+
generate_entangled_files(modified, :update) +
|
50
|
+
generate_entangled_files(removed, :delete))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -11,6 +11,9 @@ module Entangler
|
|
11
11
|
include Entangler::Executor::Background::Base
|
12
12
|
include Entangler::Executor::Validation::Base
|
13
13
|
|
14
|
+
GIT_IGNORE_REGEX = %r{^\.git(?:/[^/]+)*$}.freeze
|
15
|
+
ENTANGLER_IGNORE_REGEX = /^\.entangler.*/.freeze
|
16
|
+
|
14
17
|
attr_reader :base_dir
|
15
18
|
|
16
19
|
def initialize(base_dir, opts = {})
|
@@ -19,8 +22,9 @@ module Entangler
|
|
19
22
|
@recently_received_paths = []
|
20
23
|
@listener_pauses = [false, false]
|
21
24
|
@opts = opts
|
22
|
-
@opts[:ignore] = [
|
23
|
-
@opts[:ignore] <<
|
25
|
+
@opts[:ignore] = [GIT_IGNORE_REGEX] unless @opts.key?(:ignore)
|
26
|
+
@opts[:ignore] << ENTANGLER_IGNORE_REGEX
|
27
|
+
@opts[:force_polling] ||= false
|
24
28
|
|
25
29
|
validate_opts
|
26
30
|
Entangler::Logger.create_log_dir(base_dir)
|
@@ -56,6 +60,8 @@ module Entangler
|
|
56
60
|
@logger ||= Entangler::Logger.new(log_outputs, verbose: @opts[:verbose])
|
57
61
|
end
|
58
62
|
|
63
|
+
private
|
64
|
+
|
59
65
|
def log_outputs
|
60
66
|
[Entangler::Logger.log_file_path(base_dir)]
|
61
67
|
end
|
@@ -51,8 +51,8 @@ module Entangler
|
|
51
51
|
|
52
52
|
res = `#{generate_ssh_command('entangler --version', source_rvm: true)}`
|
53
53
|
if res.empty?
|
54
|
-
msg = 'Entangler is not installed on the remote server.' \
|
55
|
-
'
|
54
|
+
msg = 'Entangler is not installed on the remote server. ' \
|
55
|
+
'Install Entangler on the remote server (SSH in, then `gem install entangler`), then try again.'
|
56
56
|
raise Entangler::NotInstalledOnRemoteError, msg
|
57
57
|
end
|
58
58
|
|
@@ -60,8 +60,8 @@ module Entangler
|
|
60
60
|
local_version = Gem::Version.new(Entangler::VERSION)
|
61
61
|
return unless major_version_mismatch?(local_version, remote_version)
|
62
62
|
|
63
|
-
msg = 'Entangler version too far apart, please update either local or remote Entangler.' \
|
64
|
-
"
|
63
|
+
msg = 'Entangler version too far apart, please update either local or remote Entangler. ' \
|
64
|
+
"Local version is #{local_version} and remote version is #{remote_version}."
|
65
65
|
raise Entangler::VersionMismatchError, msg
|
66
66
|
end
|
67
67
|
|
data/lib/entangler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: entangler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Allie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,7 +152,8 @@ files:
|
|
152
152
|
homepage: https://github.com/daveallie/entangler
|
153
153
|
licenses:
|
154
154
|
- MIT
|
155
|
-
metadata:
|
155
|
+
metadata:
|
156
|
+
rubygems_mfa_required: 'true'
|
156
157
|
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|