entangler 1.1.1 → 1.1.2

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
- SHA1:
3
- metadata.gz: 7664234684080baaf20298dfc18cb7ab65894387
4
- data.tar.gz: e90330937c330a0967e086057d8e044785505e35
2
+ SHA256:
3
+ metadata.gz: 85849db77d8ac84bbb9e7230de8f2d20f88dba32786a029ae0fb06c2700707b6
4
+ data.tar.gz: 27e90f34ff9c31bc325b907926cf9906144f363d56b361100a62da2ab81a8539
5
5
  SHA512:
6
- metadata.gz: da01d358c301ff60072b67b10e74703446ca0e24a4d70ba0bef1a9eb6a23be7ac16b021de7f768934ffce9e9262e410f619dbf02ab20b6886c88839324092c8c
7
- data.tar.gz: 0824476a729ee980afd9ad8eb0d0c371c5b0bbe5f31b826678131027afc9b985341520f9f565e5a2ed3a282406d08c8b960c79eecaebf6898400b63d480467bd
6
+ metadata.gz: c57b439657b3314fe8cc44018208e364610321de33939bc9cf34fceb4b0108de61c4385a9aaf7700748f122118af4d62a3fff267461eb912b8cf421103fc4ddd
7
+ data.tar.gz: 85da07278c48587669f37ed4e8e16abb4474ba55c3fc13a850dc322e1cea66f7934136261bc1302ade69074bbd6d29e9022609693a8db85d0edc48021c729117
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in entangler.gemspec
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Entangler
1
+ <p align="center" style="width: 50px;"><img src="https://vignette1.wikia.nocookie.net/pokemon/images/e/ef/114Tangela_Dream.png/revision/latest/scale-to-width-down/185?cb=20141203054028"/></p>
2
+ <h1 align="center">Entangler</h1>
2
3
 
3
4
  [![Build Status](https://travis-ci.org/daveallie/entangler.svg?branch=master)](https://travis-ci.org/daveallie/entangler)
4
5
 
@@ -18,7 +19,7 @@ $ entangler master /some/base/path user@remote:/some/remote/path
18
19
 
19
20
  ```
20
21
  $ entangler -h
21
- Entangler v1.1.1
22
+ Entangler v1.1.2
22
23
 
23
24
  Usage:
24
25
  entangler master <base_dir> <remote_user>@<remote_host>:<remote_base_dir> [options]
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'entangler/version'
4
6
 
@@ -19,10 +21,10 @@ Gem::Specification.new do |spec|
19
21
  spec.executables = ['entangler']
20
22
  spec.require_paths = ['lib']
21
23
 
22
- spec.add_development_dependency 'bundler', '~> 1.13'
23
- spec.add_development_dependency 'rake', '~> 10.0'
24
- spec.add_development_dependency 'rspec', '~> 3.0'
25
- spec.add_development_dependency 'rubocop', '~> 0.49.1'
24
+ spec.add_development_dependency 'bundler', '>= 2.1'
25
+ spec.add_development_dependency 'rake', '>= 12.3.3'
26
+ spec.add_development_dependency 'rspec', '>= 3.9'
27
+ spec.add_development_dependency 'rubocop', '>= 0.80'
26
28
  spec.add_dependency 'listen', '~> 3.1'
27
29
  spec.add_dependency 'to_regexp', '~> 0.2.0'
28
30
  end
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'entangler'
3
5
  require 'optparse'
4
6
  require 'to_regexp'
@@ -99,9 +101,7 @@ end
99
101
 
100
102
  if options[:ignore]
101
103
  opts[:ignore] = options[:ignore].map do |opt|
102
- if opt.start_with?('"') && opt.end_with?('"') || opt.start_with?("'") && opt.end_with?("'")
103
- opt = opt[1..-2]
104
- end
104
+ opt = opt[1..-2] if opt.start_with?('"') && opt.end_with?('"') || opt.start_with?("'") && opt.end_with?("'")
105
105
 
106
106
  if ToRegexp::String.literal? opt
107
107
  source, *rest = opt.as_regexp(detect: true)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'entangler/version'
2
4
  require_relative 'entangler/errors'
3
5
  require_relative 'entangler/logger'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
 
3
5
  module Entangler
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
4
  class EntanglerError < StandardError; end
3
5
  class ValidationError < EntanglerError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'listen'
2
4
  require 'entangler/entangled_file'
3
5
  require 'benchmark'
@@ -56,6 +58,7 @@ module Entangler
56
58
  def remove_recently_changed_files(entangled_files)
57
59
  @recently_received_paths.select! { |_, time| Time.now.to_f < time + 0.5 }
58
60
  paths = @recently_received_paths.map(&:first)
61
+ logger.debug("Skipping paths #{paths.join(", ")} as they have changed recently") if paths.any?
59
62
  entangled_files.reject { |ef| paths.include?(ef.path) }
60
63
  end
61
64
 
@@ -75,6 +78,7 @@ module Entangler
75
78
  def process_remote_changes(changes)
76
79
  with_listener_pause(1) do
77
80
  return if changes.nil?
81
+
78
82
  logger.info("Processing - #{changes.length} remote changes")
79
83
  logger.debug("File List:\n#{changes.map(&:path).join("\n")}")
80
84
  with_log_time("Completed - #{changes.length} remote changes") do
@@ -97,9 +101,9 @@ module Entangler
97
101
 
98
102
  def with_kill_threads_rescue
99
103
  yield
100
- rescue => e
101
- $stderr.puts e.message
102
- $stderr.puts e.backtrace.join("\n")
104
+ rescue StandardError => e
105
+ warn e.message
106
+ warn e.backtrace.join("\n")
103
107
  kill_off_threads
104
108
  end
105
109
 
@@ -107,8 +111,9 @@ module Entangler
107
111
  @listener_pauses[idx] = true
108
112
  listener.pause
109
113
  yield
110
- @listener_pauses[idx] = false
111
- listener.start if @listener_pauses.none?
114
+ ensure
115
+ @listener_pauses[idx] = false
116
+ listener.start if @listener_pauses.none?
112
117
  end
113
118
 
114
119
  def with_log_time(msg)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
 
3
5
  module Entangler
@@ -21,7 +23,7 @@ module Entangler
21
23
  super
22
24
  begin
23
25
  Process.wait @remote_thread[:pid]
24
- rescue
26
+ rescue StandardError
25
27
  nil
26
28
  end
27
29
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logger'
2
4
  require 'fileutils'
3
- require 'thread'
4
5
  require_relative 'background/base'
5
6
  require_relative 'validation/base'
6
7
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
4
  module Helper
3
5
  def self.with_temp_file(name: 'tmp_file', contents: nil)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'helpers'
2
4
  require_relative 'background/master'
3
5
  require_relative 'validation/master'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
4
  module Executor
3
5
  class Slave < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
4
  module Executor
3
5
  module Validation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
4
  module Executor
3
5
  module Validation
@@ -21,8 +23,10 @@ module Entangler
21
23
  unless File.directory?(@opts[:remote_base_dir])
22
24
  raise Entangler::ValidationError, 'Destination directory is a file'
23
25
  end
26
+
24
27
  @opts[:remote_base_dir] = File.realpath(File.expand_path(@opts[:remote_base_dir]))
25
28
  return unless @opts[:remote_base_dir] == base_dir
29
+
26
30
  raise Entangler::ValidationError, "Destination directory can't be the same as the base directory"
27
31
  end
28
32
 
@@ -31,6 +35,7 @@ module Entangler
31
35
  raise Entangler::ValidationError, 'Missing remote base dir' unless keys.include?(:remote_base_dir)
32
36
  raise Entangler::ValidationError, 'Missing remote user' unless keys.include?(:remote_user)
33
37
  raise Entangler::ValidationError, 'Missing remote host' unless keys.include?(:remote_host)
38
+
34
39
  validate_remote_base_dir
35
40
  validate_remote_entangler_version
36
41
  end
@@ -43,10 +48,12 @@ module Entangler
43
48
 
44
49
  def validate_remote_entangler_version
45
50
  return unless @opts[:remote_mode]
51
+
46
52
  res = `#{generate_ssh_command('source ~/.rvm/environments/default && entangler --version')}`
47
53
  remote_version = Gem::Version.new(res.strip)
48
54
  local_version = Gem::Version.new(Entangler::VERSION)
49
55
  return unless major_version_mismatch?(local_version, remote_version)
56
+
50
57
  msg = 'Entangler version too far apart, please update either local or remote Entangler.' \
51
58
  " Local version is #{local_version} and remote version is #{remote_version}."
52
59
  raise Entangler::VersionMismatchError, msg
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'logger'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Entangler
2
- VERSION = '1.1.1'.freeze
4
+ VERSION = '1.1.2'
3
5
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entangler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Allie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-06 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '3.9'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '3.9'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.49.1
61
+ version: '0.80'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.49.1
68
+ version: '0.80'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: listen
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -140,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.6.12
143
+ rubygems_version: 3.1.2
145
144
  signing_key:
146
145
  specification_version: 4
147
146
  summary: Two way file syncer using platform native notify.