vagrant-scp-sync 0.5.26 → 0.5.28

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61f1926cb1f70c6621ac3b31fbf2edbd46589ee4a8c29242c8db7f0908a17496
4
- data.tar.gz: d13e86d331ee8963264d3515f43affcc0421dffed7459f8bb12585af82ecd156
3
+ metadata.gz: bf6209e986838ed0df71e3def682be412a7c9bc67272bcd82761533dd4dc9a17
4
+ data.tar.gz: b09da588cf177e7b102414f5c1984ad3f5082d8dbc54af7717efb5cfb10444f5
5
5
  SHA512:
6
- metadata.gz: 5b5045fb6e101431eaa8fd3a2f6e129aad58721a96f326aa939c83663c8effb618d7021d664975782169d16c53a5428eb235d6fd08e0ee94df29cb8c53752a14
7
- data.tar.gz: 670d25bf4857c3dcc0e2daab2051794ab2b3835b588be8f3cc2232621c37d0142135ef7d770abbeee425125f68389bf24f8d8cdd08f92a8c9a7a414b4550057c
6
+ metadata.gz: bbdc62a90063f5c4592826cb26c98848d88de8adfbce15249d329c07a5d62211b3091a6a5adf807faba350f042463f3c31a4b0023febabef7fb7eacf6a87ea4c
7
+ data.tar.gz: 8521432666f398a5fedea53cd5c8043ea16b0ca8c63890dd8fa6d077c334efb209db02fbf70a00d3f18258b00fe8f9b2515c7626ceb0f671fdee8ada9683fa75
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.28](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.27...v0.5.28) (2025-01-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * FIle paths with quotes break things, this is an attempt to workaround/fix that - making rubocop happy ([08d661f](https://github.com/STARTcloud/vagrant-scp-sync/commit/08d661f6a63e894d9f012d4969e99053c259dde1))
9
+ * FIle paths with quotes break things, this is an attempt to workaround/fix that - making rubocop happy ([9a305a1](https://github.com/STARTcloud/vagrant-scp-sync/commit/9a305a16fe0bf43cf61c16260ad2e04c79663deb))
10
+
11
+ ## [0.5.27](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.26...v0.5.27) (2025-01-15)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * FIle paths with quotes break things, this is an attempt to workaround/fix that - making rubocop happy ([525d3f3](https://github.com/STARTcloud/vagrant-scp-sync/commit/525d3f396c503e79d2a0fc700b6e24de55379321))
17
+
3
18
  ## [0.5.26](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.25...v0.5.26) (2025-01-15)
4
19
 
5
20
 
@@ -20,7 +20,7 @@ module VagrantPlugins
20
20
 
21
21
  # This will SCP the files
22
22
  class ScpSyncHelper
23
- def self.scp_single(machine, opts)
23
+ def self.scp_single(machine, opts, scp_path)
24
24
  ssh_info = machine.ssh_info
25
25
  raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
26
26
 
@@ -42,8 +42,9 @@ module VagrantPlugins
42
42
 
43
43
  if opts[:direction] == :upload || opts[:direction].nil?
44
44
  # For upload direction
45
- target_check = build_ssh_command(ssh_opts, "test -e '#{target_files}' && echo 'EXISTS' || echo 'NOT_EXISTS'", ssh_info)
46
- target_type_check = build_ssh_command(ssh_opts, "test -d '#{target_files}' && echo 'DIR' || echo 'FILE'", ssh_info)
45
+ target_path = opts[:to]
46
+ target_check = build_ssh_command(ssh_opts, "test -e '#{target_path}' && echo 'EXISTS' || echo 'NOT_EXISTS'", ssh_info)
47
+ target_type_check = build_ssh_command(ssh_opts, "test -d '#{target_path}' && echo 'DIR' || echo 'FILE'", ssh_info)
47
48
 
48
49
  # Check if target exists and its type
49
50
  target_exists = execute_command_with_output(machine, target_check).strip == 'EXISTS'
@@ -57,22 +58,22 @@ module VagrantPlugins
57
58
  end
58
59
 
59
60
  # Determine target path based on existence and trailing slash
60
- target_base = "#{ssh_info[:username]}@#{ssh_info[:host]}:'#{target_files}'"
61
+ target_base = "#{ssh_info[:username]}@#{ssh_info[:host]}:'#{target_path}'"
61
62
  target = if target_exists && target_is_dir && !has_trailing_slash_target
62
63
  # If target exists as directory but no trailing slash, put source inside it
63
- "#{ssh_info[:username]}@#{ssh_info[:host]}:'#{target_files}/#{File.basename(source_files)}'"
64
+ "#{ssh_info[:username]}@#{ssh_info[:host]}:'#{target_path}/#{File.basename(source_files)}'"
64
65
  else
65
66
  target_base
66
67
  end
67
68
 
68
69
  # Prepare remote target directory with proper permissions
69
- target_dir = target_files
70
- target_dir = File.dirname(target_files) unless target_is_dir || has_trailing_slash_target
70
+ target_dir = target_path
71
+ target_dir = File.dirname(target_path) unless target_is_dir || has_trailing_slash_target
71
72
 
72
73
  make_dir = build_ssh_command(ssh_opts, "sudo mkdir -p '#{target_dir}'", ssh_info)
73
74
  change_ownership = build_ssh_command(ssh_opts, "sudo chown -R #{opts[:owner]}:#{opts[:group]} '#{target_dir}'", ssh_info)
74
75
  change_permissions = build_ssh_command(ssh_opts, "sudo chmod -R 777 '#{target_dir}'", ssh_info)
75
- remove_dir = build_ssh_command(ssh_opts, "sudo rm -rf '#{target_files}'", ssh_info) if delete
76
+ remove_dir = build_ssh_command(ssh_opts, "sudo rm -rf '#{target_path}'", ssh_info) if delete
76
77
 
77
78
  elsif opts[:direction] == :download
78
79
  # For download direction
@@ -97,7 +98,7 @@ module VagrantPlugins
97
98
  end
98
99
 
99
100
  # Build and execute the scp command with sync message
100
- synchronize = build_scp_command(ssh_opts, source, target)
101
+ synchronize = build_scp_command(scp_path, ssh_opts, source, target)
101
102
  execute_command(machine, synchronize, true, 'scp_sync_folder', opts)
102
103
  end
103
104
 
@@ -114,9 +115,10 @@ module VagrantPlugins
114
115
  ['ssh', *ssh_opts, "#{ssh_info[:username]}@#{ssh_info[:host]}", "'#{command}'"].join(' ')
115
116
  end
116
117
 
117
- def self.build_scp_command(ssh_opts, source, target)
118
- # Just use 'scp' and let the shell find it, like we do with ssh
119
- ['scp', '-r', *ssh_opts, source, target].join(' ')
118
+ def self.build_scp_command(scp_path, ssh_opts, source, target)
119
+ # Quote the scp path if it contains spaces
120
+ scp_path = "'#{scp_path}'" if scp_path.include?(' ')
121
+ [scp_path, '-r', *ssh_opts, source, target].join(' ')
120
122
  end
121
123
 
122
124
  def self.execute_command(machine, command, raise_error, message_key, opts)
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'vagrant/util/subprocess'
5
+ require 'vagrant/util/which'
5
6
 
6
7
  module VagrantPlugins
7
8
  module ScpSync
@@ -21,14 +22,16 @@ module VagrantPlugins
21
22
  if @source.nil? && @target.nil?
22
23
  folders = machine.config.vm.synced_folders
23
24
  ssh_info = machine.ssh_info
25
+ scp_path = Vagrant::Util::Which.which('scp')
24
26
  machine.ui.warn(I18n.t('vagrant.scp_ssh_password')) if ssh_info[:private_key_path].empty? && ssh_info[:password]
25
27
  folders.each_value do |folder_opts|
26
28
  next unless folder_opts[:type] == :scp
27
29
 
28
- VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts)
30
+ VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
29
31
  end
30
32
  else
31
33
  ssh_info = machine.ssh_info
34
+ scp_path = Vagrant::Util::Which.which('scp')
32
35
  direction = net_ssh_command(@source)
33
36
  source = format_file_path(machine, @source)
34
37
  target = format_file_path(machine, @target)
@@ -46,7 +49,7 @@ module VagrantPlugins
46
49
  hostpath: source
47
50
  }
48
51
 
49
- VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts)
52
+ VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
50
53
  end
51
54
  end
52
55
  end
@@ -31,13 +31,12 @@ module VagrantPlugins
31
31
 
32
32
  def enable(machine, folders, _opts)
33
33
  ssh_info = machine.ssh_info
34
- # Still check if scp exists, but don't pass the path
35
- return false unless Which.which('scp')
34
+ scp_path = Which.which('scp')
36
35
 
37
36
  machine.ui.warn(I18n.t('vagrant.scp_ssh_password')) if ssh_info[:private_key_path].empty? && ssh_info[:password]
38
37
 
39
38
  folders.each_value do |folder_opts|
40
- ScpSyncHelper.scp_single(machine, folder_opts)
39
+ ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
41
40
  end
42
41
  end
43
42
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vagrant
4
4
  module ScpSync
5
- VERSION = '0.5.26'
5
+ VERSION = '0.5.28'
6
6
  NAME = 'vagrant-scp-sync'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-scp-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.26
4
+ version: 0.5.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Gilbert