vagrant-skytap 0.2.4 → 0.2.5

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +0 -3
  5. data/lib/vagrant-skytap/action/compose_environment.rb +0 -3
  6. data/lib/vagrant-skytap/action/prepare_forwarded_port_collision_params.rb +0 -1
  7. data/lib/vagrant-skytap/action/prepare_nfs_valid_ids.rb +3 -2
  8. data/lib/vagrant-skytap/action/wait_for_communicator.rb +0 -1
  9. data/lib/vagrant-skytap/action.rb +0 -1
  10. data/lib/vagrant-skytap/api/busyable.rb +1 -1
  11. data/lib/vagrant-skytap/api/client.rb +0 -1
  12. data/lib/vagrant-skytap/api/interface.rb +0 -1
  13. data/lib/vagrant-skytap/api/public_ip.rb +1 -2
  14. data/lib/vagrant-skytap/api/published_service.rb +2 -3
  15. data/lib/vagrant-skytap/api/vpn.rb +1 -2
  16. data/lib/vagrant-skytap/command/publish_url/root.rb +1 -1
  17. data/lib/vagrant-skytap/command/up.rb +10 -4
  18. data/lib/vagrant-skytap/core_ext/object/blank.rb +0 -22
  19. data/lib/vagrant-skytap/core_ext/try.rb +0 -22
  20. data/lib/vagrant-skytap/hosts/common/cap/ssh_tunnel.rb +0 -1
  21. data/lib/vagrant-skytap/plugin.rb +1 -1
  22. data/lib/vagrant-skytap/util/compile_forwarded_ports.rb +1 -1
  23. data/lib/vagrant-skytap/version.rb +1 -1
  24. data/lib/vagrant-skytap.rb +0 -2
  25. data/spec/unit/actions/compose_environment_spec.rb +0 -3
  26. data/spec/unit/actions/update_hardware_spec.rb +0 -1
  27. data/spec/unit/base.rb +1 -8
  28. data/spec/unit/config_spec.rb +0 -4
  29. data/spec/unit/environment_spec.rb +14 -23
  30. data/spec/unit/forwarded_port_spec.rb +0 -2
  31. data/spec/unit/prepare_collision_params_spec.rb +0 -14
  32. data/spec/unit/publish_set_spec.rb +7 -15
  33. data/spec/unit/setup_helper_spec.rb +28 -48
  34. data/spec/unit/support/api_responses/empty_environment.json +1 -1
  35. data/spec/unit/support/shared/rest_api_context.rb +3 -0
  36. data/spec/unit/support/shared/skytap_context.rb +14 -0
  37. data/spec/unit/vm_spec.rb +8 -15
  38. data/vagrant-skytap.gemspec +4 -4
  39. metadata +7 -20
  40. data/.hgignore +0 -22
  41. data/.project +0 -11
  42. data/.rspec +0 -1
  43. data/spec/acceptance/base.rb +0 -24
  44. data/spec/acceptance/provider/halt_spec.rb +0 -25
  45. data/spec/acceptance/provider/up_spec.rb +0 -62
  46. data/spec/acceptance/shared/context_skytap.rb +0 -25
  47. data/spec/support/isolated_environment.rb +0 -67
  48. data/spec/unit/support/dummy_communicator.rb +0 -105
  49. data/spec/unit/support/dummy_provider.rb +0 -63
  50. data/spec/unit/support/isolated_environment.rb +0 -239
  51. data/spec/unit/support/shared/action_synced_folders_context.rb +0 -37
  52. data/spec/unit/support/shared/base_context.rb +0 -138
  53. data/spec/unit/support/shared/capability_helpers_context.rb +0 -51
  54. data/spec/unit/support/shared/plugin_command_context.rb +0 -34
  55. data/vagrant-spec.config.rb +0 -32
@@ -1,37 +0,0 @@
1
- # Copyright (c) 2014-2016 Skytap, Inc.
2
- #
3
- # The MIT License (MIT)
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- # DEALINGS IN THE SOFTWARE.
22
-
23
- shared_context "synced folder actions" do
24
- # This creates a synced folder implementation.
25
- def impl(usable, name)
26
- Class.new(Vagrant.plugin("2", :synced_folder)) do
27
- define_method(:name) do
28
- name
29
- end
30
-
31
- define_method(:usable?) do |machine, raise_error=false|
32
- raise "#{name}: usable" if raise_error && !usable
33
- usable
34
- end
35
- end
36
- end
37
- end
@@ -1,138 +0,0 @@
1
- # Copyright (c) 2014-2016 Skytap, Inc.
2
- #
3
- # The MIT License (MIT)
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- # DEALINGS IN THE SOFTWARE.
22
-
23
- require "tempfile"
24
- require "tmpdir"
25
-
26
- require "unit/support/isolated_environment"
27
-
28
- shared_context "unit" do
29
- before(:each) do
30
- # State to store the list of registered plugins that we have to
31
- # unregister later.
32
- @_plugins = []
33
-
34
- # Create a thing to store our temporary files so that they aren't
35
- # unlinked right away.
36
- @_temp_files = []
37
- end
38
-
39
- after(:each) do
40
- # Unregister each of the plugins we have may have temporarily
41
- # registered for the duration of this test.
42
- @_plugins.each do |plugin|
43
- Vagrant.plugin("1").manager.unregister(plugin)
44
- Vagrant.plugin("2").manager.unregister(plugin)
45
- end
46
- end
47
-
48
- # This creates an isolated environment so that Vagrant doesn't
49
- # muck around with your real system during unit tests.
50
- #
51
- # The returned isolated environment has a variety of helper
52
- # methods on it to easily create files, Vagrantfiles, boxes,
53
- # etc.
54
- def isolated_environment
55
- env = Unit::IsolatedEnvironment.new
56
- yield env if block_given?
57
- env
58
- end
59
-
60
- # This registers a Vagrant plugin for the duration of a single test.
61
- # This will yield a new plugin class that you can then call the
62
- # public plugin methods on.
63
- #
64
- # @yield [plugin] Yields the plugin class for you to call the public
65
- # API that you need to.
66
- def register_plugin(version=nil)
67
- version ||= Vagrant::Config::CURRENT_VERSION
68
- plugin = Class.new(Vagrant.plugin(version))
69
- plugin.name("Test Plugin #{plugin.inspect}")
70
- yield plugin if block_given?
71
- @_plugins << plugin
72
- plugin
73
- end
74
-
75
- # This helper creates a temporary file and returns a Pathname
76
- # object pointed to it.
77
- #
78
- # @return [Pathname]
79
- def temporary_file(contents=nil)
80
- f = Tempfile.new("vagrant-unit")
81
-
82
- if contents
83
- f.write(contents)
84
- f.flush
85
- end
86
-
87
- # Store the tempfile in an instance variable so that it is not
88
- # garbage collected, so that the tempfile is not unlinked.
89
- @_temp_files << f
90
-
91
- return Pathname.new(f.path)
92
- end
93
-
94
- # This creates a temporary directory and returns a {Pathname}
95
- # pointing to it.
96
- #
97
- # @return [Pathname]
98
- def temporary_dir
99
- # Create a temporary directory and append it to the instance
100
- # variabe so that it isn't garbage collected and deleted
101
- d = Dir.mktmpdir("vagrant")
102
- @_temp_files << d
103
-
104
- # Return the pathname
105
- return Pathname.new(d)
106
- end
107
-
108
- # Stub the given environment in ENV, without actually touching ENV. Keys and
109
- # values are converted to strings because that's how the real ENV works.
110
- def stub_env(hash)
111
- allow(ENV).to receive(:[]).and_call_original
112
-
113
- hash.each do |key, value|
114
- allow(ENV).to receive(:[])
115
- .with(key.to_s)
116
- .and_return(value.to_s)
117
- end
118
- end
119
-
120
- # This helper provides temporary environmental variable changes.
121
- def with_temp_env(environment)
122
- # Build up the new environment, preserving the old values so we
123
- # can replace them back in later.
124
- old_env = {}
125
- environment.each do |key, value|
126
- old_env[key] = ENV[key]
127
- ENV[key] = value
128
- end
129
-
130
- # Call the block, returning its return value
131
- return yield
132
- ensure
133
- # Reset the environment no matter what
134
- old_env.each do |key, value|
135
- ENV[key] = value
136
- end
137
- end
138
- end
@@ -1,51 +0,0 @@
1
- # Copyright (c) 2014-2016 Skytap, Inc.
2
- #
3
- # The MIT License (MIT)
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- # DEALINGS IN THE SOFTWARE.
22
-
23
- shared_context "capability_helpers" do
24
- def detect_class(result)
25
- Class.new do
26
- define_method(:detect?) do |*args|
27
- result
28
- end
29
- end
30
- end
31
-
32
- def provider_usable_class(result)
33
- Class.new do
34
- define_singleton_method(:usable?) do |*args|
35
- result
36
- end
37
- end
38
- end
39
-
40
- def cap_instance(name, options=nil)
41
- options ||= {}
42
-
43
- Class.new do
44
- if !options[:corrupt]
45
- define_method(name) do |*args|
46
- raise "cap: #{name} #{args.inspect}"
47
- end
48
- end
49
- end.new
50
- end
51
- end
@@ -1,34 +0,0 @@
1
- # Copyright (c) 2014-2016 Skytap, Inc.
2
- #
3
- # The MIT License (MIT)
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- # DEALINGS IN THE SOFTWARE.
22
-
23
- shared_context "command plugin helpers" do
24
- def command_lambda(name, result, **opts)
25
- lambda do
26
- Class.new(Vagrant.plugin("2", "command")) do
27
- define_method(:execute) do
28
- raise opts[:exception] if opts[:exception]
29
- result
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,32 +0,0 @@
1
- # Copyright (c) 2014-2016 Skytap, Inc.
2
- #
3
- # The MIT License (MIT)
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
- # DEALINGS IN THE SOFTWARE.
22
-
23
- require_relative "spec/acceptance/base"
24
-
25
- Vagrant::Spec::Acceptance.configure do |c|
26
- c.component_paths << File.expand_path("../spec/acceptance", __FILE__)
27
- c.skeleton_paths << File.expand_path("../spec/acceptance/skeletons", __FILE__)
28
-
29
- c.provider "skytap",
30
- box: File.expand_path("../skytap-dummy.box", __FILE__),
31
- contexts: ["provider-context/skytap"]
32
- end