vagrant-scp-sync 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
data/docs/index.html ADDED
@@ -0,0 +1,118 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vagrant SCP Sync</title>
8
+ <link rel="stylesheet" href="css/styles.css" />
9
+ <link rel="stylesheet" href="css/main.css" />
10
+ </head>
11
+
12
+ <body>
13
+ <div class="header">
14
+ <div class="container">
15
+ <div class="row d-flex">
16
+ <img
17
+ src="assets/logo-big.jpg"
18
+ class="logo-big img-fluid mx-auto mt-4"
19
+ alt="..."
20
+ />
21
+ </div>
22
+ <div class="row justify-content-md-center">
23
+ <div class="menu-link col-md-auto fs-3 p-3 text-center">
24
+ <a href="https://github.com/STARTcloud/vagrant-scp-sync">Home</a>
25
+ </div>
26
+ <div class="menu-link col-md-auto fs-3 p-3 text-center">
27
+ <a href="http://rubydoc.info/gems/vagrant-scp-sync">Ruby Docs</a>
28
+ </div>
29
+ <div class="menu-link col-md-auto fs-3 p-3 text-center">
30
+ <a href="https://github.com/STARTcloud/vagrant-scp-sync/issues">Issue Tracking</a>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="container">
37
+ <div class="row my-4">
38
+ <div class="col">
39
+ <div class="card shadow">
40
+ <div class="card-body">
41
+ <p class="card-text fs-3 text-center">
42
+ </p>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="container">
50
+ <div class="row">
51
+ <!-- Card 1 -->
52
+ <div class="col-md-6 col-lg-3 my-4">
53
+ <div class="card shadow">
54
+ <div class="card-body">
55
+ <h5 class="card-title mb-4">Manage with Confidence</h5>
56
+ <p class="card-text">
57
+
58
+ </p>
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <!-- Card 2 -->
64
+ <div class="col-md-6 col-lg-3 my-4">
65
+ <div class="card shadow">
66
+ <div class="card-body">
67
+ <h5 class="card-title mb-4">Create your Automation</h5>
68
+ <p class="card-text">
69
+
70
+ </p>
71
+ </div>
72
+ </div>
73
+ </div>
74
+
75
+ <!-- Card 3 -->
76
+ <div class="col-md-6 col-lg-3 my-4">
77
+ <div class="card shadow">
78
+ <div class="card-body">
79
+ <h5 class="card-title mb-4">Share with Others</h5>
80
+ <p class="card-text">
81
+ This tool will allow you to package and share boxes
82
+ with other users, helping you develope on a wide
83
+ array of Hypervisors and Operating Systems.
84
+ </p>
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ <!-- Card 4 -->
90
+ <div class="col-md-6 col-lg-3 my-4">
91
+ <div class="card shadow">
92
+ <div class="card-body">
93
+ <h5 class="card-title mb-4">Feature Requests</h5>
94
+ <p class="card-text">
95
+ Reach out to use in a GitHub issue and let us know what
96
+ your projects goals are. If you can commit to testing
97
+ we can work on getting your feature commited.
98
+ </p>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="container">
106
+ <div class="card shadow footer mt-5">
107
+ <img
108
+ src="assets/logo-small.png"
109
+ class="logo-small mx-auto my-4"
110
+ alt="..."
111
+ />
112
+ <p class="copyright text-center pb-4 mb-0">
113
+ ©2022 STARTcloud, Inc.
114
+ </p>
115
+ </div>
116
+ </div>
117
+ </body>
118
+ </html>
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module VagrantPlugins
6
+ module ScpSync
7
+ module Command
8
+ # This class defines SCPSync
9
+ class ScpSync < Vagrant.plugin(2, :command)
10
+ def self.synopsis
11
+ 'Copies data into a box via SCP'
12
+ end
13
+
14
+ def execute
15
+ @file1, @file2 = parse_args
16
+ return if @file2.nil?
17
+
18
+ with_target_vms(host) do |machine|
19
+ @ssh_info = machine.ssh_info
20
+ raise Vagrant::Errors::SSHNotReady if @ssh_info.nil?
21
+
22
+ user_at_host = "#{@ssh_info[:username]}@#{@ssh_info[:host]}"
23
+ if net_ssh_command == :upload!
24
+ target = "#{user_at_host}:'#{target_files}'"
25
+ source = "'#{source_files}'"
26
+ else
27
+ target = "'#{target_files}'"
28
+ source = "#{user_at_host}:'#{source_files}'"
29
+ 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
+ end
51
+ end
52
+
53
+ private
54
+
55
+ def parse_args
56
+ opts = OptionParser.new do |o|
57
+ o.banner = "Usage: vagrant scp <local_path> [vm_name]:<remote_path> \n"
58
+ o.banner += " vagrant scp [vm_name]:<remote_path> <local_path> \n"
59
+ o.banner += 'Directories will be copied recursively.'
60
+ o.separator ''
61
+ o.separator 'Options:'
62
+ o.separator ''
63
+ end
64
+ argv = parse_options(opts)
65
+ return argv if argv && argv.length == 2
66
+
67
+ @env.ui.info(opts.help, prefix: false) if argv
68
+ [nil, nil]
69
+ end
70
+
71
+ def host
72
+ host = [@file1, @file2].map do |file_spec|
73
+ file_spec.match(/^([^:]*):/)[1]
74
+ rescue NoMethodError
75
+ nil
76
+ end.compact.first
77
+ host = nil if host.nil? || host == '' || host.zero?
78
+ host
79
+ end
80
+
81
+ def net_ssh_command
82
+ @file1.include?(':') ? :download! : :upload!
83
+ end
84
+
85
+ def source_files
86
+ format_file_path(@file1)
87
+ end
88
+
89
+ def target_files
90
+ if target_location_specified?
91
+ format_file_path(@file2)
92
+ else
93
+ Pathname.new(source_files).basename
94
+ end
95
+ end
96
+
97
+ def format_file_path(filepath)
98
+ if filepath.include?(':')
99
+ filepath.split(':').last.gsub('~', "/home/#{@ssh_info[:username]}")
100
+ else
101
+ filepath
102
+ end
103
+ end
104
+
105
+ def target_location_specified?
106
+ !@file2.end_with?(':')
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module ScpSync
5
+ # This defines the class for the plugin vagrant-scp-sync
6
+ class Plugin < Vagrant.plugin('2')
7
+ name 'vagrant-scp-sync'
8
+ description <<-DESC
9
+ Copy files to vagrant boxes via scp
10
+ DESC
11
+
12
+ command 'scp' do
13
+ require_relative 'commands/scp'
14
+ Command::ScpSync
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vagrant
4
+ module ScpSync
5
+ VERSION = '0.5.8'
6
+ NAME = 'vagrant-scp-sync'
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-scp-sync/version'
4
+ require 'vagrant-scp-sync/plugin'
data/locales/en.yml ADDED
@@ -0,0 +1,5 @@
1
+ en:
2
+ vagrant_scp_sync:
3
+ errors:
4
+ not_yet_implemented: |-
5
+ Configuration is not yet implemented
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ Encoding.default_external = Encoding::UTF_8
4
+
5
+ require File.expand_path('lib/vagrant-scp-sync/version', __dir__)
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'vagrant-scp-sync'
9
+ spec.version = Vagrant::ScpSync::VERSION
10
+ spec.authors = ['Mark Gilbert']
11
+ spec.email = ['Mark.Gilbert@prominic.net']
12
+ spec.summary = 'Copy files to a Vagrant VM via SCP.'
13
+ spec.description = spec.summary
14
+ spec.homepage = 'https://github.com/STARTCloud/vagrant-scp-sync'
15
+ spec.license = 'AGPL-3.0'
16
+ spec.metadata = {
17
+ 'rubygems_mfa_required' => 'true',
18
+ 'bug_tracker_uri' => 'https://github.com/STARTcloud/vagrant-scp-sync/issues',
19
+ 'changelog_uri' => 'https://github.com/STARTcloud/vagrant-scp-sync/blob/main/CHANGELOG.md',
20
+ 'documentation_uri' => 'http://rubydoc.info/gems/vagrant-scp-sync',
21
+ 'source_code_uri' => 'https://github.com/STARTCloud/vagrant-scp-sync',
22
+ 'github_repo' => 'https://github.com/STARTCloud/vagrant-scp-sync'
23
+ }
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = 'bin'
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.required_ruby_version = '>= 2.7.0'
31
+ spec.required_rubygems_version = '>= 1.3.6'
32
+ spec.add_runtime_dependency 'i18n', '~> 1.0'
33
+ spec.add_runtime_dependency 'iniparse', '~> 1.0'
34
+ spec.add_runtime_dependency 'log4r', '~> 1.1'
35
+ spec.add_runtime_dependency 'netaddr', '~> 2.0', '>= 2.0.4'
36
+ spec.add_runtime_dependency 'net-scp', '>= 1.1'
37
+ spec.add_runtime_dependency 'ruby_expect', '~> 1.7', '>= 1.7.5'
38
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-scp-sync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.8
5
+ platform: ruby
6
+ authors:
7
+ - Mark Gilbert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: i18n
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: iniparse
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: log4r
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: netaddr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.0.4
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '2.0'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.0.4
75
+ - !ruby/object:Gem::Dependency
76
+ name: net-scp
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.1'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '1.1'
89
+ - !ruby/object:Gem::Dependency
90
+ name: ruby_expect
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.7'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.7.5
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '1.7'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.7.5
109
+ description: Copy files to a Vagrant VM via SCP.
110
+ email:
111
+ - Mark.Gilbert@prominic.net
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
117
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
118
+ - ".github/dependabot.yml"
119
+ - ".github/workflows/codeql-analysis.yml"
120
+ - ".github/workflows/lint-release-and-publish.yml"
121
+ - ".github/workflows/ruby-lint.yml"
122
+ - ".gitignore"
123
+ - ".rspec"
124
+ - ".rubocop.yml"
125
+ - CHANGELOG.md
126
+ - CODE_OF_CONDUCT.md
127
+ - CONTRIBUTING.md
128
+ - Gemfile
129
+ - LICENSE.txt
130
+ - PULL_REQUEST_TEMPLATE.md
131
+ - README.md
132
+ - RELEASE.md
133
+ - Rakefile
134
+ - SECURITY.md
135
+ - docs/CNAME
136
+ - docs/_config.yml
137
+ - docs/css/main.css
138
+ - docs/css/styles.css
139
+ - docs/index.html
140
+ - lib/vagrant-scp-sync.rb
141
+ - lib/vagrant-scp-sync/commands/scp.rb
142
+ - lib/vagrant-scp-sync/plugin.rb
143
+ - lib/vagrant-scp-sync/version.rb
144
+ - locales/en.yml
145
+ - vagrant-scp.gemspec
146
+ homepage: https://github.com/STARTCloud/vagrant-scp-sync
147
+ licenses:
148
+ - AGPL-3.0
149
+ metadata:
150
+ rubygems_mfa_required: 'true'
151
+ bug_tracker_uri: https://github.com/STARTcloud/vagrant-scp-sync/issues
152
+ changelog_uri: https://github.com/STARTcloud/vagrant-scp-sync/blob/main/CHANGELOG.md
153
+ documentation_uri: http://rubydoc.info/gems/vagrant-scp-sync
154
+ source_code_uri: https://github.com/STARTCloud/vagrant-scp-sync
155
+ github_repo: https://github.com/STARTCloud/vagrant-scp-sync
156
+ post_install_message:
157
+ rdoc_options: []
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 2.7.0
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: 1.3.6
170
+ requirements: []
171
+ rubygems_version: 3.2.3
172
+ signing_key:
173
+ specification_version: 4
174
+ summary: Copy files to a Vagrant VM via SCP.
175
+ test_files: []