vagrant-sptsync 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +6 -5
- data/Gemfile +3 -1
- data/README.md +45 -17
- data/Rakefile +2 -1
- data/Vagrantfile +28 -0
- data/lib/vagrant-sptsync/commands/back.rb +39 -0
- data/lib/vagrant-sptsync/commands/delete.rb +36 -0
- data/lib/vagrant-sptsync/commands/go.rb +82 -0
- data/lib/vagrant-sptsync/commands/list.rb +28 -0
- data/lib/vagrant-sptsync/commands/multi_vm_args.rb +20 -0
- data/lib/vagrant-sptsync/commands/root.rb +77 -0
- data/lib/vagrant-sptsync/commands/take.rb +34 -0
- data/lib/vagrant-sptsync/plugin.rb +20 -0
- data/lib/vagrant-sptsync/version.rb +4 -2
- data/lib/vagrant-sptsync.rb +2 -0
- data/vagrant-sptsync.gemspec +11 -41
- metadata +19 -15
- data/LICENSE.txt +0 -22
- data/lib/.DS_Store +0 -0
- data/lib/command.rb +0 -30
- data/lib/plugin.rb +0 -22
- data/lib/vagrant-sptsync/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTY2OWE3Nzg5MTllNGQ3OWRiM2E1OGJmMWM1Y2FiMGJmMDBkMzFiNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTJkM2NlMjVkZTNiYTYzM2U2YjhjZGZjZDQ4NDE0Mjg1MzZmMmY5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2FmMzExYmFjYjRiMmNmMzYyZWRkZDhhZWYxYWZjNTA5NGMxNTQxZTFjYzY4
|
10
|
+
Yzk4NzQ0NjhjZWNhZjZlOTI4NDZkZDExNWJmN2RmN2U0MjFlOGYxZTMyYmVh
|
11
|
+
ZmQ5YmNmNjVkY2FhMDM4MjNlNzk3YzZhZjVjMTQ3YzY5N2ZiMmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDM0MDI5MTZiYmY2Y2YyZjYyZjFkY2QwZGRkN2JkNGJmMWRhM2FmN2E0ZDA5
|
14
|
+
MjliN2Y1MDYxMTAxYTY5YjNkODM3NWIwNzQyOGRkYTAwOTYyZTg5NTA0ZjZl
|
15
|
+
MzhhZmIwZTdlOWQ0NGNiM2Y1YzdlZjAyYmFhMGIyZTEwYTgzMDc=
|
data/.gitignore
CHANGED
@@ -2,12 +2,8 @@
|
|
2
2
|
*.rbc
|
3
3
|
.bundle
|
4
4
|
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
5
|
coverage
|
10
|
-
|
6
|
+
InstalledFiles
|
11
7
|
lib/bundler/man
|
12
8
|
pkg
|
13
9
|
rdoc
|
@@ -15,3 +11,8 @@ spec/reports
|
|
15
11
|
test/tmp
|
16
12
|
test/version_tmp
|
17
13
|
tmp
|
14
|
+
|
15
|
+
# YARD artifacts
|
16
|
+
.yardoc
|
17
|
+
_yardoc
|
18
|
+
doc/
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,57 @@
|
|
1
|
-
|
1
|
+
vagrant-vbox-snapshot
|
2
|
+
==================================
|
3
|
+
Vagrant plugin that exposes the `VBoxManage snapshot` command.
|
2
4
|
|
3
|
-
|
5
|
+
## Install
|
4
6
|
|
5
|
-
|
7
|
+
Ensure you have Vagrant 1.1+ installed, then run:
|
6
8
|
|
7
|
-
|
9
|
+
vagrant plugin install vagrant-vbox-snapshot
|
8
10
|
|
9
|
-
|
11
|
+
## Usage
|
10
12
|
|
11
|
-
|
13
|
+
The following commands are added by this plugin:
|
12
14
|
|
13
|
-
|
15
|
+
vagrant snapshot take [vm-name] [NAME] # take snapshot, labeled by NAME
|
16
|
+
vagrant snapshot list [vm-name] # list snapshots
|
17
|
+
vagrant snapshot back [vm-name] # restore last taken snapshot
|
18
|
+
vagrant snapshot delete [vm-name] [NAME] # delete specified snapshot
|
19
|
+
vagrant snapshot go [vm-name] [NAME] # restore specified snapshot
|
14
20
|
|
15
|
-
|
21
|
+
## Caveats
|
16
22
|
|
17
|
-
|
23
|
+
* Not compatible with Vagrant <1.1. If you need this, try [another solution](#other-solutions).
|
18
24
|
|
19
|
-
##
|
25
|
+
## Other solutions
|
26
|
+
|
27
|
+
This plugin is primarily a port of vagrant-snap to Vagrant 1.1.
|
28
|
+
|
29
|
+
* [vagrant-snap](https://github.com/t9md/vagrant-snap)
|
30
|
+
- fork with Vagrant 1.0.4-1.0.7 compatibility: https://gist.github.com/tombh/5142237 [source](https://github.com/mitchellh/vagrant/issues/143#issuecomment-14781762)
|
31
|
+
* [sahara](https://github.com/jedi4ever/sahara)
|
32
|
+
- supports 1.1
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
To develop on this plugin, do the following:
|
37
|
+
|
38
|
+
```
|
39
|
+
# get the repo, and then make a feature branch (REPLACE WITH YOUR FORK)
|
40
|
+
git clone https://github.com/dergachev/vagrant-vbox-snapshot.git
|
41
|
+
cd vagrant-vbox-snapshot
|
42
|
+
git checkout -b MY-NEW-FEATURE
|
43
|
+
|
44
|
+
# installs the vagrant gem, which is a dev dependency
|
45
|
+
bundle install
|
46
|
+
|
47
|
+
# hack on the plugin
|
48
|
+
vim lib/vagrant-vbox-snapshot.rb # or any other file
|
20
49
|
|
21
|
-
|
50
|
+
# test out your changes, in the context provided by the development vagrant gem, and the local Vagrantfile.
|
51
|
+
bundle exec vagrant snapshot ...
|
22
52
|
|
23
|
-
|
53
|
+
# commit, push, and do a pull-request
|
54
|
+
```
|
24
55
|
|
25
|
-
|
26
|
-
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
56
|
+
See [DEVNOTES.md](https://github.com/dergachev/vagrant-vbox-snapshot/blob/master/DEVNOTES.md)
|
57
|
+
for the notes I compiled while developing this plugin.
|
data/Rakefile
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
data/Vagrantfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
# vi: set ft=ruby :
|
4
|
+
|
5
|
+
require_relative 'lib/vagrant-vbox-snapshot.rb'
|
6
|
+
|
7
|
+
Vagrant.configure("2") do |config|
|
8
|
+
|
9
|
+
TEST_MULTI_VM = false
|
10
|
+
TEST_SHARED_FOLDERS = false
|
11
|
+
|
12
|
+
if TEST_MULTI_VM
|
13
|
+
config.vm.define :web do |web|
|
14
|
+
web.vm.box = "precise64"
|
15
|
+
end
|
16
|
+
config.vm.define :db do |web|
|
17
|
+
web.vm.box = "precise64"
|
18
|
+
end
|
19
|
+
else
|
20
|
+
config.vm.box = "precise64"
|
21
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
22
|
+
end
|
23
|
+
|
24
|
+
if TEST_SHARED_FOLDERS
|
25
|
+
config.vm.synced_folder "/tmp", "/tmp/host-tmp"
|
26
|
+
config.vm.synced_folder "/tmp", "/tmp/host-tmp2"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module VBoxSnapshot
|
3
|
+
module Command
|
4
|
+
class Back < Vagrant.plugin(2, :command)
|
5
|
+
def execute
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
opts = OptionParser.new do |opts|
|
9
|
+
opts.banner = "Back to current snapshot"
|
10
|
+
opts.separator ""
|
11
|
+
opts.separator "Usage: vagrant snapshot back [vm-name]"
|
12
|
+
end
|
13
|
+
# Parse the options
|
14
|
+
argv = parse_options(opts)
|
15
|
+
return if !argv
|
16
|
+
|
17
|
+
with_target_vms(argv, single_target: true) do |machine|
|
18
|
+
|
19
|
+
if machine.state.id != :poweroff
|
20
|
+
machine.provider.driver.execute("controlvm", machine.id, "poweroff")
|
21
|
+
end
|
22
|
+
|
23
|
+
machine.provider.driver.execute("snapshot", machine.id, "restorecurrent") do |type, data|
|
24
|
+
machine.env.ui.info(data, :color => type == :stderr ? :red : :white, :new_line => false)
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:reload]
|
28
|
+
@env.ui.info("Reloading VM, since --reload passed")
|
29
|
+
machine.action(:reload, :provision_enabled => false)
|
30
|
+
else
|
31
|
+
@env.ui.info("Starting restored VM")
|
32
|
+
machine.action(:up, :provision_enabled => false)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# this command is very slow
|
2
|
+
# consider removing it; or replacing with this idea: http://superuser.com/questions/590968/quickest-way-to-merge-snapshots-in-virtualbox
|
3
|
+
|
4
|
+
require_relative 'multi_vm_args'
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module VBoxSnapshot
|
8
|
+
module Command
|
9
|
+
class Delete < Vagrant.plugin(2, :command)
|
10
|
+
include MultiVmArgs
|
11
|
+
|
12
|
+
def execute
|
13
|
+
options = {}
|
14
|
+
|
15
|
+
opts = OptionParser.new do |opts|
|
16
|
+
opts.banner = "Delete snapshot (warning: this is a very slow operation)"
|
17
|
+
opts.separator ""
|
18
|
+
opts.separator "Usage: vagrant snapshot delete [vm-name] <SNAPSHOT_NAME>"
|
19
|
+
end
|
20
|
+
# Parse the options
|
21
|
+
argv = parse_options(opts)
|
22
|
+
return if !argv
|
23
|
+
|
24
|
+
vm_name, snapshot_name = parse_vm_and_snapshot_options(argv, opts)
|
25
|
+
return if !snapshot_name
|
26
|
+
|
27
|
+
with_target_vms(vm_name, single_target: true) do |machine|
|
28
|
+
machine.provider.driver.execute("snapshot", machine.id, "delete", snapshot_name) do |type, data|
|
29
|
+
machine.env.ui.info(data, :color => type == :stderr ? :red : :white)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_relative 'multi_vm_args'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module VBoxSnapshot
|
5
|
+
module Command
|
6
|
+
class Go < Vagrant.plugin(2, :command)
|
7
|
+
include MultiVmArgs
|
8
|
+
|
9
|
+
def get_shared_folders(machine)
|
10
|
+
shared_folders = []
|
11
|
+
info = machine.provider.driver.execute("showvminfo", machine.id, "--machinereadable")
|
12
|
+
info.split("\n").each do |line|
|
13
|
+
if line =~ /^SharedFolderNameMachineMapping\d+="(.+?)"$/
|
14
|
+
shared_folders << $1.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
return shared_folders
|
18
|
+
end
|
19
|
+
|
20
|
+
def before_restore(machine)
|
21
|
+
@shared_folders_before = get_shared_folders(machine)
|
22
|
+
end
|
23
|
+
|
24
|
+
def after_restore(machine)
|
25
|
+
@shared_folders_after = get_shared_folders(machine)
|
26
|
+
if @shared_folders_before != @shared_folders_after
|
27
|
+
@env.ui.warn("Synced folders have changed after restoring snapshot. Consider running 'vagrant reload'.")
|
28
|
+
@env.ui.warn(" Before restore: #{@shared_folders_before}")
|
29
|
+
@env.ui.warn(" After restore: #{@shared_folders_after}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def execute
|
34
|
+
options = {}
|
35
|
+
options[:reload] = false
|
36
|
+
|
37
|
+
opts = OptionParser.new do |opts|
|
38
|
+
opts.banner = "Go to specified snapshot"
|
39
|
+
opts.separator ""
|
40
|
+
opts.separator "Usage: vagrant snapshot go [vm-name] <SNAPSHOT_NAME>"
|
41
|
+
|
42
|
+
opts.on("-r", "--reload", "Runs 'vagrant reload --no-provision' after restoring snapshot to ensure Vagrantfile config is applied.") do |reload|
|
43
|
+
options[:reload] = reload
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
# Parse the options
|
48
|
+
argv = parse_options(opts)
|
49
|
+
return if !argv
|
50
|
+
|
51
|
+
vm_name, snapshot_name = parse_vm_and_snapshot_options(argv, opts)
|
52
|
+
return if !snapshot_name
|
53
|
+
|
54
|
+
with_target_vms(vm_name, single_target: true) do |machine|
|
55
|
+
vm_id = machine.id
|
56
|
+
|
57
|
+
before_restore(machine)
|
58
|
+
|
59
|
+
if machine.state.id != :poweroff
|
60
|
+
@env.ui.info("Powering off machine #{vm_id}")
|
61
|
+
machine.provider.driver.execute("controlvm", machine.id, "poweroff")
|
62
|
+
end
|
63
|
+
|
64
|
+
machine.provider.driver.execute("snapshot", machine.id, "restore", snapshot_name) do |type, data|
|
65
|
+
machine.env.ui.info(data, :color => type == :stderr ? :red : :white, :new_line => false)
|
66
|
+
end
|
67
|
+
|
68
|
+
if options[:reload]
|
69
|
+
@env.ui.info("Reloading VM, since --reload passed")
|
70
|
+
machine.action(:reload, :provision_enabled => false)
|
71
|
+
else
|
72
|
+
@env.ui.info("Starting restored VM")
|
73
|
+
machine.action(:up, :provision_enabled => false)
|
74
|
+
end
|
75
|
+
|
76
|
+
after_restore(machine)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module VBoxSnapshot
|
3
|
+
module Command
|
4
|
+
class List < Vagrant.plugin(2, :command)
|
5
|
+
def execute
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
opts = OptionParser.new do |opts|
|
9
|
+
opts.banner = "List snapshots"
|
10
|
+
opts.separator ""
|
11
|
+
opts.separator "Usage: vagrant snapshot list"
|
12
|
+
end
|
13
|
+
# Parse the options
|
14
|
+
argv = parse_options(opts)
|
15
|
+
return if !argv
|
16
|
+
|
17
|
+
with_target_vms(argv, single_target: true) do |machine|
|
18
|
+
puts "Listing snapshots for '#{machine.name}':"
|
19
|
+
|
20
|
+
res = machine.provider.driver.execute("snapshot", machine.id, "list", "--details") do |type, data|
|
21
|
+
machine.env.ui.info(data, :color => :green) if (type == :stdout)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module VBoxSnapshot
|
3
|
+
module Command
|
4
|
+
module MultiVmArgs
|
5
|
+
def parse_vm_and_snapshot_options(argv, opts)
|
6
|
+
unless [1, 2].include?(argv.size)
|
7
|
+
@env.ui.info(opts.help, :prefix => false)
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
11
|
+
if argv.size == 1
|
12
|
+
[nil, argv[0]]
|
13
|
+
else
|
14
|
+
[argv[0], argv[1]]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module VBoxSnapshot
|
3
|
+
module Command
|
4
|
+
class Root < Vagrant.plugin(2, :command)
|
5
|
+
# def initialize(argv, env)
|
6
|
+
# super
|
7
|
+
|
8
|
+
# @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
9
|
+
|
10
|
+
# @subcommands = Vagrant::Registry.new
|
11
|
+
# @subcommands.register(:take) do
|
12
|
+
# require_relative('take')
|
13
|
+
# Take
|
14
|
+
# end
|
15
|
+
# @subcommands.register(:list) do
|
16
|
+
# require_relative('list')
|
17
|
+
# List
|
18
|
+
# end
|
19
|
+
# @subcommands.register(:go) do
|
20
|
+
# require_relative('go')
|
21
|
+
# Go
|
22
|
+
# end
|
23
|
+
# @subcommands.register(:back) do
|
24
|
+
# require_relative('back')
|
25
|
+
# Back
|
26
|
+
# end
|
27
|
+
# @subcommands.register(:delete) do
|
28
|
+
# require_relative('delete')
|
29
|
+
# Delete
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
|
33
|
+
def execute
|
34
|
+
# if @main_args.include?("-h") || @main_args.include?("--help")
|
35
|
+
# # Print the help for all the box commands.
|
36
|
+
# return help
|
37
|
+
# end
|
38
|
+
|
39
|
+
# # If we reached this far then we must have a subcommand. If not,
|
40
|
+
# # then we also just print the help and exit.
|
41
|
+
# command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
|
42
|
+
# return help if !command_class || !@sub_command
|
43
|
+
# @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
|
44
|
+
|
45
|
+
# # Initialize and execute the command class
|
46
|
+
# command_class.new(@sub_args, @env).execute
|
47
|
+
puts "hello"
|
48
|
+
0
|
49
|
+
end
|
50
|
+
|
51
|
+
# Prints the help out for this command
|
52
|
+
# def help
|
53
|
+
# opts = OptionParser.new do |opts|
|
54
|
+
# opts.banner = "Usage: vagrant snapshot <command> [<args>]"
|
55
|
+
# opts.separator ""
|
56
|
+
# opts.separator "Available subcommands:"
|
57
|
+
|
58
|
+
# # Add the available subcommands as separators in order to print them
|
59
|
+
# # out as well.
|
60
|
+
# keys = []
|
61
|
+
# @subcommands.each { |key, value| keys << key.to_s }
|
62
|
+
|
63
|
+
# keys.sort.each do |key|
|
64
|
+
# opts.separator " #{key}"
|
65
|
+
# end
|
66
|
+
|
67
|
+
# opts.separator ""
|
68
|
+
# opts.separator "For help on any individual command run `vagrant snapshot <command> -h`"
|
69
|
+
# end
|
70
|
+
|
71
|
+
# @env.ui.info(opts.help, :prefix => false)
|
72
|
+
# end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'multi_vm_args'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module VBoxSnapshot
|
5
|
+
module Command
|
6
|
+
class Take < Vagrant.plugin(2, :command)
|
7
|
+
include MultiVmArgs
|
8
|
+
|
9
|
+
def execute
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
opts = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Take snapshot"
|
14
|
+
opts.separator ""
|
15
|
+
opts.separator "Usage: vagrant snapshot take [vm-name] <SNAPSHOT_NAME>"
|
16
|
+
end
|
17
|
+
# Parse the options
|
18
|
+
argv = parse_options(opts)
|
19
|
+
return if !argv
|
20
|
+
|
21
|
+
vm_name, snapshot_name = parse_vm_and_snapshot_options(argv, opts)
|
22
|
+
return if !snapshot_name
|
23
|
+
|
24
|
+
with_target_vms(vm_name, single_target: true) do |machine|
|
25
|
+
machine.env.ui.info("Taking snapshot #{snapshot_name}")
|
26
|
+
machine.provider.driver.execute("snapshot", machine.id, "take", snapshot_name, "--pause") do |type, data|
|
27
|
+
machine.env.ui.info(data, :color => type == :stderr ? :red : :white, :new_line => false)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant SPTSync plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module SPTSync
|
9
|
+
class Plugin < Vagrant.plugin("2")
|
10
|
+
name "Vagrant SPTSync"
|
11
|
+
description "Syncs sites."
|
12
|
+
|
13
|
+
command "sptsync" do
|
14
|
+
require_relative 'commands/root.rb'
|
15
|
+
Command::Root
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/vagrant-sptsync.gemspec
CHANGED
@@ -1,50 +1,20 @@
|
|
1
|
-
$:.unshift File.expand_path(
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
2
|
require 'vagrant-sptsync/version'
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "vagrant-sptsync"
|
6
|
-
spec.version =
|
7
|
-
spec.authors =
|
8
|
-
spec.email =
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
11
|
-
spec.homepage = ""
|
6
|
+
spec.version = VagrantPlugins::SPTSync::VERSION
|
7
|
+
spec.authors = "Sean Sehr"
|
8
|
+
spec.email = "sean@seansehr.com"
|
9
|
+
spec.summary = 'For syncing sites'
|
10
|
+
spec.description = 'For syncing sites'
|
12
11
|
spec.license = "MIT"
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# the "!" syntax, but it should mostly work correctly.
|
19
|
-
root_path = File.dirname(__FILE__)
|
20
|
-
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
21
|
-
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
22
|
-
gitignore_path = File.join(root_path, ".gitignore")
|
23
|
-
gitignore = File.readlines(gitignore_path)
|
24
|
-
gitignore.map! { |line| line.chomp.strip }
|
25
|
-
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_path = 'lib'
|
26
17
|
|
27
|
-
|
28
|
-
# Ignore any directories, the gemspec only cares about files
|
29
|
-
next true if File.directory?(file)
|
30
|
-
|
31
|
-
# Ignore any paths that match anything in the gitignore. We do
|
32
|
-
# two tests here:
|
33
|
-
#
|
34
|
-
# - First, test to see if the entire path matches the gitignore.
|
35
|
-
# - Second, match if the basename does, this makes it so that things
|
36
|
-
# like '.DS_Store' will match sub-directories too (same behavior
|
37
|
-
# as git).
|
38
|
-
#
|
39
|
-
gitignore.any? do |ignore|
|
40
|
-
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
41
|
-
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
spec.files = unignored_files
|
46
|
-
spec.require_paths = ["lib"]
|
47
|
-
|
48
|
-
spec.add_development_dependency "bundler", "~> 1.5"
|
18
|
+
spec.add_development_dependency "bundler"
|
49
19
|
spec.add_development_dependency "rake"
|
50
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-sptsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Sehr
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,25 +38,29 @@ dependencies:
|
|
38
38
|
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
42
|
-
email:
|
43
|
-
- sean.sehr@smashingideas.com
|
41
|
+
description: For syncing sites
|
42
|
+
email: sean@seansehr.com
|
44
43
|
executables: []
|
45
44
|
extensions: []
|
46
45
|
extra_rdoc_files: []
|
47
46
|
files:
|
48
47
|
- .gitignore
|
49
48
|
- Gemfile
|
50
|
-
- LICENSE.txt
|
51
49
|
- README.md
|
52
50
|
- Rakefile
|
53
|
-
-
|
54
|
-
- lib/
|
55
|
-
- lib/
|
56
|
-
- lib/vagrant-sptsync
|
51
|
+
- Vagrantfile
|
52
|
+
- lib/vagrant-sptsync.rb
|
53
|
+
- lib/vagrant-sptsync/commands/back.rb
|
54
|
+
- lib/vagrant-sptsync/commands/delete.rb
|
55
|
+
- lib/vagrant-sptsync/commands/go.rb
|
56
|
+
- lib/vagrant-sptsync/commands/list.rb
|
57
|
+
- lib/vagrant-sptsync/commands/multi_vm_args.rb
|
58
|
+
- lib/vagrant-sptsync/commands/root.rb
|
59
|
+
- lib/vagrant-sptsync/commands/take.rb
|
60
|
+
- lib/vagrant-sptsync/plugin.rb
|
57
61
|
- lib/vagrant-sptsync/version.rb
|
58
62
|
- vagrant-sptsync.gemspec
|
59
|
-
homepage:
|
63
|
+
homepage:
|
60
64
|
licenses:
|
61
65
|
- MIT
|
62
66
|
metadata: {}
|
@@ -79,5 +83,5 @@ rubyforge_project:
|
|
79
83
|
rubygems_version: 2.2.2
|
80
84
|
signing_key:
|
81
85
|
specification_version: 4
|
82
|
-
summary:
|
86
|
+
summary: For syncing sites
|
83
87
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Sean Sehr
|
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/lib/.DS_Store
DELETED
Binary file
|
data/lib/command.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# require 'optparse'
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module SptSync
|
5
|
-
class SptSyncCommand < Vagrant.plugin("2", :command)
|
6
|
-
def self.synopsis
|
7
|
-
"suspends the machine"
|
8
|
-
end
|
9
|
-
|
10
|
-
def execute
|
11
|
-
# opts = OptionParser.new do |o|
|
12
|
-
# o.banner = "Usage: vagrant suspend [name]"
|
13
|
-
# end
|
14
|
-
|
15
|
-
# # Parse the options
|
16
|
-
# argv = parse_options(opts)
|
17
|
-
# return if !argv
|
18
|
-
|
19
|
-
# @logger.debug("'suspend' each target VM...")
|
20
|
-
# with_target_vms(argv) do |vm|
|
21
|
-
# vm.action(:suspend)
|
22
|
-
# end
|
23
|
-
|
24
|
-
# Success, exit status 0
|
25
|
-
puts "Hello"
|
26
|
-
0
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/lib/plugin.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require "vagrant"
|
3
|
-
rescue LoadError
|
4
|
-
raise "The Vagrant SptSync plugin must be run within Vagrant."
|
5
|
-
end
|
6
|
-
|
7
|
-
module VagrantPlugins
|
8
|
-
module SptSync
|
9
|
-
class Plugin < Vagrant.plugin("2")
|
10
|
-
name "vagrant-sptsync"
|
11
|
-
description <<-DESC
|
12
|
-
The `suspend` command suspends execution and puts it to sleep.
|
13
|
-
The command `resume` returns it to running status.
|
14
|
-
DESC
|
15
|
-
|
16
|
-
command("sptsync") do
|
17
|
-
require File.expand_path("../command", __FILE__)
|
18
|
-
SptSyncCommand
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
Binary file
|