vagrant-scp-sync 0.5.11 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/lib/vagrant-scp-sync/action/scp_sync.rb +9 -2
- data/lib/vagrant-scp-sync/command/scp.rb +49 -53
- data/lib/vagrant-scp-sync/errors.rb +5 -0
- data/lib/vagrant-scp-sync/plugin.rb +5 -6
- data/lib/vagrant-scp-sync/version.rb +1 -1
- data/locales/en.yml +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d7890574cfeac17cfa54d6e859a59843468dc9b92ad3b794db653fab88621cf
|
4
|
+
data.tar.gz: 590f3b065e047e2dc238b5435e786e3f6f3e6e2008fe098e3d57ebfc69af845a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40988d02a76d1b48976ab8d1059160893abdfec4b03bc4d4b99a5d2735435c8bb7b253d6626b0036473ea3f2bd13de437329ca5da003b9649c9bf72d1cac686d
|
7
|
+
data.tar.gz: 918b1764a4dbb4ce9ffd71bf70446528b347b0402620b8215547ddb68aece4e20e956b952be38bc00a6cbf79a77b692a468a2f294e974472c4625f3712d59ed3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.5.13](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.12...v0.5.13) (2024-12-23)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* single file sync ([e827137](https://github.com/STARTcloud/vagrant-scp-sync/commit/e827137d3b5c64a1e226188ee29b04c205b8a855))
|
9
|
+
* single file sync - lint ([7b6d0cf](https://github.com/STARTcloud/vagrant-scp-sync/commit/7b6d0cf504ce0bf93f8e1ed0470b8755721ff23b))
|
10
|
+
|
11
|
+
## [0.5.12](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.11...v0.5.12) (2024-11-20)
|
12
|
+
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* full implentation ([3715346](https://github.com/STARTcloud/vagrant-scp-sync/commit/3715346080fe36ccc08fb401770ef59de13c82ab))
|
17
|
+
* linting ([39b82ae](https://github.com/STARTcloud/vagrant-scp-sync/commit/39b82ae671da035f7bbb3eec693b99f950acc1fc))
|
18
|
+
* linting ([aa71732](https://github.com/STARTcloud/vagrant-scp-sync/commit/aa717326be49ecd3452e9a793c9bba2146a4efc5))
|
19
|
+
* linting ([c6a932b](https://github.com/STARTcloud/vagrant-scp-sync/commit/c6a932b9d476d31ea4bc522bd9356f2a273ca9bd))
|
20
|
+
* linting ([390be27](https://github.com/STARTcloud/vagrant-scp-sync/commit/390be27b4f042ae22e035d2829f236f59cccbced))
|
21
|
+
* linting ([ce4ba83](https://github.com/STARTcloud/vagrant-scp-sync/commit/ce4ba83954f318062886492f4742950b0b726957))
|
22
|
+
* linting ([4befd93](https://github.com/STARTcloud/vagrant-scp-sync/commit/4befd9393ff86006291b293534bdefffac5e413b))
|
23
|
+
|
3
24
|
## [0.5.11](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.10...v0.5.11) (2024-11-20)
|
4
25
|
|
5
26
|
|
@@ -14,7 +14,6 @@ module VagrantPlugins
|
|
14
14
|
source_files = expand_path(opts[:map], machine)
|
15
15
|
has_trailing_slash_source = opts[:map].end_with?('/')
|
16
16
|
sync_source_files = append_wildcard(source_files, has_trailing_slash_source)
|
17
|
-
|
18
17
|
target_files = expand_path(opts[:to], machine)
|
19
18
|
|
20
19
|
opts[:owner] ||= ssh_info[:username]
|
@@ -35,7 +34,15 @@ module VagrantPlugins
|
|
35
34
|
elsif opts[:direction] == :download
|
36
35
|
source = "#{ssh_info[:username]}@#{ssh_info[:host]}:#{sync_source_files}"
|
37
36
|
target = target_files
|
38
|
-
|
37
|
+
|
38
|
+
# For directory sync or explicit directory target (ends with slash), create the full path
|
39
|
+
if has_trailing_slash_source || target.end_with?('/')
|
40
|
+
make_dir = "mkdir -p #{target}"
|
41
|
+
else
|
42
|
+
# For file targets, only create the parent directory if it's not '.'
|
43
|
+
parent_dir = File.dirname(target)
|
44
|
+
make_dir = parent_dir == '.' ? nil : "mkdir -p #{parent_dir}"
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
synchronize = build_scp_command(scp_path, ssh_opts, source, target)
|
@@ -1,52 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
+
require 'vagrant/util/subprocess'
|
5
|
+
require 'vagrant/util/which'
|
4
6
|
|
5
7
|
module VagrantPlugins
|
6
8
|
module ScpSync
|
7
9
|
module Command
|
8
10
|
# This class defines SCPSync
|
9
|
-
class
|
11
|
+
class ScpSyncCommand < Vagrant.plugin('2', :command)
|
10
12
|
def self.synopsis
|
11
13
|
'Copies data into a box via SCP'
|
12
14
|
end
|
13
15
|
|
14
16
|
def execute
|
15
|
-
@
|
16
|
-
return if @file2.nil?
|
17
|
+
@source, @target = parse_args
|
17
18
|
|
18
19
|
with_target_vms(host) do |machine|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
raise Vagrant::Errors::SSHNotReady if machine.ssh_info.nil?
|
21
|
+
|
22
|
+
if @source.nil? && @target.nil?
|
23
|
+
folders = machine.config.vm.synced_folders
|
24
|
+
ssh_info = machine.ssh_info
|
25
|
+
scp_path = Vagrant::Util::Which.which('scp')
|
26
|
+
machine.ui.warn(I18n.t('vagrant.scp_ssh_password')) if ssh_info[:private_key_path].empty? && ssh_info[:password]
|
27
|
+
folders.each_value do |folder_opts|
|
28
|
+
next unless folder_opts[:type] == :scp
|
29
|
+
|
30
|
+
VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
|
31
|
+
end
|
26
32
|
else
|
27
|
-
|
28
|
-
|
33
|
+
ssh_info = machine.ssh_info
|
34
|
+
scp_path = Vagrant::Util::Which.which('scp')
|
35
|
+
direction = net_ssh_command(@source)
|
36
|
+
source = format_file_path(machine, @source)
|
37
|
+
target = format_file_path(machine, @target)
|
38
|
+
folder_opts = {
|
39
|
+
type: :scp,
|
40
|
+
map: source,
|
41
|
+
to: target,
|
42
|
+
owner: ssh_info[:username],
|
43
|
+
group: ssh_info[:username],
|
44
|
+
direction: direction,
|
45
|
+
scp__args: ['--delete'],
|
46
|
+
rsync__args: ['--delete'],
|
47
|
+
disabled: false,
|
48
|
+
guestpath: target,
|
49
|
+
hostpath: source
|
50
|
+
}
|
51
|
+
|
52
|
+
VagrantPlugins::ScpSync::ScpSyncHelper.scp_single(machine, folder_opts, scp_path)
|
29
53
|
end
|
30
|
-
|
31
|
-
proxy_command = if @ssh_info[:proxy_command]
|
32
|
-
"-o ProxyCommand='#{@ssh_info[:proxy_command]}'"
|
33
|
-
else
|
34
|
-
''
|
35
|
-
end
|
36
|
-
|
37
|
-
command = [
|
38
|
-
'scp',
|
39
|
-
'-r',
|
40
|
-
'-o StrictHostKeyChecking=no',
|
41
|
-
'-o UserKnownHostsFile=/dev/null',
|
42
|
-
"-o port=#{@ssh_info[:port]}",
|
43
|
-
'-o LogLevel=ERROR',
|
44
|
-
proxy_command,
|
45
|
-
@ssh_info[:private_key_path].map { |k| "-i '#{k}'" }.join(' '),
|
46
|
-
source,
|
47
|
-
target
|
48
|
-
].join(' ')
|
49
|
-
system(command)
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
@@ -62,14 +66,16 @@ module VagrantPlugins
|
|
62
66
|
o.separator ''
|
63
67
|
end
|
64
68
|
argv = parse_options(opts)
|
65
|
-
return argv if argv && argv.length == 2
|
69
|
+
return argv if argv && (argv.empty? || argv.length == 2)
|
66
70
|
|
67
|
-
@env.ui.info(opts.help, prefix: false)
|
71
|
+
@env.ui.info(opts.help, prefix: false)
|
68
72
|
[nil, nil]
|
69
73
|
end
|
70
74
|
|
75
|
+
require_relative '../action/scp_sync'
|
76
|
+
|
71
77
|
def host
|
72
|
-
host = [@
|
78
|
+
host = [@source, @target].map do |file_spec|
|
73
79
|
file_spec.match(/^([^:]*):/)[1]
|
74
80
|
rescue NoMethodError
|
75
81
|
nil
|
@@ -78,33 +84,23 @@ module VagrantPlugins
|
|
78
84
|
host
|
79
85
|
end
|
80
86
|
|
81
|
-
def net_ssh_command
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
def source_files
|
86
|
-
format_file_path(@file1)
|
87
|
+
def net_ssh_command(source)
|
88
|
+
source.include?(':') ? :download : :upload
|
87
89
|
end
|
88
90
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
else
|
93
|
-
Pathname.new(source_files).basename
|
94
|
-
end
|
91
|
+
def expand_path(path, machine)
|
92
|
+
expanded_path = File.expand_path(path, machine.env.root_path)
|
93
|
+
Vagrant::Util::Platform.fs_real_path(expanded_path).to_s
|
95
94
|
end
|
96
95
|
|
97
|
-
def format_file_path(filepath)
|
96
|
+
def format_file_path(machine, filepath)
|
97
|
+
ssh_info = machine.ssh_info
|
98
98
|
if filepath.include?(':')
|
99
|
-
filepath.split(':').last.gsub('~', "/home/#{
|
99
|
+
filepath.split(':').last.gsub('~', "/home/#{ssh_info[:username]}")
|
100
100
|
else
|
101
101
|
filepath
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
105
|
-
def target_location_specified?
|
106
|
-
!@file2.end_with?(':')
|
107
|
-
end
|
108
104
|
end
|
109
105
|
end
|
110
106
|
end
|
@@ -15,6 +15,11 @@ module VagrantPlugins
|
|
15
15
|
error_key(:scp_sync_error, 'vagrant_scp_sync.errors')
|
16
16
|
end
|
17
17
|
|
18
|
+
# This Class denotes Errors for Manual SCP Sync
|
19
|
+
class SyncedFolderScpSyncScpSyncFolderError < VagrantScpSyncError
|
20
|
+
error_key(:scp_sync_folder_error, 'vagrant_scp_sync.errors')
|
21
|
+
end
|
22
|
+
|
18
23
|
# This Class denotes Delete Dir Errors for SCP Sync
|
19
24
|
class SyncedFolderScpSyncDeleteDirError < VagrantScpSyncError
|
20
25
|
error_key(:scp_sync_error_delete_directory, 'vagrant_scp_sync.errors')
|
@@ -17,12 +17,6 @@ module VagrantPlugins
|
|
17
17
|
Copy files to vagrant boxes via scp
|
18
18
|
DESC
|
19
19
|
|
20
|
-
command 'scp' do
|
21
|
-
setup_i18n
|
22
|
-
require_relative 'command/scp'
|
23
|
-
Command
|
24
|
-
end
|
25
|
-
|
26
20
|
synced_folder('scp', 5) do
|
27
21
|
require_relative 'synced_folder'
|
28
22
|
SyncedFolder
|
@@ -69,6 +63,11 @@ module VagrantPlugins
|
|
69
63
|
# from the parent logger.
|
70
64
|
setup_logging
|
71
65
|
setup_i18n
|
66
|
+
|
67
|
+
command('scp') do
|
68
|
+
require_relative 'command/scp'
|
69
|
+
Command::ScpSyncCommand
|
70
|
+
end
|
72
71
|
end
|
73
72
|
end
|
74
73
|
end
|
data/locales/en.yml
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
en:
|
2
2
|
vagrant_scp_sync:
|
3
3
|
action:
|
4
|
-
scp_sync_folder:
|
5
|
-
Syncing Folder: %{source_files} ==> %{target_files}
|
6
|
-
|
4
|
+
scp_sync_folder: "Syncing files: %{source_files} ==> %{target_files}"
|
7
5
|
errors:
|
8
6
|
not_yet_implemented: |-
|
9
7
|
Configuration is not yet implemented
|
@@ -39,6 +37,13 @@ en:
|
|
39
37
|
Full command causing error:
|
40
38
|
%{command}
|
41
39
|
|
40
|
+
scp_sync_folder_error: |-
|
41
|
+
There was an error when attemping to sync folders using scp.
|
42
|
+
Please inspect the error message below for more info.
|
43
|
+
Error: %{stderr}
|
44
|
+
Full command causing error:
|
45
|
+
%{command}
|
46
|
+
|
42
47
|
scp_sync_error: |-
|
43
48
|
There was an error when attemping to sync folders using scp.
|
44
49
|
Please inspect the error message below for more info.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Gilbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|