vmserver 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/vmserver.rb +19 -24
  3. data/vmserver.gemspec +2 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
data/lib/vmserver.rb CHANGED
@@ -25,7 +25,7 @@ class VMServer
25
25
 
26
26
  def start
27
27
  command = 'start'
28
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}'}
28
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}"}
29
29
  log vm_command
30
30
  result = system(vm_command)
31
31
  result ? log("VM started successfully has been executed.") : log("Error! VM could not be started.")
@@ -40,7 +40,7 @@ class VMServer
40
40
 
41
41
  def stop(mode='soft')
42
42
  command = 'stop'
43
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{mode}}
43
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{mode}}
44
44
  log vm_command
45
45
  result = system(vm_command)
46
46
  result ? log("VM stopped successfully.") : log("Error! VM could not be stopped.")
@@ -55,7 +55,7 @@ class VMServer
55
55
 
56
56
  def reset(mode='soft')
57
57
  command = 'reset'
58
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{mode}}
58
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{mode}}
59
59
  log vm_command
60
60
  result = system(vm_command)
61
61
  result ? log("VM has been resetted.") : log("Error! VM could not be reset.")
@@ -70,7 +70,7 @@ class VMServer
70
70
 
71
71
  def suspend(mode='soft')
72
72
  command = 'reset'
73
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{mode}}
73
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{mode}}
74
74
  log vm_command
75
75
  result = system(vm_command)
76
76
  result ? log("VM has been suspended.") : log("Error! VM could not be suspended.")
@@ -83,7 +83,7 @@ class VMServer
83
83
 
84
84
  def pause
85
85
  command = 'pause'
86
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}'}
86
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}"}
87
87
  log vm_command
88
88
  result = system(vm_command)
89
89
  result ? log("VM has been paused") : log("Error! VM could not be paused.")
@@ -96,7 +96,7 @@ class VMServer
96
96
 
97
97
  def unpause
98
98
  command = 'unpause'
99
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}'}
99
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}"}
100
100
  log vm_command
101
101
  result = system(vm_command)
102
102
  result ? log("VM has been unpaused") : log("Error! VM could not be unpaused.")
@@ -111,7 +111,7 @@ class VMServer
111
111
 
112
112
  def snapshot(name="snapshot_#{Time.now.strftime("%m%d")}")
113
113
  command = 'snapshot'
114
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{name}}
114
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{name}}
115
115
  log vm_command
116
116
  result = system(vm_command)
117
117
  result ? log("SnapShot successful") : log("Error! VM SnapShot failed.")
@@ -124,7 +124,7 @@ class VMServer
124
124
 
125
125
  def revert_to_snapshot(name)
126
126
  command = 'revertToSnapshot'
127
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{name}}
127
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{name}}
128
128
  log vm_command
129
129
  result = system(vm_command)
130
130
  result ? log("Revert SnapShot successful") : log("Error! VM Revert SnapShot failed.")
@@ -137,7 +137,7 @@ class VMServer
137
137
 
138
138
  def delete_snapshot(name)
139
139
  command = 'deleteSnapshot'
140
- vm_command = %Q{#{@base_command} #{command} '#{@datastore}' #{name}}
140
+ vm_command = %Q{#{@base_command} #{command} "#{@datastore}" #{name}}
141
141
  log vm_command
142
142
  result = system(vm_command)
143
143
  result ? log("SnapShot deleted successful") : log("Error! VM SnapShot delete failed.")
@@ -152,7 +152,7 @@ class VMServer
152
152
 
153
153
  def mkdir(dir)
154
154
  command = 'createDirectoryInGuest'
155
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{dir}'}
155
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{dir}'}
156
156
  log vm_command
157
157
  result = system(vm_command)
158
158
  result ? log("Directory created successfully in guest.") : log("Error! Directory could not be created.")
@@ -165,7 +165,7 @@ class VMServer
165
165
 
166
166
  def rmdir(dir)
167
167
  command = 'deleteDirectoryInGuest'
168
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{dir}'}
168
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{dir}'}
169
169
  log vm_command
170
170
  result = system(vm_command)
171
171
  result ? log("Directory deleted successfully.") : log("Error! Failed to delete directory.")
@@ -178,7 +178,7 @@ class VMServer
178
178
 
179
179
  def rmfile(file)
180
180
  command = 'deleteFileInGuest'
181
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{file}'}
181
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{file}'}
182
182
  log vm_command
183
183
  result = system(vm_command)
184
184
  result ? log("File deleted successfully.") : log("Error! Failed to delete file.")
@@ -191,13 +191,8 @@ class VMServer
191
191
 
192
192
  def ls(dir)
193
193
  command = 'listDirectoryInGuest'
194
- # vm_command = "#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' \'#{dir}\'"
195
- # log vm_command
196
- # result = system(vm_command)
197
- # result ? log("Listing Successful.") : log("Error! Listing directory failed.")
198
- # result
199
194
  entries = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} \'#{@datastore}\' \'#{dir}\'`
200
- # The entries would be a list of entries searated by new line. Convert this to an array.
195
+ # The entries would be a list of entries separated by new line. Convert this to an array.
201
196
  entries = entries.split("\n")
202
197
  entries
203
198
  end
@@ -207,7 +202,7 @@ class VMServer
207
202
  # Checks if a file exists in the guest OS
208
203
 
209
204
  def file_exists_in_guest?(file)
210
- output = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest '#{datastore}' '#{file}'`
205
+ output = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest "#{datastore}" '#{file}'`
211
206
  # output = system(vm_command)
212
207
  if output =~ /The file exists/
213
208
  return true
@@ -222,7 +217,7 @@ class VMServer
222
217
 
223
218
  def copy_file_from_host_to_guest(src, dest)
224
219
  command = 'copyFileFromHostToGuest'
225
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{src}' '#{dest}'}
220
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{src}' '#{dest}'}
226
221
  log vm_command
227
222
  result = system(vm_command)
228
223
  result ? log("Copy successful.") : log("Error! Copy failed.")
@@ -235,7 +230,7 @@ class VMServer
235
230
 
236
231
  def copy_file_from_guest_to_host(src,dest)
237
232
  command = 'copyFileFromGuestToHost'
238
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{src}' '#{dest}'}
233
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{src}' '#{dest}'}
239
234
  log vm_command
240
235
  result = system(vm_command)
241
236
  result ? log("Copy successful.") : log("Error! Copy failed.")
@@ -259,7 +254,7 @@ class VMServer
259
254
  def run_program_in_guest(program,prog_args={})
260
255
  command = 'runProgramInGuest'
261
256
  prog_args = prog_args[:prog_args]
262
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' -activeWindow '#{program}' #{prog_args}}
257
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" -activeWindow '#{program}' #{prog_args}}
263
258
  log vm_command
264
259
  result = system(vm_command)
265
260
  result ? log("Program executed successfully in guest.") : log("Error! Failed to execute program in guest.")
@@ -272,7 +267,7 @@ class VMServer
272
267
 
273
268
  def kill_process_in_guest(pid)
274
269
  command = 'killProcessInGuest'
275
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{guest_password} #{command} '#{@datastore}' #{pid}}
270
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{guest_password} #{command} "#{@datastore}" #{pid}}
276
271
  log vm_command
277
272
  result = system(vm_command)
278
273
  result ? log("Program executed successfully in guest.") : log("Error! Failed to execute program in guest.")
@@ -285,7 +280,7 @@ class VMServer
285
280
 
286
281
  def capture_screen(output_file)
287
282
  command = 'captureScreen'
288
- vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} '#{@datastore}' '#{output_file}'}
283
+ vm_command = %Q{#{@base_command} -gu #{@guest_user} -gp #{@guest_password} #{command} "#{@datastore}" '#{output_file}'}
289
284
  log vm_command
290
285
  result = system(vm_command)
291
286
  result ? log("File deleted successfully.") : log("Error! Failed to delete file.")
data/vmserver.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vmserver}
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sriram Varahan"]
12
- s.date = %q{2010-08-31}
12
+ s.date = %q{2010-09-16}
13
13
  s.description = %q{This gem simplifies the interaction of ruby code with VMServer. You need to have VMServer installed and running to use this gem.}
14
14
  s.email = %q{sriram.varahan@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmserver
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sriram Varahan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-31 00:00:00 +05:30
18
+ date: 2010-09-16 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies: []
21
21