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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/vagrant-scp-sync/action/scp_sync.rb +24 -27
- data/lib/vagrant-scp-sync/ssh_options.rb +19 -0
- data/lib/vagrant-scp-sync/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39eb1408a8d8e620bac881ec74ac17bab6834e2d0a5506278aa88922c0481585
|
4
|
+
data.tar.gz: 3239d37962771cc1a7e330a633617fce7f6fb96bbb4a522569389d10f9595beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
70
|
+
# Create local target directory without sudo
|
68
71
|
target = target_files
|
69
|
-
|
70
|
-
|
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,
|
75
|
-
execute_command(machine, make_dir,
|
76
|
-
|
77
|
-
|
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, '
|
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, :
|
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
|
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.
|
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
|