vagrant-vmware-appcatalyst 1.0.1

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 (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +38 -0
  3. data/.rubocop.yml +34 -0
  4. data/Gemfile +7 -0
  5. data/LICENSE +177 -0
  6. data/README.md +72 -0
  7. data/lib/vagrant-vmware-appcatalyst.rb +30 -0
  8. data/lib/vagrant-vmware-appcatalyst/action.rb +249 -0
  9. data/lib/vagrant-vmware-appcatalyst/action/connect_appcatalyst.rb +45 -0
  10. data/lib/vagrant-vmware-appcatalyst/action/destroy_vm.rb +33 -0
  11. data/lib/vagrant-vmware-appcatalyst/action/import.rb +101 -0
  12. data/lib/vagrant-vmware-appcatalyst/action/is_created.rb +34 -0
  13. data/lib/vagrant-vmware-appcatalyst/action/is_paused.rb +33 -0
  14. data/lib/vagrant-vmware-appcatalyst/action/is_running.rb +32 -0
  15. data/lib/vagrant-vmware-appcatalyst/action/message_already_running.rb +29 -0
  16. data/lib/vagrant-vmware-appcatalyst/action/message_not_created.rb +29 -0
  17. data/lib/vagrant-vmware-appcatalyst/action/message_not_running.rb +29 -0
  18. data/lib/vagrant-vmware-appcatalyst/action/message_not_supported.rb +29 -0
  19. data/lib/vagrant-vmware-appcatalyst/action/message_will_not_destroy.rb +30 -0
  20. data/lib/vagrant-vmware-appcatalyst/action/power_off.rb +40 -0
  21. data/lib/vagrant-vmware-appcatalyst/action/power_on.rb +34 -0
  22. data/lib/vagrant-vmware-appcatalyst/action/read_ssh_info.rb +56 -0
  23. data/lib/vagrant-vmware-appcatalyst/action/read_state.rb +72 -0
  24. data/lib/vagrant-vmware-appcatalyst/action/resume.rb +31 -0
  25. data/lib/vagrant-vmware-appcatalyst/action/suspend.rb +31 -0
  26. data/lib/vagrant-vmware-appcatalyst/cap/mount_appcatalyst_shared_folder.rb +100 -0
  27. data/lib/vagrant-vmware-appcatalyst/cap/public_address.rb +31 -0
  28. data/lib/vagrant-vmware-appcatalyst/config.rb +40 -0
  29. data/lib/vagrant-vmware-appcatalyst/driver/base.rb +131 -0
  30. data/lib/vagrant-vmware-appcatalyst/driver/meta.rb +106 -0
  31. data/lib/vagrant-vmware-appcatalyst/driver/version_1_0.rb +223 -0
  32. data/lib/vagrant-vmware-appcatalyst/errors.rb +44 -0
  33. data/lib/vagrant-vmware-appcatalyst/plugin.rb +111 -0
  34. data/lib/vagrant-vmware-appcatalyst/provider.rb +60 -0
  35. data/lib/vagrant-vmware-appcatalyst/synced_folder.rb +123 -0
  36. data/lib/vagrant-vmware-appcatalyst/version.rb +18 -0
  37. data/locales/en.yml +29 -0
  38. data/vagrant-vmware-appcatalyst.gemspec +40 -0
  39. metadata +165 -0
@@ -0,0 +1,60 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
+ # use this file except in compliance with the License. You may obtain a copy of
6
+ # the License at http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS, without
10
+ # warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
11
+ # License for the specific language governing permissions and limitations under
12
+ # the License.
13
+
14
+ require 'log4r'
15
+ require 'vagrant'
16
+
17
+ module VagrantPlugins
18
+ module AppCatalyst
19
+ class Provider < Vagrant.plugin('2', :provider)
20
+ def initialize(machine)
21
+ @logger = Log4r::Logger.new("vagrant::provider::vmware_appcatalyst")
22
+ @machine = machine
23
+ end
24
+
25
+ def action(name)
26
+ action_method = "action_#{name}"
27
+ return Action.send(action_method) if Action.respond_to?(action_method)
28
+ nil
29
+ end
30
+
31
+ def ssh_info
32
+ env = @machine.action('read_ssh_info')
33
+ env[:machine_ssh_info]
34
+ end
35
+
36
+ def state
37
+ env = @machine.action('read_state')
38
+
39
+ state_id = env[:machine_state_id]
40
+
41
+ # Translate into short/long descriptions
42
+ short = state_id.to_s.gsub("_", " ")
43
+ long = I18n.t("vagrant.commands.status.#{state_id}")
44
+
45
+ # If we're not created, then specify the special ID flag
46
+ if state_id == :not_created
47
+ state_id = Vagrant::MachineState::NOT_CREATED_ID
48
+ end
49
+
50
+ # Return the MachineState object
51
+ Vagrant::MachineState.new(state_id, short, long)
52
+ end
53
+
54
+ def to_s
55
+ id = @machine.id.nil? ? 'new' : @machine.id
56
+ "AppCatalyst (#{id})"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,123 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
+ # use this file except in compliance with the License. You may obtain a copy of
6
+ # the License at http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS, without
10
+ # warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
11
+ # License for the specific language governing permissions and limitations under
12
+ # the License.
13
+
14
+ require "vagrant/util/platform"
15
+
16
+ module VagrantPlugins
17
+ module AppCatalyst
18
+ class SyncedFolder < Vagrant.plugin("2", :synced_folder)
19
+ def usable?(machine, raise_errors=false)
20
+ return false if machine.provider_name != :vmware_appcatalyst
21
+
22
+ machine.provider_config.functional_hgfs
23
+ end
24
+
25
+ def prepare(machine, folders, _opts)
26
+ @machine = machine
27
+ share_folders(machine, folders, false)
28
+ end
29
+
30
+ def enable(machine, folders, _opts)
31
+ share_folders(machine, folders, true)
32
+
33
+ folders = folders.sort_by do |id, data|
34
+ if data[:guestpath]
35
+ data[:guestpath].length
36
+ else
37
+ 10_000
38
+ end
39
+ end
40
+
41
+ machine.ui.output(I18n.t('vagrant.actions.vm.share_folders.mounting'))
42
+ folders.each do |id, data|
43
+ if data[:guestpath]
44
+ machine.ui.detail(
45
+ I18n.t('vagrant.actions.vm.share_folders.mounting_entry',
46
+ guestpath: data[:guestpath],
47
+ hostpath: data[:hostpath]))
48
+ data = data.dup
49
+
50
+ ssh_info = machine.ssh_info
51
+ data[:owner] ||= ssh_info[:username]
52
+ data[:group] ||= ssh_info[:username]
53
+
54
+ machine.guest.capability(
55
+ :mount_appcatalyst_shared_folder,
56
+ os_friendly_id(id), data[:guestpath], data)
57
+ else
58
+ machine.ui.detail(
59
+ I18n.t('vagrant.actions.vm.share_folders.nomount_entry',
60
+ hostpath: data[:hostpath]))
61
+ end
62
+ end
63
+ end
64
+
65
+ def disable(machine, folders, _opts)
66
+ if machine.guest.capability?(:unmount_appcatalyst_shared_folder)
67
+ folders.each do |_, data|
68
+ machine.guest.capability(
69
+ :unmount_appcatalyst_shared_folder,
70
+ data[:guestpath], data)
71
+ end
72
+ end
73
+
74
+ names = folders.map { |id, _| os_friendly_id(id) }
75
+ env = @machine.action('connect')
76
+ names.each do |name|
77
+ env[:appcatalyst_cnx].delete_vm_shared_folder(env[:machine].id, name)
78
+ end
79
+ end
80
+
81
+ def cleanup(machine, _)
82
+ @machine = machine
83
+ env = @machine.action('connect')
84
+
85
+ if machine.id && machine.id != ''
86
+ env[:appcatalyst_cnx].get_vm_shared_folders(env[:machine].id).each do |folder|
87
+ env[:appcatalyst_cnx].delete_vm_shared_folder(env[:machine].id, folder)
88
+ end
89
+ end
90
+ end
91
+
92
+ protected
93
+
94
+ def os_friendly_id(id)
95
+ id.gsub(/[\/]/, '_').sub(/^_/, '')
96
+ end
97
+
98
+ def share_folders(_, folders, transient)
99
+ env = @machine.action('connect')
100
+
101
+ defs = []
102
+ folders.each do |id, data|
103
+ hostpath = data[:hostpath]
104
+ unless data[:hostpath_exact]
105
+ hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath)
106
+ end
107
+
108
+ if (!!data[:transient]) == transient
109
+ defs << {
110
+ name: os_friendly_id(id),
111
+ hostpath: hostpath.to_s,
112
+ transient: transient,
113
+ }
114
+ end
115
+ end
116
+ env[:appcatalyst_cnx].set_vm_shared_folders(env[:machine].id, 'true')
117
+ defs.each do |folder|
118
+ env[:appcatalyst_cnx].add_vm_shared_folder(env[:machine].id, folder[:name], folder[:hostpath], 4)
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
+ # use this file except in compliance with the License. You may obtain a copy of
6
+ # the License at http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS, without
10
+ # warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
11
+ # License for the specific language governing permissions and limitations under
12
+ # the License.
13
+
14
+ module VagrantPlugins
15
+ module AppCatalyst
16
+ VERSION = '1.0.1'
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ # use this file except in compliance with the License. You may obtain a copy of
5
+ # the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS, without
9
+ # warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
10
+ # License for the specific language governing permissions and limitations under
11
+ # the License.
12
+ en:
13
+ vagrant_appcatalyst:
14
+ vm:
15
+ cloning: |-
16
+ Cloning VM, this might take a while...
17
+ errors:
18
+ appcatalyst_old_version: |-
19
+ This version of AppCatalyst is not supported.
20
+ violations:
21
+ poweron_not_allowed: |-
22
+ Power on was canceled, make sure the VM you're trying to power on does not violate AppCatalyst constraints.
23
+ operation_not_supported: |-
24
+ Operation not supported by AppCatalyst.
25
+ rest_errors:
26
+ unattended_code_error: |-
27
+ Unattended code received %{message}
28
+ endpoint_unavailable: |-
29
+ Can't connect to AppCatalyst, please verify connectivity.
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
+ # use this file except in compliance with the License. You may obtain a copy of
6
+ # the License at http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS, without
10
+ # warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
11
+ # License for the specific language governing permissions and limitations under
12
+ # the License.
13
+
14
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
15
+ require 'vagrant-vmware-appcatalyst/version'
16
+
17
+ Gem::Specification.new do |s|
18
+ s.name = 'vagrant-vmware-appcatalyst'
19
+ s.version = VagrantPlugins::AppCatalyst::VERSION
20
+ s.platform = Gem::Platform::RUBY
21
+ s.authors = ['Fabio Rapposelli']
22
+ s.email = ['fabio@vmware.com']
23
+ s.homepage = 'https://github.com/vmware/vagrant-vmware-appcatalyst'
24
+ s.license = 'Apache License 2.0'
25
+ s.summary = 'VMware AppCatalyst® provider'
26
+ s.description = 'Enables Vagrant to manage machines with VMware AppCatalyst®.'
27
+
28
+ s.add_runtime_dependency 'i18n', '~> 0.6'
29
+ s.add_runtime_dependency 'log4r', '~> 1.1'
30
+ s.add_runtime_dependency 'httpclient', '~> 2.6'
31
+
32
+ s.add_development_dependency 'rspec-core', '~> 2.14'
33
+ s.add_development_dependency 'rspec-expectations', '~> 2.14'
34
+ s.add_development_dependency 'rspec-mocks', '~> 2.14'
35
+
36
+ s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
37
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
38
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
39
+ s.require_path = 'lib'
40
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-vmware-appcatalyst
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Rapposelli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: i18n
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: log4r
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httpclient
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-core
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-expectations
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-mocks
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ description: Enables Vagrant to manage machines with VMware AppCatalyst®.
98
+ email:
99
+ - fabio@vmware.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rubocop.yml"
106
+ - Gemfile
107
+ - LICENSE
108
+ - README.md
109
+ - lib/vagrant-vmware-appcatalyst.rb
110
+ - lib/vagrant-vmware-appcatalyst/action.rb
111
+ - lib/vagrant-vmware-appcatalyst/action/connect_appcatalyst.rb
112
+ - lib/vagrant-vmware-appcatalyst/action/destroy_vm.rb
113
+ - lib/vagrant-vmware-appcatalyst/action/import.rb
114
+ - lib/vagrant-vmware-appcatalyst/action/is_created.rb
115
+ - lib/vagrant-vmware-appcatalyst/action/is_paused.rb
116
+ - lib/vagrant-vmware-appcatalyst/action/is_running.rb
117
+ - lib/vagrant-vmware-appcatalyst/action/message_already_running.rb
118
+ - lib/vagrant-vmware-appcatalyst/action/message_not_created.rb
119
+ - lib/vagrant-vmware-appcatalyst/action/message_not_running.rb
120
+ - lib/vagrant-vmware-appcatalyst/action/message_not_supported.rb
121
+ - lib/vagrant-vmware-appcatalyst/action/message_will_not_destroy.rb
122
+ - lib/vagrant-vmware-appcatalyst/action/power_off.rb
123
+ - lib/vagrant-vmware-appcatalyst/action/power_on.rb
124
+ - lib/vagrant-vmware-appcatalyst/action/read_ssh_info.rb
125
+ - lib/vagrant-vmware-appcatalyst/action/read_state.rb
126
+ - lib/vagrant-vmware-appcatalyst/action/resume.rb
127
+ - lib/vagrant-vmware-appcatalyst/action/suspend.rb
128
+ - lib/vagrant-vmware-appcatalyst/cap/mount_appcatalyst_shared_folder.rb
129
+ - lib/vagrant-vmware-appcatalyst/cap/public_address.rb
130
+ - lib/vagrant-vmware-appcatalyst/config.rb
131
+ - lib/vagrant-vmware-appcatalyst/driver/base.rb
132
+ - lib/vagrant-vmware-appcatalyst/driver/meta.rb
133
+ - lib/vagrant-vmware-appcatalyst/driver/version_1_0.rb
134
+ - lib/vagrant-vmware-appcatalyst/errors.rb
135
+ - lib/vagrant-vmware-appcatalyst/plugin.rb
136
+ - lib/vagrant-vmware-appcatalyst/provider.rb
137
+ - lib/vagrant-vmware-appcatalyst/synced_folder.rb
138
+ - lib/vagrant-vmware-appcatalyst/version.rb
139
+ - locales/en.yml
140
+ - vagrant-vmware-appcatalyst.gemspec
141
+ homepage: https://github.com/vmware/vagrant-vmware-appcatalyst
142
+ licenses:
143
+ - Apache License 2.0
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 2.2.2
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: VMware AppCatalyst® provider
165
+ test_files: []