vagrant-scp-sync 0.5.15 → 0.5.16

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: 8c3921e597aab855812426f77e3a91e807643551972b963e04992e04b43172c4
4
- data.tar.gz: 1d3fd272ed5e7f3e5b111766a699a62e12ac593e61efcba981a4a4ad98779922
3
+ metadata.gz: 39eb1408a8d8e620bac881ec74ac17bab6834e2d0a5506278aa88922c0481585
4
+ data.tar.gz: 3239d37962771cc1a7e330a633617fce7f6fb96bbb4a522569389d10f9595beb
5
5
  SHA512:
6
- metadata.gz: f1cab41bd06b2c0f9469a85b2d3926625c6bf15dd5a7ef7ba105ead7aa1e07e00545138d01af8b91683cbf78d7f13c33097de8f1df14f2fb541fc177fb75fb39
7
- data.tar.gz: 5caa59840811a8bdeeabd325c9bb54b231e99568efde4c9cf39ae20f8d54136dcaf6383328cb83b14654129a9a31b43a506e084ec481544cbae92d8c86aa4a1e
6
+ metadata.gz: 1b0cf61de8a0475b78eb94db00cf064be8e135924ec6760c8e7b21330900fe6451c450854c2257051bf2d9db588b8976cfa56013c6196a01392d2f7e76de97bc
7
+ data.tar.gz: 2a295ad03d2082d32fbc5ac8dfea8753f44431c79315faaad0394f82f7d5b57856000ec59c817e8f02b5043da6bd61f0ceb4c3e41a92711f3c5989abffc86d5a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.16](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.15...v0.5.16) (2024-12-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * single file sync - lint ([d953d76](https://github.com/STARTcloud/vagrant-scp-sync/commit/d953d761e37668f77d2b8d2c4417a3351bd260e8))
9
+ * single file sync - lint ([9d179eb](https://github.com/STARTcloud/vagrant-scp-sync/commit/9d179eb36d01b85c75aade4a04a59eae8280264b))
10
+ * single file sync - lint ([dad006f](https://github.com/STARTcloud/vagrant-scp-sync/commit/dad006fa9da87ac57a79a95124a741f9183a67f0))
11
+
3
12
  ## [0.5.15](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.14...v0.5.15) (2024-12-23)
4
13
 
5
14
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'vagrant/util/platform'
4
4
  require 'vagrant/util/subprocess'
5
+ require 'vagrant-scp-sync/ssh_options'
5
6
 
6
7
  module VagrantPlugins
7
8
  module ScpSync
@@ -17,7 +18,7 @@ module VagrantPlugins
17
18
  opts[:owner] ||= ssh_info[:username]
18
19
  opts[:group] ||= ssh_info[:username]
19
20
 
20
- ssh_opts = build_ssh_options(ssh_info)
21
+ ssh_opts = SshOptions.build(ssh_info)
21
22
  scp_opts = build_scp_options(opts)
22
23
 
23
24
  delete = scp_opts.include?('--delete')
@@ -52,11 +53,13 @@ module VagrantPlugins
52
53
  target_base
53
54
  end
54
55
 
55
- # Prepare target directory
56
- parent_dir = File.dirname(target_files)
57
- make_dir = build_ssh_command(ssh_opts, "sudo mkdir -p #{parent_dir}", ssh_info)
58
- change_ownership = build_ssh_command(ssh_opts, "sudo chown -R #{opts[:owner]}:#{opts[:group]} #{parent_dir}", ssh_info)
59
- change_permissions = build_ssh_command(ssh_opts, "sudo chmod 777 #{parent_dir}", ssh_info)
56
+ # Prepare remote target directory with proper permissions
57
+ target_dir = target_files
58
+ target_dir = File.dirname(target_files) unless target_is_dir || has_trailing_slash_target
59
+
60
+ make_dir = build_ssh_command(ssh_opts, "sudo mkdir -p #{target_dir}", ssh_info)
61
+ change_ownership = build_ssh_command(ssh_opts, "sudo chown -R #{opts[:owner]}:#{opts[:group]} #{target_dir}", ssh_info)
62
+ change_permissions = build_ssh_command(ssh_opts, "sudo chmod -R 777 #{target_dir}", ssh_info)
60
63
  remove_dir = build_ssh_command(ssh_opts, "sudo rm -rf #{target_files}", ssh_info) if delete
61
64
 
62
65
  elsif opts[:direction] == :download
@@ -64,21 +67,26 @@ module VagrantPlugins
64
67
  source = "#{ssh_info[:username]}@#{ssh_info[:host]}:#{source_files}"
65
68
  source = "#{source}/*" if has_trailing_slash_source
66
69
 
67
- # Create target directory if needed
70
+ # Create local target directory without sudo
68
71
  target = target_files
69
- parent_dir = File.dirname(target)
70
- make_dir = "mkdir -p #{parent_dir}"
72
+ target_dir = target_files
73
+ target_dir = File.dirname(target_files) unless File.directory?(target_files) || has_trailing_slash_target
74
+ make_dir = "mkdir -p #{target_dir}"
71
75
  end
72
76
 
73
- # Execute commands
74
- execute_command(machine, remove_dir, delete, nil, opts) if delete
75
- execute_command(machine, make_dir, false, nil, opts)
76
- execute_command(machine, change_ownership, false, nil, opts) if opts[:direction] == :upload
77
- execute_command(machine, change_permissions, false, nil, opts) if opts[:direction] == :upload
77
+ # Execute commands with proper error messages
78
+ execute_command(machine, remove_dir, true, 'scp_sync_error_delete_directory', opts) if delete
79
+ execute_command(machine, make_dir, true, 'scp_sync_error_make_directory', opts)
80
+
81
+ # For upload, ensure remote directory permissions
82
+ if opts[:direction] == :upload || opts[:direction].nil?
83
+ execute_command(machine, change_ownership, true, 'scp_sync_error_change_ownership_directory', opts)
84
+ execute_command(machine, change_permissions, true, 'scp_sync_error_change_permissions_directory', opts)
85
+ end
78
86
 
79
87
  # Build and execute the scp command
80
88
  synchronize = build_scp_command(scp_path, ssh_opts, source, target)
81
- execute_command(machine, synchronize, true, 'scp_sync_folder', opts)
89
+ execute_command(machine, synchronize, true, 'scp_sync_folder_error', opts)
82
90
  end
83
91
 
84
92
  def self.expand_path(path, machine)
@@ -86,17 +94,6 @@ module VagrantPlugins
86
94
  Vagrant::Util::Platform.fs_real_path(expanded_path).to_s
87
95
  end
88
96
 
89
- def self.build_ssh_options(ssh_info)
90
- opts = %w[
91
- -o StrictHostKeyChecking=no
92
- -o UserKnownHostsFile=/dev/null
93
- -o LogLevel=ERROR
94
- ]
95
- opts << "-o port=#{ssh_info[:port]}"
96
- opts << ssh_info[:private_key_path].map { |k| "-i #{k}" }.join(' ')
97
- opts
98
- end
99
-
100
97
  def self.build_scp_options(opts)
101
98
  opts[:scp__args] ? Array(opts[:scp__args]).dup : ['--verbose']
102
99
  end
@@ -141,7 +138,7 @@ module VagrantPlugins
141
138
  stderr: stderr
142
139
  end
143
140
 
144
- private_class_method :expand_path, :build_ssh_options, :build_scp_options,
141
+ private_class_method :expand_path, :build_scp_options,
145
142
  :build_ssh_command, :build_scp_command, :execute_command,
146
143
  :execute_command_with_output, :raise_scp_error
147
144
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module ScpSync
5
+ # Helper class for building SSH options
6
+ class SshOptions
7
+ def self.build(ssh_info)
8
+ opts = %w[
9
+ -o StrictHostKeyChecking=no
10
+ -o UserKnownHostsFile=/dev/null
11
+ -o LogLevel=ERROR
12
+ ]
13
+ opts << "-o port=#{ssh_info[:port]}"
14
+ opts << ssh_info[:private_key_path].map { |k| "-i #{k}" }.join(' ')
15
+ opts
16
+ end
17
+ end
18
+ end
19
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Vagrant
4
4
  module ScpSync
5
- VERSION = '0.5.15'
5
+ VERSION = '0.5.16'
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.15
4
+ version: 0.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Gilbert
@@ -143,6 +143,7 @@ files:
143
143
  - lib/vagrant-scp-sync/command/scp.rb
144
144
  - lib/vagrant-scp-sync/errors.rb
145
145
  - lib/vagrant-scp-sync/plugin.rb
146
+ - lib/vagrant-scp-sync/ssh_options.rb
146
147
  - lib/vagrant-scp-sync/synced_folder.rb
147
148
  - lib/vagrant-scp-sync/version.rb
148
149
  - locales/en.yml