vagrant-sptsync 0.0.11 → 0.0.12
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 +8 -8
- data/lib/vagrant-sptsync/commands/root.rb +55 -24
- data/lib/vagrant-sptsync/plugin.rb +8 -0
- data/lib/vagrant-sptsync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTA4NjJkODI3NjY1NmJhYzVhOWY2NTk0MTRjYjdmZWUwMGJiZDY1MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDI3NDg4YTY3ZWY1MWEyZTJjNGQ2ZmY5ODQwM2M1NzljMjk0MDJhMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGRlMTNmNDEwM2E3MzIyMTY4OTY0ZjIwYzFkZDMzMTdjMDY1MDg3NTAyNWQ2
|
10
|
+
OWRiZjcxOTk4YTQyZTEyYjNiMjQzMWFlMWI3OTBiMzFhODA5YzAxZmE3YWRh
|
11
|
+
MThiMzZlZTQ3Zjc1MTYwOTJkNTQ0N2I4OWUzMTA1ZTE0NDE5YzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDE2NGI0NmY0Y2EzNGRmZDg2YWQxYWI1OThkYzJlYzE2MTVhMmYyMjY2ODY3
|
14
|
+
ZjZkNjJhNDY0MGViOGQ5MDRmN2E4NzY0MDc0MDgyZGJhOTYxMTdiZTBiOWM0
|
15
|
+
ZTFmNmE0MGJhNjFlNmJiZWJhZWZhNDgwOTNlNjY1ZjFhYTZhNTc=
|
@@ -1,8 +1,43 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module SPTSync
|
3
5
|
module Command
|
4
6
|
class Root < Vagrant.plugin(2, :command)
|
5
|
-
|
7
|
+
def initialize(argv, env)
|
8
|
+
@options = {
|
9
|
+
:server => "dev",
|
10
|
+
:site => "share"
|
11
|
+
}
|
12
|
+
|
13
|
+
@opts = OptionParser.new do |opts|
|
14
|
+
opts.banner = "Sync site to your local"
|
15
|
+
opts.separator ""
|
16
|
+
opts.separator "Usage: vagrant sptsync"
|
17
|
+
|
18
|
+
opts.on("-e", "--server", "Specifies the server to pulldown from. Defaults to dev") do |server|
|
19
|
+
@options[:server] = server
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on("-s", "--site", "Specifies the site to pulldown. Defaults to share") do |site|
|
23
|
+
@options[:site] = site
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
@servers = ['dev', 'qa', 'stage']
|
28
|
+
|
29
|
+
# options = {}
|
30
|
+
# OptionParser.new do |opts|
|
31
|
+
# opts.banner = "Usage: example.rb [options]"
|
32
|
+
|
33
|
+
# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
34
|
+
# options[:verbose] = v
|
35
|
+
# end
|
36
|
+
# end.parse!
|
37
|
+
|
38
|
+
# p options
|
39
|
+
# p argv
|
40
|
+
|
6
41
|
# super
|
7
42
|
|
8
43
|
# @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
@@ -28,9 +63,10 @@ module VagrantPlugins
|
|
28
63
|
# require_relative('delete')
|
29
64
|
# Delete
|
30
65
|
# end
|
31
|
-
|
66
|
+
end
|
32
67
|
|
33
68
|
def execute
|
69
|
+
validate
|
34
70
|
# if @main_args.include?("-h") || @main_args.include?("--help")
|
35
71
|
# # Print the help for all the box commands.
|
36
72
|
# return help
|
@@ -47,7 +83,7 @@ module VagrantPlugins
|
|
47
83
|
with_target_vms(nil, single_target: true) do |vm|
|
48
84
|
vm.config.exec.finalize! # TODO: do we have to call it explicitly?
|
49
85
|
|
50
|
-
command = "drush
|
86
|
+
command = "drush @#{options[:site]} status"
|
51
87
|
|
52
88
|
ssh_opts = { extra_args: ['-v'] } # make it quiet
|
53
89
|
|
@@ -59,28 +95,23 @@ module VagrantPlugins
|
|
59
95
|
end
|
60
96
|
end
|
61
97
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
# opts.separator ""
|
67
|
-
# opts.separator "Available subcommands:"
|
68
|
-
|
69
|
-
# # Add the available subcommands as separators in order to print them
|
70
|
-
# # out as well.
|
71
|
-
# keys = []
|
72
|
-
# @subcommands.each { |key, value| keys << key.to_s }
|
73
|
-
|
74
|
-
# keys.sort.each do |key|
|
75
|
-
# opts.separator " #{key}"
|
76
|
-
# end
|
77
|
-
|
78
|
-
# opts.separator ""
|
79
|
-
# opts.separator "For help on any individual command run `vagrant snapshot <command> -h`"
|
80
|
-
# end
|
98
|
+
def validate
|
99
|
+
if !@servers.include? @options[:server]
|
100
|
+
puts "#{@options[:server]} is not valid server. Pulling from dev."
|
101
|
+
end
|
81
102
|
|
82
|
-
|
83
|
-
|
103
|
+
command = "drush @#{options[:site]} status"
|
104
|
+
ssh_opts = { extra_args: ['-q'] } # make it quiet
|
105
|
+
env = vm.action(:ssh_run, ssh_run_command: command, ssh_opts: ssh_opts)
|
106
|
+
if env[:ssh_run_exit_status] != "0"
|
107
|
+
raise SiteError.new(options[:site])
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Prints the help out for this command
|
112
|
+
def help
|
113
|
+
@env.ui.info(@opts.help, :prefix => false)
|
114
|
+
end
|
84
115
|
|
85
116
|
end
|
86
117
|
end
|