vagrant-rsync 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +15 -0
- data/Gemfile +7 -0
- data/License +8 -0
- data/README.md +29 -0
- data/RakeFile +15 -0
- data/lib/command.rb +54 -0
- data/lib/plugin.rb +27 -0
- data/lib/vagrant-rsync.rb +1 -0
- data/lib/version.rb +5 -0
- data/vagrant-rsync.gemspec +54 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWNmZjcwNTE4M2M0ZmRkZWZjN2Y1ZDYzMTUwYWQ4ZGI2OTVmNGRjMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTFiYzdkZGQ2MzM5NmQ2MmY4ZmQyNmI1MWFjYTM2MDg2YWZhMjg4MQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YmU5NDRmMWY5M2MwMDUwMzkwYzk2NjllZjQyOWQ2ODg2Yzc2Y2YxYjQwZTA4
|
10
|
+
MDY4NTIzNzMyMTllZDM4Njk0ZmZhOTIxNDhkMjE4ODIxMWMzOTIxYTRmMWJl
|
11
|
+
OTZiYzAzNGY0M2NhZTZiZjI5ZWVkYTUxMjJjNzRhNDQyYzMwNGM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmQ4OGYzYTcyNzZiOTQ4MjEwN2M1MjFhODMxNzAzZWY2ODVkNjQzNzkyMTk2
|
14
|
+
Y2MxMmRhY2YyNzM3OTVjMjAyMjliNTFjNTlkNzdkM2FhMGE5YTc3N2YyZTE4
|
15
|
+
ZTZkMWQyZTE4YTUzMTdmOGQyODJjYTJkNDI2YTZkODMxOTg2MTQ=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/License
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
Copyright (c) 2013 Mitchell Hashimoto
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Vagrant Rsync Plugin
|
2
|
+
This is a [Vagrant](http://www.vagrantup.com) 1.1+ plugin that adds an rsync command to vagrant, allowing you to use a filesystem watcher to sync your shared directories with your guest machines.
|
3
|
+
|
4
|
+
**NOTE:** This plugin requires Vagrant 1.1+, and (rsync)[http://rsync.samba.org/]
|
5
|
+
|
6
|
+
Based off of [Vagrant-Sync](https://github.com/calavera/vagrant-sync)
|
7
|
+
|
8
|
+
## Features
|
9
|
+
* automatically detects all shared folders, on all named machines
|
10
|
+
* syncs em up.
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
```bash
|
15
|
+
vagrant plugin install vagrant-rsync
|
16
|
+
....
|
17
|
+
vagrant rsync vm-name
|
18
|
+
...
|
19
|
+
```
|
20
|
+
|
21
|
+
The guest must be up and running.
|
22
|
+
|
23
|
+
Note: This plugin is meant for interacting with guests that are not running on your local machine.
|
24
|
+
I have no idea what will happen if you are sharing with NFS or virtualbox shared folders.
|
25
|
+
It might destroy all your data and turn your co-workers into angry badgers. Be forewarned.
|
26
|
+
|
27
|
+
|
28
|
+
Can be mixed in with Guard or kicker or what-have-you to rsync whenever the host filesystem changes.
|
29
|
+
|
data/RakeFile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
# Immediately sync all stdout so that tools like buildbot can
|
5
|
+
# immediately load in the output.
|
6
|
+
$stdout.sync = true
|
7
|
+
$stderr.sync = true
|
8
|
+
|
9
|
+
# Change to the directory of this file.
|
10
|
+
Dir.chdir(File.expand_path("../", __FILE__))
|
11
|
+
|
12
|
+
# This installs the tasks that help with gem creation and
|
13
|
+
# publishing.
|
14
|
+
Bundler::GemHelper.install_tasks
|
15
|
+
|
data/lib/command.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
module VagrantPlugins
|
3
|
+
module CommandRSYNC
|
4
|
+
class Command < Vagrant.plugin("2", :command)
|
5
|
+
def execute
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
opts = OptionParser.new do |opt|
|
9
|
+
opt.banner = "Usage: vagrant rsync [vm-name]"
|
10
|
+
opt.on('--verbose') do |v|
|
11
|
+
options[:verbose] = true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
argv = parse_options(opts)
|
16
|
+
unless argv
|
17
|
+
argv=["default"]
|
18
|
+
end
|
19
|
+
with_target_vms(argv) do |vm|
|
20
|
+
raise Vagrant::Errors::VMNotCreatedError if vm.state.id == :not_created
|
21
|
+
raise Vagrant::Errors::VMInaccessible if vm.state.id == :inaccessible
|
22
|
+
end
|
23
|
+
|
24
|
+
with_target_vms(argv) do |vm|
|
25
|
+
vm.config.vm.synced_folders.each do |id, data|
|
26
|
+
next if opts[:nfs]
|
27
|
+
|
28
|
+
hostpath = File.expand_path(data[:hostpath], vm.env.root_path)
|
29
|
+
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
30
|
+
guestpath = data[:guestpath]
|
31
|
+
ssh_info = vm.ssh_info
|
32
|
+
|
33
|
+
ssh_options = "-p#{ssh_info[:port]} -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oIdentitiesOnly=yes -i#{ssh_info[:private_key_path]}"
|
34
|
+
ssh_host = "#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"
|
35
|
+
|
36
|
+
rsync_options = '-aze --exclude .vagrant/'
|
37
|
+
rsync_options << 'vvv' if options[:verbose]
|
38
|
+
|
39
|
+
command = 'rsync %s --delete %s -e "ssh %s" %s' % [rsync_options, hostpath, ssh_options, ssh_host]
|
40
|
+
puts command if options[:verbose]
|
41
|
+
|
42
|
+
r = Vagrant::Util::Subprocess.execute(command)
|
43
|
+
if r.exit_code != 0
|
44
|
+
raise Errors::RsyncError,
|
45
|
+
:guestpath => guestpath,
|
46
|
+
:hostpath => hostpath,
|
47
|
+
:stderr => r.stderr
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/plugin.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant AWS plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
8
|
+
# this into an early Vagrant version.
|
9
|
+
if Vagrant::VERSION < "1.1.0"
|
10
|
+
raise "The Vagrant AWS plugin is only compatible with Vagrant 1.1+"
|
11
|
+
end
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module CommandRSYNC
|
15
|
+
class Plugin < Vagrant.plugin("2")
|
16
|
+
name "rsync command"
|
17
|
+
description <<-DESC
|
18
|
+
The `rsync` command allows you to sync the files in your working directories to the guest.
|
19
|
+
DESC
|
20
|
+
|
21
|
+
command("rsync") do
|
22
|
+
require File.expand_path("../command.rb", __FILE__)
|
23
|
+
Command
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'plugin'
|
data/lib/version.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
2
|
+
require "version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "vagrant-rsync"
|
6
|
+
s.version = VagrantPlugins::RSYNC::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = "Bill Cromie"
|
9
|
+
s.email = "bill@cromie.org"
|
10
|
+
s.homepage = "https://github.com/cromulus/vagrant-rsync"
|
11
|
+
s.summary = "Enables Vagrant to rsync shared folders on remote guests with grace and aplomb."
|
12
|
+
s.description = "Enables Vagrant to rsync shared folders on remote guests with grace and aplomb."
|
13
|
+
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "vagrant-rsync"
|
16
|
+
|
17
|
+
|
18
|
+
s.add_development_dependency "rake"
|
19
|
+
|
20
|
+
# The following block of code determines the files that should be included
|
21
|
+
# in the gem. It does this by reading all the files in the directory where
|
22
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
23
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
24
|
+
# the "!" syntax, but it should mostly work correctly.
|
25
|
+
root_path = File.dirname(__FILE__)
|
26
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
27
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
28
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
29
|
+
gitignore = File.readlines(gitignore_path)
|
30
|
+
gitignore.map! { |line| line.chomp.strip }
|
31
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
32
|
+
|
33
|
+
unignored_files = all_files.reject do |file|
|
34
|
+
# Ignore any directories, the gemspec only cares about files
|
35
|
+
next true if File.directory?(file)
|
36
|
+
|
37
|
+
# Ignore any paths that match anything in the gitignore. We do
|
38
|
+
# two tests here:
|
39
|
+
#
|
40
|
+
# - First, test to see if the entire path matches the gitignore.
|
41
|
+
# - Second, match if the basename does, this makes it so that things
|
42
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
43
|
+
# as git).
|
44
|
+
#
|
45
|
+
gitignore.any? do |ignore|
|
46
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
47
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
s.files = unignored_files
|
52
|
+
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
53
|
+
s.require_path = 'lib'
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-rsync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bill Cromie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ! '>='
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
name: rake
|
27
|
+
description: Enables Vagrant to rsync shared folders on remote guests with grace and
|
28
|
+
aplomb.
|
29
|
+
email: bill@cromie.org
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- lib/command.rb
|
36
|
+
- lib/plugin.rb
|
37
|
+
- lib/vagrant-rsync.rb
|
38
|
+
- lib/version.rb
|
39
|
+
- License
|
40
|
+
- RakeFile
|
41
|
+
- README.md
|
42
|
+
- vagrant-rsync.gemspec
|
43
|
+
- .gitignore
|
44
|
+
homepage: https://github.com/cromulus/vagrant-rsync
|
45
|
+
licenses: []
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.3.6
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project: vagrant-rsync
|
63
|
+
rubygems_version: 2.0.3
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: Enables Vagrant to rsync shared folders on remote guests with grace and aplomb.
|
67
|
+
test_files: []
|