lab-manager 1.0.0 → 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 (2) hide show
  1. data/lib/lab_manager.rb +27 -1
  2. metadata +1 -1
data/lib/lab_manager.rb CHANGED
@@ -3,6 +3,7 @@ require 'soap/wsdlDriver'
3
3
  require 'soap/header/simplehandler'
4
4
  require 'soap/element'
5
5
  require 'xsd/datatypes'
6
+ require 'yaml'
6
7
 
7
8
  require 'soap/netHttpClient'
8
9
 
@@ -44,7 +45,16 @@ end
44
45
  #
45
46
  class LabManager
46
47
 
48
+ @@configPath = File.expand_path("~/.lab_manager")
47
49
  @@url = nil
50
+
51
+ def self.configPath
52
+ @@configPath
53
+ end
54
+ def self.configPath=(value)
55
+ @@configPath = value
56
+ end
57
+
48
58
  def self.url
49
59
  @@url
50
60
  end
@@ -52,15 +62,19 @@ class LabManager
52
62
  @@url = value
53
63
  end
54
64
 
65
+ def self.reset
66
+ @@url = nil
67
+ end
68
+
55
69
  attr_accessor :workspace
56
70
 
57
71
  def initialize(organization, username, password, url = nil)
72
+ @@url = load_config(url)
58
73
  raise "Missing url" if @@url.nil?
59
74
 
60
75
  @organization = organization
61
76
  @username = username
62
77
  @password = password
63
- @@url = url
64
78
  end
65
79
 
66
80
  #<GetConfigurationByName xmlns="http://vmware.com/labmanager">
@@ -147,6 +161,18 @@ class LabManager
147
161
 
148
162
  proxy
149
163
  end
164
+
165
+ def load_config(url)
166
+ if (!@@url.nil?)
167
+ url = @@url
168
+ elsif (url.nil?)
169
+ if File.exists? @@configPath
170
+ config = YAML::load_file(@@configPath)
171
+ url = config["url"]
172
+ end
173
+ end
174
+ url
175
+ end
150
176
  end
151
177
 
152
178
  # <soap:Header>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: