vagrant-scp 0.1.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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +21 -0
- data/Rakefile +1 -0
- data/lib/vagrant/scp.rb +2 -0
- data/lib/vagrant/scp/commands/scp.rb +52 -0
- data/lib/vagrant/scp/plugin.rb +19 -0
- data/lib/vagrant/scp/version.rb +5 -0
- data/vagrant-scp.gemspec +23 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8a2454dcfec14402d5a48dd8c04c583f9a8699c
|
4
|
+
data.tar.gz: 6ab6275441b3e4de00f81c46800f5f78ddbdbab1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 96e9b4ce62c8b70f44a031006ea87d9c439bbd4d88efb575cc8496e6c98a7003accd47f330137dce278d1698e426d7784571885a39be9d3e9966742e0b0507c1
|
7
|
+
data.tar.gz: 479a158363ad138a05b56c26b6848874c9d4215bcf75d7d2f29233a01403e1bd69b90948942d47f15121f70f5bdafb3793249967b44987d8f5d3a55b9cca3e3c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
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,21 @@
|
|
1
|
+
# Vagrant::Scp
|
2
|
+
|
3
|
+
Copy files to a Vagrant VM 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 VM, 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 need a third parameter
|
18
|
+
|
19
|
+
vagrant scp some_local_file_or_dir somewhere_on_the_vm vm_name
|
20
|
+
|
21
|
+
That’s it!
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/vagrant/scp.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Scp
|
3
|
+
module Command
|
4
|
+
|
5
|
+
class Scp < Vagrant.plugin(2, :command)
|
6
|
+
|
7
|
+
def self.synopsis
|
8
|
+
"copies data into a box via SCP"
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
# Parse the arguments
|
13
|
+
source_files, target_dir, host = parse_args()
|
14
|
+
return if target_dir.nil?
|
15
|
+
|
16
|
+
# Get the info about the target VM
|
17
|
+
with_target_vms(host) do |machine|
|
18
|
+
ssh_info = machine.ssh_info
|
19
|
+
raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
|
20
|
+
|
21
|
+
# Run the SCP
|
22
|
+
command = [
|
23
|
+
"scp",
|
24
|
+
'-r',
|
25
|
+
'-o StrictHostKeyChecking=no',
|
26
|
+
'-o UserKnownHostsFile=/dev/null',
|
27
|
+
"-o port=#{ssh_info[:port]}",
|
28
|
+
"-i '#{ssh_info[:private_key_path][0]}'",
|
29
|
+
source_files,
|
30
|
+
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{target_dir}"
|
31
|
+
].join(' ')
|
32
|
+
system(command)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def parse_args
|
37
|
+
opts = OptionParser.new do |o|
|
38
|
+
o.banner = "Usage: vagrant scp <files> <target> [vm_name]"
|
39
|
+
o.separator ""
|
40
|
+
o.separator "Options:"
|
41
|
+
o.separator ""
|
42
|
+
end
|
43
|
+
argv = parse_options(opts)
|
44
|
+
@env.ui.info(opts.help, prefix: false) if ! [2,3].include? argv.length
|
45
|
+
return argv
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
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
|
data/vagrant-scp.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
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/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-scp"
|
8
|
+
spec.version = Vagrant::Scp::VERSION
|
9
|
+
spec.authors = ["Luca Invernizzi"]
|
10
|
+
spec.email = ["invernizzi.l@gmail.com"]
|
11
|
+
spec.description = 'Copy files to a Vagrant VM via SCP.'
|
12
|
+
spec.summary = 'Copy files to a Vagrant VM via SCP.'
|
13
|
+
spec.homepage = "https://github.com/invernizzi/vagrant-scp"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-scp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luca Invernizzi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Copy files to a Vagrant VM via SCP.
|
42
|
+
email:
|
43
|
+
- invernizzi.l@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant/scp.rb
|
54
|
+
- lib/vagrant/scp/commands/scp.rb
|
55
|
+
- lib/vagrant/scp/plugin.rb
|
56
|
+
- lib/vagrant/scp/version.rb
|
57
|
+
- vagrant-scp.gemspec
|
58
|
+
homepage: https://github.com/invernizzi/vagrant-scp
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.3
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Copy files to a Vagrant VM via SCP.
|
82
|
+
test_files: []
|
83
|
+
has_rdoc:
|