vagrant-parallels 0.0.1.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +23 -0
  3. data/.ruby-gemset +1 -0
  4. data/Gemfile +13 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +59 -0
  7. data/Rakefile +23 -0
  8. data/lib/vagrant-parallels.rb +18 -0
  9. data/lib/vagrant-parallels/action.rb +282 -0
  10. data/lib/vagrant-parallels/action/boot.rb +21 -0
  11. data/lib/vagrant-parallels/action/check_accessible.rb +23 -0
  12. data/lib/vagrant-parallels/action/check_created.rb +21 -0
  13. data/lib/vagrant-parallels/action/check_guest_tools.rb +32 -0
  14. data/lib/vagrant-parallels/action/check_parallels.rb +22 -0
  15. data/lib/vagrant-parallels/action/check_running.rb +21 -0
  16. data/lib/vagrant-parallels/action/clear_network_interfaces.rb +19 -0
  17. data/lib/vagrant-parallels/action/clear_shared_folders.rb +17 -0
  18. data/lib/vagrant-parallels/action/created.rb +20 -0
  19. data/lib/vagrant-parallels/action/destroy.rb +19 -0
  20. data/lib/vagrant-parallels/action/forced_halt.rb +20 -0
  21. data/lib/vagrant-parallels/action/import.rb +63 -0
  22. data/lib/vagrant-parallels/action/is_paused.rb +21 -0
  23. data/lib/vagrant-parallels/action/is_running.rb +20 -0
  24. data/lib/vagrant-parallels/action/is_saved.rb +21 -0
  25. data/lib/vagrant-parallels/action/match_mac_address.rb +21 -0
  26. data/lib/vagrant-parallels/action/message_already_running.rb +16 -0
  27. data/lib/vagrant-parallels/action/message_not_created.rb +16 -0
  28. data/lib/vagrant-parallels/action/message_not_running.rb +16 -0
  29. data/lib/vagrant-parallels/action/message_will_not_destroy.rb +17 -0
  30. data/lib/vagrant-parallels/action/prepare_nfs_settings.rb +64 -0
  31. data/lib/vagrant-parallels/action/prune_nfs_exports.rb +20 -0
  32. data/lib/vagrant-parallels/action/register_template.rb +22 -0
  33. data/lib/vagrant-parallels/action/resume.rb +25 -0
  34. data/lib/vagrant-parallels/action/share_folders.rb +121 -0
  35. data/lib/vagrant-parallels/action/suspend.rb +20 -0
  36. data/lib/vagrant-parallels/action/unregister_template.rb +24 -0
  37. data/lib/vagrant-parallels/driver/prl_ctl.rb +281 -0
  38. data/lib/vagrant-parallels/errors.rb +23 -0
  39. data/lib/vagrant-parallels/plugin.rb +79 -0
  40. data/lib/vagrant-parallels/provider.rb +68 -0
  41. data/lib/vagrant-parallels/version.rb +5 -0
  42. data/locales/en.yml +1137 -0
  43. data/spec/vagrant-parallels/setup_spec.rb +7 -0
  44. data/vagrant-parallels.gemspec +59 -0
  45. metadata +158 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWIyZThhOTczYmI0NDM2ZTI1YmZhMjM2NDc1Yzk1MDM5YWRmMmNhMg==
5
+ data.tar.gz: !binary |-
6
+ NGFiMTNiMWRjZTMzZTBhOTEwMzZkZWQ1OWNlNTMyNDQ4MTk2NTZmMQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTY5NWM4MjE3NGE2YTBhYzBiNjZlM2RiYjg3Nzk2YWY1YTdiOWJhNjBmZmFm
10
+ YzY0M2ZlNjQ2NDdiMWJmYjIzNGE5ODljZDQ2OGNhYzdhZDQzOTE4N2I2YjU5
11
+ YTQwM2MxYmU2YzNlNjkyMzU0MzhjMWU5NDc1YTFlYjA2OWQ2YTg=
12
+ data.tar.gz: !binary |-
13
+ MDg5MGVmMDVmZjFiNTk3NzA1NDA2OTA1MTcyOWJiNjgzMWE4YWQ2NzYxOWFl
14
+ NDdkOTc4Njc4ZjllZGYyYjJhNWE0NDIxYzExNTEwMTNjZmRmYjg5MGNiYzdj
15
+ NDc2NmFlNzUyZDM1MmY3ODRkNTY1ZmUzNzQ5NjJmOTg1MDE3MmI=
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ # OS-specific
2
+ .DS_Store
3
+
4
+ #rbenv
5
+ .ruby-version
6
+
7
+ # Bundler/Rubygems
8
+ *.gem
9
+ .bundle
10
+ pkg/*
11
+ tags
12
+ Gemfile.lock
13
+ test/tmp/
14
+
15
+ # Vagrant
16
+
17
+ # Vagrant stuff
18
+ acceptance_config.yml
19
+ boxes/*
20
+ Vagrantfile
21
+ .vagrant
22
+ *.box
23
+ *.pyc
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ vagrant-parallels
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-parallels.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ # We depend on Vagrant for development, but we don't add it as a
8
+ # gem dependency because we expect to be installed within the
9
+ # Vagrant environment itself using `vagrant plugin`.
10
+ gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git'
11
+ gem 'debugger'
12
+ gem 'pry'
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Youssef Shahin
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,59 @@
1
+ # Vagrant Parallels Provider
2
+
3
+ This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [Parallels](http://www.parallels.com/products/desktop/)
4
+ provider to Vagrant, allowing Vagrant to control and provision machines using Parallels insead of the default Virtualbox.
5
+
6
+ **NOTE:** This plugin requires Vagrant 1.2+,
7
+
8
+ ## Usage
9
+
10
+ Install using standard Vagrant 1.1+ plugin installation methods. After
11
+ installing, `vagrant up` and specify the `parallels` provider. An example is
12
+ shown below.
13
+
14
+ ```
15
+ $ vagrant plugin install vagrant-parallels
16
+ ...
17
+ $ vagrant up --provider=parallels
18
+ ...
19
+ ```
20
+
21
+ Of course prior to doing this, you'll need to obtain an Parallels-compatible
22
+ box file for Vagrant.
23
+
24
+ ## Box Format
25
+
26
+ Every provider in Vagrant must introduce a custom box format. This
27
+ provider introduces `parallels` boxes. You can download one using this [link](https://s3-eu-west-1.amazonaws.com/vagrant-parallels/devbox.box).
28
+ That directory also contains instructions on how to build a box.
29
+
30
+ The box format is basically just the required `metadata.json` file
31
+ along with a `Vagrantfile` that does default settings for the
32
+ provider-specific configuration for this provider.
33
+
34
+ ## Development
35
+
36
+ To work on the `vagrant-parallels` plugin, clone this repository out, and use
37
+ [Bundler](http://gembundler.com) to get the dependencies:
38
+
39
+ ```
40
+ $ bundle
41
+ ```
42
+
43
+ Once you have the dependencies, verify the unit tests pass with `rake`:
44
+
45
+ ```
46
+ $ bundle exec rake
47
+ ```
48
+
49
+ If those pass, you're ready to start developing the plugin. You can test
50
+ the plugin without installing it into your Vagrant environment by just
51
+ creating a `Vagrantfile` in the top level of this directory (it is gitignored)
52
+ and add the following line to your `Vagrantfile`
53
+ ```ruby
54
+ Vagrant.require_plugin "vagrant-parallels"
55
+ ```
56
+ Use bundler to execute Vagrant:
57
+ ```
58
+ $ bundle exec vagrant up --provider=parallels
59
+ ```
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'rspec/core/rake_task'
6
+
7
+ # Immediately sync all stdout so that tools like buildbot can
8
+ # immediately load in the output.
9
+ $stdout.sync = true
10
+ $stderr.sync = true
11
+
12
+ # Change to the directory of this file.
13
+ Dir.chdir(File.expand_path("../", __FILE__))
14
+
15
+ # This installs the tasks that help with gem creation and
16
+ # publishing.
17
+ Bundler::GemHelper.install_tasks
18
+
19
+ # Install the `spec` task so that we can run tests.
20
+ RSpec::Core::RakeTask.new
21
+
22
+ # Default task is to run the unit tests
23
+ task :default => "spec"
@@ -0,0 +1,18 @@
1
+ require "pathname"
2
+
3
+ require "vagrant-parallels/plugin"
4
+
5
+ module VagrantPlugins
6
+ module Parallels
7
+ lib_path = Pathname.new(File.expand_path("../vagrant-parallels", __FILE__))
8
+ autoload :Action, lib_path.join("action")
9
+ autoload :Errors, lib_path.join("errors")
10
+
11
+ # This returns the path to the source of this plugin.
12
+ #
13
+ # @return [Pathname]
14
+ def self.source_root
15
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,282 @@
1
+ require "vagrant/action/builder"
2
+
3
+ module VagrantPlugins
4
+ module Parallels
5
+ module Action
6
+ # Include the built-in modules so that we can use them as top-level
7
+ # things.
8
+ include Vagrant::Action::Builtin
9
+
10
+ # This action boots the VM, assuming the VM is in a state that requires
11
+ # a bootup (i.e. not saved).
12
+ def self.action_boot
13
+ Vagrant::Action::Builder.new.tap do |b|
14
+ b.use CheckAccessible
15
+ # b.use CleanMachineFolder
16
+ # b.use ClearForwardedPorts
17
+ b.use Provision
18
+ b.use EnvSet, :port_collision_repair => true
19
+ # b.use PrepareForwardedPortCollisionParams
20
+ # b.use HandleForwardedPortCollisions
21
+ b.use PruneNFSExports
22
+ b.use NFS
23
+ #b.use PrepareNFSSettings
24
+ b.use ClearSharedFolders
25
+ b.use ShareFolders
26
+ b.use ClearNetworkInterfaces
27
+ # b.use Network
28
+ # b.use ForwardPorts
29
+ b.use SetHostname
30
+ # b.use SaneDefaults
31
+ b.use Boot
32
+ b.use WaitForCommunicator
33
+ b.use CheckGuestTools
34
+ end
35
+ end
36
+
37
+ # This is the action that is primarily responsible for completely
38
+ # freeing the resources of the underlying virtual machine.
39
+ def self.action_destroy
40
+ Vagrant::Action::Builder.new.tap do |b|
41
+ b.use CheckParallels
42
+ b.use Call, Created do |env1, b2|
43
+ if !env1[:result]
44
+ b2.use MessageNotCreated
45
+ next
46
+ end
47
+
48
+ b2.use Call, DestroyConfirm do |env2, b3|
49
+ if env2[:result]
50
+ b3.use ConfigValidate
51
+ b3.use CheckAccessible
52
+ b3.use EnvSet, :force_halt => true
53
+ b3.use action_halt
54
+ b3.use UnregisterTemplate
55
+ b3.use Destroy
56
+ else
57
+ b3.use MessageWillNotDestroy
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ # This is the action that is primarily responsible for halting
65
+ # the virtual machine, gracefully or by force.
66
+ def self.action_halt
67
+ Vagrant::Action::Builder.new.tap do |b|
68
+ b.use CheckParallels
69
+ b.use Call, Created do |env, b2|
70
+ if env[:result]
71
+ b2.use CheckAccessible
72
+
73
+ b2.use Call, IsPaused do |env2, b3|
74
+ next if !env2[:result]
75
+ b3.use Resume
76
+ end
77
+
78
+ b2.use Call, GracefulHalt, :stopped, :running do |env2, b3|
79
+ next if !env2[:result]
80
+ b3.use ForcedHalt
81
+ end
82
+ else
83
+ b2.use MessageNotCreated
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ # This action packages the virtual machine into a single box file.
90
+ def self.action_package
91
+ Vagrant::Action::Builder.new.tap do |b|
92
+ end
93
+ end
94
+
95
+ # This action just runs the provisioners on the machine.
96
+ def self.action_provision
97
+ Vagrant::Action::Builder.new.tap do |b|
98
+ b.use CheckParallels
99
+ b.use ConfigValidate
100
+ b.use Call, Created do |env1, b2|
101
+ if !env1[:result]
102
+ b2.use MessageNotCreated
103
+ next
104
+ end
105
+
106
+ b2.use Call, IsRunning do |env2, b3|
107
+ if !env2[:result]
108
+ b3.use MessageNotRunning
109
+ next
110
+ end
111
+
112
+ b3.use CheckAccessible
113
+ b3.use Provision
114
+ end
115
+ end
116
+ end
117
+ end
118
+
119
+ # This action is responsible for reloading the machine, which
120
+ # brings it down, sucks in new configuration, and brings the
121
+ # machine back up with the new configuration.
122
+ def self.action_reload
123
+ Vagrant::Action::Builder.new.tap do |b|
124
+ b.use CheckParallels
125
+ b.use Call, Created do |env1, b2|
126
+ if !env1[:result]
127
+ b2.use MessageNotCreated
128
+ next
129
+ end
130
+
131
+ b2.use ConfigValidate
132
+ b2.use action_halt
133
+ b2.use action_start
134
+ end
135
+ end
136
+ end
137
+
138
+ # This is the action that is primarily responsible for resuming
139
+ # suspended machines.
140
+ def self.action_resume
141
+ Vagrant::Action::Builder.new.tap do |b|
142
+ Vagrant::Action::Builder.new.tap do |b|
143
+ b.use CheckParallels
144
+ b.use Call, Created do |env, b2|
145
+ if env[:result]
146
+ b2.use CheckAccessible
147
+ b2.use EnvSet, :port_collision_repair => false
148
+ b2.use Resume
149
+ else
150
+ b2.use MessageNotCreated
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
156
+
157
+ # This is the action that will exec into an SSH shell.
158
+ def self.action_ssh
159
+ Vagrant::Action::Builder.new.tap do |b|
160
+ b.use CheckParallels
161
+ b.use CheckCreated
162
+ b.use CheckAccessible
163
+ b.use CheckRunning
164
+ b.use SSHExec
165
+ end
166
+ end
167
+
168
+ # This is the action that will run a single SSH command.
169
+ def self.action_ssh_run
170
+ Vagrant::Action::Builder.new.tap do |b|
171
+ b.use CheckParallels
172
+ b.use CheckCreated
173
+ b.use CheckAccessible
174
+ b.use CheckRunning
175
+ b.use SSHRun
176
+ end
177
+ end
178
+
179
+ # This action starts a VM, assuming it is already imported and exists.
180
+ # A precondition of this action is that the VM exists.
181
+ def self.action_start
182
+ Vagrant::Action::Builder.new.tap do |b|
183
+ b.use CheckParallels
184
+ b.use ConfigValidate
185
+ b.use Call, IsRunning do |env, b2|
186
+ # If the VM is running, then our work here is done, exit
187
+ if env[:result]
188
+ b2.use MessageAlreadyRunning
189
+ next
190
+ end
191
+
192
+ b2.use Call, IsSaved do |env2, b3|
193
+ if env2[:result]
194
+ # The VM is saved, so just resume it
195
+ b3.use action_resume
196
+ next
197
+ end
198
+
199
+ b3.use Call, IsPaused do |env3, b4|
200
+ if env3[:result]
201
+ b4.use Resume
202
+ next
203
+ end
204
+
205
+ # The VM is not saved, so we must have to boot it up
206
+ # like normal. Boot!
207
+ b4.use action_boot
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
213
+
214
+ # This is the action that is primarily responsible for suspending
215
+ # the virtual machine.
216
+ def self.action_suspend
217
+ Vagrant::Action::Builder.new.tap do |b|
218
+ b.use CheckParallels
219
+ b.use Call, Created do |env, b2|
220
+ if env[:result]
221
+ b2.use CheckAccessible
222
+ b2.use Suspend
223
+ else
224
+ b2.use MessageNotCreated
225
+ end
226
+ end
227
+
228
+ end
229
+ end
230
+
231
+ # This action brings the machine up from nothing, including importing
232
+ # the box, configuring metadata, and booting.
233
+ def self.action_up
234
+ Vagrant::Action::Builder.new.tap do |b|
235
+ b.use CheckParallels
236
+ b.use ConfigValidate
237
+ b.use Call, Created do |env, b2|
238
+ # If the VM is NOT created yet, then do the setup steps
239
+ if !env[:result]
240
+ b2.use CheckAccessible
241
+ b2.use HandleBoxUrl
242
+ b2.use RegisterTemplate
243
+ b2.use Import
244
+ b2.use UnregisterTemplate
245
+ b2.use MatchMACAddress
246
+ end
247
+ end
248
+ b.use action_start
249
+ end
250
+ end
251
+
252
+ autoload :Boot, File.expand_path("../action/boot", __FILE__)
253
+ autoload :CheckAccessible, File.expand_path("../action/check_accessible", __FILE__)
254
+ autoload :CheckCreated, File.expand_path("../action/check_created", __FILE__)
255
+ autoload :CheckGuestTools, File.expand_path("../action/check_guest_tools", __FILE__)
256
+ autoload :CheckParallels, File.expand_path("../action/check_parallels", __FILE__)
257
+ autoload :CheckRunning, File.expand_path("../action/check_running", __FILE__)
258
+ autoload :ClearNetworkInterfaces, File.expand_path("../action/clear_network_interfaces", __FILE__)
259
+ autoload :ClearSharedFolders, File.expand_path("../action/clear_shared_folders", __FILE__)
260
+ autoload :Created, File.expand_path("../action/created", __FILE__)
261
+ autoload :Destroy, File.expand_path("../action/destroy", __FILE__)
262
+ autoload :ForcedHalt, File.expand_path("../action/forced_halt", __FILE__)
263
+ autoload :Import, File.expand_path("../action/import", __FILE__)
264
+ autoload :IsPaused, File.expand_path("../action/is_paused", __FILE__)
265
+ autoload :IsRunning, File.expand_path("../action/is_running", __FILE__)
266
+ autoload :IsSaved, File.expand_path("../action/is_saved", __FILE__)
267
+ autoload :MatchMACAddress, File.expand_path("../action/match_mac_address", __FILE__)
268
+ autoload :MessageAlreadyRunning, File.expand_path("../action/message_already_running", __FILE__)
269
+ autoload :MessageNotCreated, File.expand_path("../action/message_not_created", __FILE__)
270
+ autoload :MessageNotRunning, File.expand_path("../action/message_not_running", __FILE__)
271
+ autoload :MessageWillNotDestroy, File.expand_path("../action/message_will_not_destroy", __FILE__)
272
+ #autoload :PrepareNFSSettings, File.expand_path("../action/prepare_nfs_settings", __FILE__)
273
+ autoload :PruneNFSExports, File.expand_path("../action/prune_nfs_exports", __FILE__)
274
+ autoload :RegisterTemplate, File.expand_path("../action/register_template", __FILE__)
275
+ autoload :Resume, File.expand_path("../action/resume", __FILE__)
276
+ autoload :ShareFolders, File.expand_path("../action/share_folders", __FILE__)
277
+ autoload :Suspend, File.expand_path("../action/suspend", __FILE__)
278
+ autoload :UnregisterTemplate, File.expand_path("../action/unregister_template", __FILE__)
279
+
280
+ end
281
+ end
282
+ end