vagrant-scp-sync 0.5.8 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vscode/settings.json +3 -0
- data/CHANGELOG.md +22 -0
- data/lib/vagrant-scp-sync/action/scp_sync.rb +71 -0
- data/lib/vagrant-scp-sync/errors.rb +17 -0
- data/lib/vagrant-scp-sync/plugin.rb +21 -2
- data/lib/vagrant-scp-sync/synced_folder.rb +43 -0
- data/lib/vagrant-scp-sync/version.rb +1 -1
- data/lib/vagrant-scp-sync.rb +10 -0
- data/locales/en.yml +18 -5
- data/vagrant-scp.gemspec +6 -6
- metadata +7 -3
- /data/lib/vagrant-scp-sync/{commands → command}/scp.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b37865ce15d9a043ad16012e533166f7fd9a0b3706aead065563929008fb924
|
4
|
+
data.tar.gz: ecd9d22f28a254d2c711a7975c873fe55abf861acd49b0eea40af85128718501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3513b9189a63c1161f191ed70c7dadbdbfbd4aba0d2fa01ed5916526f019c342cd698c22b48c1458275c78087f1a6e6c639b6bbaa1ec3d5618002d1ddf098e8
|
7
|
+
data.tar.gz: 8f804f9f6c82ba3929ac3a79d4f3984baed01f42b52591b7c9319b1f21ec189afe6b01fb2dde85e4bbe6a1d89c7f80ad559a17aba629ceb7c119a7852181cd85
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.5.10](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.9...v0.5.10) (2024-11-19)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* synced folders refernce ([1510860](https://github.com/STARTcloud/vagrant-scp-sync/commit/15108609d9424f72046035762b1991d7318ccdf1))
|
9
|
+
|
10
|
+
## [0.5.9](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.8...v0.5.9) (2024-11-19)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* add synced folders ([69bc1c6](https://github.com/STARTcloud/vagrant-scp-sync/commit/69bc1c683eddc802746f9e308cc951ad4baaee01))
|
16
|
+
* linting ([e8739c4](https://github.com/STARTcloud/vagrant-scp-sync/commit/e8739c453433e682d8cefe86b3031a9754f3dec8))
|
17
|
+
* linting ([2c92774](https://github.com/STARTcloud/vagrant-scp-sync/commit/2c92774f575ad1279a46cc3926c9b5bbf839410a))
|
18
|
+
* linting ([87edab0](https://github.com/STARTcloud/vagrant-scp-sync/commit/87edab01efdfde25f05d35945bcd5e22c67dad0b))
|
19
|
+
* linting ([98380fc](https://github.com/STARTcloud/vagrant-scp-sync/commit/98380fcf1b8c234ef5a7e42ced475f3416905681))
|
20
|
+
* linting ([bc1c3d8](https://github.com/STARTcloud/vagrant-scp-sync/commit/bc1c3d87432320d77c7e47a023f99f63d98e63fa))
|
21
|
+
* linting ([4b62732](https://github.com/STARTcloud/vagrant-scp-sync/commit/4b62732083b4a7fe516a0c77dec6618bdadd2fa1))
|
22
|
+
* linting ([41bf13b](https://github.com/STARTcloud/vagrant-scp-sync/commit/41bf13b94d233997755bcf48e60e2e26ac8b9f37))
|
23
|
+
* linting ([dd1b58f](https://github.com/STARTcloud/vagrant-scp-sync/commit/dd1b58fd7bad93afa9164dcf46e6f3668ee546be))
|
24
|
+
|
3
25
|
## [0.5.8](https://github.com/STARTcloud/vagrant-scp-sync/compare/v0.5.7...v0.5.8) (2024-06-25)
|
4
26
|
|
5
27
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vagrant/util/platform'
|
4
|
+
require 'vagrant/util/subprocess'
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ScpSync
|
8
|
+
# This will SCP the files
|
9
|
+
class ScpSyncHelper
|
10
|
+
def self.scp_single(machine, opts)
|
11
|
+
ssh_info = machine.ssh_info
|
12
|
+
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
|
13
|
+
|
14
|
+
source_files = opts[:guestpath]
|
15
|
+
target_files = opts[:hostpath]
|
16
|
+
target_files = File.expand_path(target_files, machine.env.root_path)
|
17
|
+
target_files = Vagrant::Util::Platform.fs_real_path(target_files).to_s
|
18
|
+
target_files = Vagrant::Util::Platform.cygwin_path(target_files) if Vagrant::Util::Platform.windows?
|
19
|
+
source_files += '/' unless source_files.end_with?('/')
|
20
|
+
target_files += '/' unless target_files.end_with?('/')
|
21
|
+
opts[:owner] ||= ssh_info[:username]
|
22
|
+
opts[:group] ||= ssh_info[:username]
|
23
|
+
username = ssh_info[:username]
|
24
|
+
host = ssh_info[:host]
|
25
|
+
proxy_command = if @ssh_info[:proxy_command]
|
26
|
+
"-o ProxyCommand='#{@ssh_info[:proxy_command]}' "
|
27
|
+
else
|
28
|
+
''
|
29
|
+
end
|
30
|
+
|
31
|
+
if opts[:direction] == :upload || opts[:direction].nil?
|
32
|
+
source = "'#{source_files}'"
|
33
|
+
target = "#{username}@#{host}:'#{target_files}'"
|
34
|
+
elsif opts[:direction] == :download
|
35
|
+
source = "#{username}@#{host}:'#{source_files}'"
|
36
|
+
target = "'#{target_files}'"
|
37
|
+
end
|
38
|
+
|
39
|
+
command = [
|
40
|
+
'scp',
|
41
|
+
'-r',
|
42
|
+
'-o StrictHostKeyChecking=no',
|
43
|
+
'-o UserKnownHostsFile=/dev/null',
|
44
|
+
"-o port=#{@ssh_info[:port]}",
|
45
|
+
'-o LogLevel=ERROR',
|
46
|
+
proxy_command,
|
47
|
+
@ssh_info[:private_key_path].map { |k| "-i '#{k}'" }.join(' '),
|
48
|
+
source,
|
49
|
+
target
|
50
|
+
].join(' ')
|
51
|
+
|
52
|
+
command_opts = {}
|
53
|
+
command_opts[:workdir] = machine.env.root_path.to_s
|
54
|
+
|
55
|
+
machine.ui.info(I18n.t('vagrant.scp_folder', source_files: source_files, target_files: target_files))
|
56
|
+
|
57
|
+
command += [command_opts]
|
58
|
+
|
59
|
+
r = Vagrant::Util::Subprocess.execute(*command)
|
60
|
+
|
61
|
+
return if r.exit_code.zero?
|
62
|
+
|
63
|
+
raise Vagrant::Errors::SyncedFolderScpSyncError,
|
64
|
+
command: command.inspect,
|
65
|
+
source_files: source_files,
|
66
|
+
target_files: target_files,
|
67
|
+
stderr: r.stderr
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vagrant'
|
4
|
+
|
5
|
+
module Vagrant
|
6
|
+
module Errors
|
7
|
+
# This Class denotes Errors for SCP Sync
|
8
|
+
class SyncedFolderScpSyncError < VagrantError
|
9
|
+
error_key(:scp_sync_error, 'vagrant_scp_sync.errors')
|
10
|
+
end
|
11
|
+
|
12
|
+
# This Class denotes that SCP Sync is not found
|
13
|
+
class SCPNotFound < VagrantError
|
14
|
+
error_key(:scp_installed_error, 'vagrant_scp_sync.errors')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'vagrant'
|
5
|
+
rescue LoadError
|
6
|
+
raise 'The vagrant-scp-sync plugin must be run within Vagrant.'
|
7
|
+
end
|
8
|
+
|
9
|
+
raise 'The vagrant-scp-sync plugin is only compatible with Vagrant 2+' if Vagrant::VERSION < '2'
|
10
|
+
|
3
11
|
module VagrantPlugins
|
4
12
|
module ScpSync
|
5
13
|
# This defines the class for the plugin vagrant-scp-sync
|
@@ -10,8 +18,19 @@ module VagrantPlugins
|
|
10
18
|
DESC
|
11
19
|
|
12
20
|
command 'scp' do
|
13
|
-
|
14
|
-
|
21
|
+
setup_i18n
|
22
|
+
require_relative 'command'
|
23
|
+
Command
|
24
|
+
end
|
25
|
+
|
26
|
+
synced_folder('scp', 5) do
|
27
|
+
require_relative 'synced_folder'
|
28
|
+
SyncedFolder
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.setup_i18n
|
32
|
+
I18n.load_path << File.expand_path('locales/en.yml', ScpSync.source_root)
|
33
|
+
I18n.reload!
|
15
34
|
end
|
16
35
|
end
|
17
36
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'log4r'
|
4
|
+
require 'vagrant/util/subprocess'
|
5
|
+
require 'vagrant/util/which'
|
6
|
+
|
7
|
+
require_relative 'action/scp_sync'
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ScpSync
|
11
|
+
# This Class prepares the environment for SCP Sync
|
12
|
+
class SyncedFolder < Vagrant.plugin('2', :synced_folder)
|
13
|
+
include Vagrant::Util
|
14
|
+
|
15
|
+
def initialize(*args)
|
16
|
+
super
|
17
|
+
|
18
|
+
@logger = Log4r::Logger.new('vagrant_scp_sync')
|
19
|
+
end
|
20
|
+
|
21
|
+
def usable?(_machine, raise_error: false)
|
22
|
+
scp_path = Which.which('scp')
|
23
|
+
return true if scp_path
|
24
|
+
|
25
|
+
return false unless raise_error
|
26
|
+
|
27
|
+
raise Vagrant::Errors::SCPNotFound
|
28
|
+
end
|
29
|
+
|
30
|
+
def prepare(machine, folders, opts); end
|
31
|
+
|
32
|
+
def enable(machine, folders, _opts)
|
33
|
+
ssh_info = machine.ssh_info
|
34
|
+
|
35
|
+
machine.ui.warn(I18n.t('vagrant.scp_ssh_password')) if ssh_info[:private_key_path].empty? && ssh_info[:password]
|
36
|
+
|
37
|
+
folders.each_value do |folder_opts|
|
38
|
+
ScpSyncHelper.scp_single(machine, folder_opts)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/vagrant-scp-sync.rb
CHANGED
@@ -2,3 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'vagrant-scp-sync/version'
|
4
4
|
require 'vagrant-scp-sync/plugin'
|
5
|
+
require 'vagrant-scp-sync/errors'
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
# This is used to SCP files to/from Guests and Hosts
|
9
|
+
module ScpSync
|
10
|
+
def self.source_root
|
11
|
+
@source_root ||= Pathname.new(File.expand_path('..', __dir__))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/locales/en.yml
CHANGED
@@ -1,5 +1,18 @@
|
|
1
|
-
en:
|
2
|
-
vagrant_scp_sync:
|
3
|
-
errors:
|
4
|
-
not_yet_implemented: |-
|
5
|
-
Configuration is not yet implemented
|
1
|
+
en:
|
2
|
+
vagrant_scp_sync:
|
3
|
+
errors:
|
4
|
+
not_yet_implemented: |-
|
5
|
+
Configuration is not yet implemented
|
6
|
+
|
7
|
+
scp_sync_error: |-
|
8
|
+
There was an error when attemping to sync folders using scp.
|
9
|
+
Please inspect the error message below for more info.
|
10
|
+
|
11
|
+
Host path: %{hostpath}
|
12
|
+
Guest path: %{guestpath}
|
13
|
+
Error: %{stderr}
|
14
|
+
Full command causing error:
|
15
|
+
%{command}
|
16
|
+
|
17
|
+
scp_installed_error: |-
|
18
|
+
SCP was not detected as installed
|
data/vagrant-scp.gemspec
CHANGED
@@ -29,10 +29,10 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.required_ruby_version = '>= 2.7.0'
|
31
31
|
spec.required_rubygems_version = '>= 1.3.6'
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
37
|
-
spec.
|
32
|
+
spec.add_dependency 'i18n', '~> 1.0'
|
33
|
+
spec.add_dependency 'iniparse', '~> 1.0'
|
34
|
+
spec.add_dependency 'log4r', '~> 1.1'
|
35
|
+
spec.add_dependency 'netaddr', '~> 2.0', '>= 2.0.4'
|
36
|
+
spec.add_dependency 'net-scp', '>= 1.1'
|
37
|
+
spec.add_dependency 'ruby_expect', '~> 1.7', '>= 1.7.5'
|
38
38
|
end
|
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.10
|
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-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- ".gitignore"
|
123
123
|
- ".rspec"
|
124
124
|
- ".rubocop.yml"
|
125
|
+
- ".vscode/settings.json"
|
125
126
|
- CHANGELOG.md
|
126
127
|
- CODE_OF_CONDUCT.md
|
127
128
|
- CONTRIBUTING.md
|
@@ -138,8 +139,11 @@ files:
|
|
138
139
|
- docs/css/styles.css
|
139
140
|
- docs/index.html
|
140
141
|
- lib/vagrant-scp-sync.rb
|
141
|
-
- lib/vagrant-scp-sync/
|
142
|
+
- lib/vagrant-scp-sync/action/scp_sync.rb
|
143
|
+
- lib/vagrant-scp-sync/command/scp.rb
|
144
|
+
- lib/vagrant-scp-sync/errors.rb
|
142
145
|
- lib/vagrant-scp-sync/plugin.rb
|
146
|
+
- lib/vagrant-scp-sync/synced_folder.rb
|
143
147
|
- lib/vagrant-scp-sync/version.rb
|
144
148
|
- locales/en.yml
|
145
149
|
- vagrant-scp.gemspec
|
File without changes
|