vagrant-scp-macos 0.6.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d20bbfdd4491eec8ef19ffacad47d5c23bbbb2640d1074d2d5a1ccba968e06d5
4
+ data.tar.gz: 3b64c98a6f911ad29ae111faedcaccf7238aeace8f6e1adf62ec1a8f6fa958d3
5
+ SHA512:
6
+ metadata.gz: 39002b8842b848b99bdf1e8395dbe52954595e3fafa651d854e88b188a25829bb72bc01b1d1e287112a8afb2bd499374b9955a4ede7de12ce1379961d71da39a
7
+ data.tar.gz: b0ce9f386538353e3995c50c87bf67a1332cff357b52b64610beab92044620fba299793cb9728353f380efc33d3d123841cb2b9f3d4a14cbf2f29a966a60b66b
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .ruby-version
19
+ .ruby-gemset
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gem "vagrant-scp", path: "."
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Luca Invernizzi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Vagrant::Scp
2
+
3
+ Copy files to a Vagrant guest via SCP.
4
+
5
+ ## Installation
6
+
7
+ You need to install the plugin, like so
8
+
9
+ vagrant plugin install vagrant-scp
10
+
11
+ ## Usage
12
+
13
+ If you have just a single Vagrant guest, you can copy files over like this:
14
+
15
+ vagrant scp <some_local_file_or_dir> <somewhere_on_the_vm>
16
+
17
+ If you have multiple VMs, you can specify it.
18
+
19
+ vagrant scp <some_local_file_or_dir> [vm_name]:<somewhere_on_the_vm>
20
+
21
+ Copying files out of the guest works in the same fashion
22
+
23
+ vagrant scp [vm_name]:<somewhere_on_the_vm> <some_local_file_or_dir>
24
+
25
+ If source is a directory it will be copied recursively.
26
+
27
+
28
+ ## Examples
29
+
30
+ If you have just one guest, you can copy files to it like this:
31
+
32
+ vagrant scp file_on_host.txt :file_on_vm.txt
33
+
34
+ And from the guest like this:
35
+
36
+ vagrant scp :file_on_vm.txt file_on_host.txt
37
+
38
+ ## Vagrant version
39
+ We require Vagrant v1.7 or newer. If you are running older version (check with `vagrant --version`), install recent version directly from [vendor site](https://www.vagrantup.com/).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,105 @@
1
+ require 'pathname'
2
+
3
+ module VagrantPlugins
4
+ module Scp
5
+ module Command
6
+
7
+ class Scp < Vagrant.plugin(2, :command)
8
+
9
+ def self.synopsis
10
+ "copies data into a box via SCP"
11
+ end
12
+
13
+ def execute
14
+ @file_1, @file_2 = parse_args()
15
+ return if @file_2.nil?
16
+
17
+ with_target_vms(host) do |machine|
18
+ @ssh_info = machine.ssh_info
19
+ raise Vagrant::Errors::SSHNotReady if @ssh_info.nil?
20
+ user_at_host = "#{@ssh_info[:username]}@#{@ssh_info[:host]}"
21
+ if net_ssh_command == :upload!
22
+ target = "#{user_at_host}:'#{target_files}'"
23
+ source = "'#{source_files}'"
24
+ else
25
+ target = "'#{target_files}'"
26
+ source = "#{user_at_host}:'#{source_files}'"
27
+ end
28
+
29
+ if @ssh_info[:proxy_command]
30
+ proxy_command = "-o ProxyCommand='#{@ssh_info[:proxy_command]}'"
31
+ else
32
+ proxy_command = ''
33
+ end
34
+
35
+ command = [
36
+ "scp",
37
+ "-r",
38
+ "-O",
39
+ "-o StrictHostKeyChecking=no",
40
+ "-o UserKnownHostsFile=/dev/null",
41
+ "-o port=#{@ssh_info[:port]}",
42
+ proxy_command,
43
+ "-i '#{@ssh_info[:private_key_path][0]}'",
44
+ source,
45
+ target
46
+ ].join(' ')
47
+ system(command)
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def parse_args
54
+ opts = OptionParser.new do |o|
55
+ o.banner = "Usage: vagrant scp <local_path> [vm_name]:<remote_path> \n"
56
+ o.banner += " vagrant scp [vm_name]:<remote_path> <local_path> \n"
57
+ o.banner += "Directories will be copied recursively."
58
+ o.separator ""
59
+ o.separator "Options:"
60
+ o.separator ""
61
+ end
62
+ argv = parse_options(opts)
63
+ return argv if argv and argv.length == 2
64
+ @env.ui.info(opts.help, prefix: false) if argv
65
+ return nil, nil
66
+ end
67
+
68
+ def host
69
+ host = [@file_1, @file_2].map{|file_spec| file_spec.match(/^([^:]*):/)[1] rescue nil}.compact.first
70
+ host = nil if (host.nil? || host == '' || host == 0 )
71
+ host
72
+ end
73
+
74
+ def net_ssh_command
75
+ @file_1.include?(':') ? :download! : :upload!
76
+ end
77
+
78
+ def source_files
79
+ format_file_path(@file_1)
80
+ end
81
+
82
+ def target_files
83
+ if target_location_specified?
84
+ format_file_path(@file_2)
85
+ else
86
+ Pathname.new(source_files).basename
87
+ end
88
+ end
89
+
90
+ def format_file_path(filepath)
91
+ if filepath.include?(':')
92
+ filepath.split(':').last.gsub("~", "/home/#{@ssh_info[:username]}")
93
+ else
94
+ filepath
95
+ end
96
+ end
97
+
98
+ def target_location_specified?
99
+ !@file_2.end_with?(':')
100
+ end
101
+ end
102
+
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,19 @@
1
+ module VagrantPlugins
2
+ module Scp
3
+
4
+ class Plugin < Vagrant.plugin('2')
5
+
6
+ name 'vagrant-scp'
7
+
8
+ description <<-DESC
9
+ Copy files to vagrant boxes via scp
10
+ DESC
11
+
12
+ command "scp" do
13
+ require_relative 'commands/scp.rb'
14
+ Command::Scp
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Scp
3
+ VERSION = "0.6.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "vagrant/scp/macos/version"
2
+ require "vagrant/scp/macos/plugin"
data/publish_gem.sh ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ rm *.gem
3
+ vim lib/vagrant/scp/macos/version.rb
4
+ gem build vagrant-scp.gemspec
5
+ gem push vagrant-scp-*.gem
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant/scp/macos/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-scp-macos"
8
+ spec.version = Vagrant::Scp::VERSION
9
+ spec.authors = ["Luca Invernizzi", "David Siher"]
10
+ spec.email = ["invernizzi.l@gmail.com", "david.siher@gmail.com"]
11
+ spec.description = 'Copy files to a Vagrant VM via SCP. (Just adding -O to vagrant-scp for macOS usage.)'
12
+ spec.summary = 'Copy files to a Vagrant VM via SCP. (Just adding -O to vagrant-scp for macOS usage.)'
13
+ spec.homepage = "https://github.com/dsiher/vagrant-scp"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", ">= 2.2.10"
20
+ spec.add_development_dependency "rake", ">= 12.3.3"
21
+ spec.add_runtime_dependency 'log4r', "~> 1.1"
22
+ spec.add_runtime_dependency 'net-scp', ">= 1.1"
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-scp-macos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Luca Invernizzi
8
+ - David Siher
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2025-06-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 2.2.10
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 2.2.10
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 12.3.3
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 12.3.3
42
+ - !ruby/object:Gem::Dependency
43
+ name: log4r
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.1'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.1'
56
+ - !ruby/object:Gem::Dependency
57
+ name: net-scp
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '1.1'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '1.1'
70
+ description: Copy files to a Vagrant VM via SCP. (Just adding -O to vagrant-scp for
71
+ macOS usage.)
72
+ email:
73
+ - invernizzi.l@gmail.com
74
+ - david.siher@gmail.com
75
+ executables: []
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - ".gitignore"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - lib/vagrant/scp/macos.rb
85
+ - lib/vagrant/scp/macos/commands/scp.rb
86
+ - lib/vagrant/scp/macos/plugin.rb
87
+ - lib/vagrant/scp/macos/version.rb
88
+ - publish_gem.sh
89
+ - vagrant-scp.gemspec
90
+ homepage: https://github.com/dsiher/vagrant-scp
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubygems_version: 3.0.3.1
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Copy files to a Vagrant VM via SCP. (Just adding -O to vagrant-scp for macOS
113
+ usage.)
114
+ test_files: []