virtualmaster 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/virtualmaster CHANGED
@@ -20,3 +20,12 @@ default_command :help
20
20
  VirtualMaster::CLI.run do
21
21
  end
22
22
 
23
+ include Commander::UI
24
+ include Commander::UI::AskForClass
25
+ include Commander::Delegates
26
+
27
+ $terminal.wrap_at = HighLine::SystemExtensions.terminal_size.first - 5 rescue 80 if $stdin.tty?
28
+
29
+ Commander::Runner.instance.run!
30
+
31
+
data/lib/vmaster.rb CHANGED
@@ -1,8 +1,23 @@
1
+
2
+ require 'commander/delegates'
1
3
  require "vmaster/version"
2
4
  require "vmaster/helpers"
3
5
  require "vmaster/cli"
4
- require "commander/import"
5
- require "vmaster/request.rb"
6
+ require "vmaster/request"
7
+
8
+ require 'commander'
9
+ require 'commander/delegates'
10
+
11
+ #
12
+ # snippet from commander:lib/commander/import.rb needed when manually calling
13
+ # run! instead of relying on at_exit { run! } (sic!).
14
+ #
15
+ include Commander::UI
16
+ include Commander::UI::AskForClass
17
+ include Commander::Delegates
18
+
19
+ $terminal.wrap_at = HighLine::SystemExtensions.terminal_size.first - 5 rescue 80 if $stdin.tty?
20
+
6
21
 
7
22
  # include commands
8
23
  require 'vmaster/config_command'
data/lib/vmaster/cli.rb CHANGED
@@ -19,7 +19,13 @@ module VirtualMaster
19
19
  puts
20
20
  end
21
21
 
22
- @@api = DeltaCloud.new(@@config[:username], @@config[:password], VirtualMaster::DEFAULT_URL)
22
+ begin
23
+ @@api = DeltaCloud.new(@@config[:username], @@config[:password], VirtualMaster::DEFAULT_URL)
24
+ rescue DeltaCloud::API::BackendError => e
25
+ abort "Invalid API response: #{e.message}"
26
+ rescue Exception => e
27
+ abort "Unable to connect to Virtualmaster's DeltaCloud API: #{e.message}"
28
+ end
23
29
  end
24
30
 
25
31
  yield
@@ -37,11 +37,13 @@ command :create do |c|
37
37
  if options.image
38
38
  image_name = options.image
39
39
 
40
-
41
40
  if image_name.match /^[\d]+$/
42
41
  # use image_id directly
43
42
  image_id = image_name.to_i
44
43
 
44
+ image_name = nil
45
+ elsif image_name.match /^http(s)?:\/\//
46
+ image_id = image_name
45
47
  image_name = nil
46
48
  else
47
49
  # lookup predefined images
@@ -51,7 +53,7 @@ command :create do |c|
51
53
  end
52
54
  end
53
55
 
54
- say image_name ? "Using image '#{image_name}' with ID #{image_id}" : "Using image with ID #{image_id}"
56
+ say image_name ? "Using image '#{image_name}' with ID #{image_id}" : "Using image #{image_id}"
55
57
 
56
58
  # instance hardware profile
57
59
  profile_name = options.profile || VirtualMaster::DEFAULT_PROFILE
@@ -1,3 +1,3 @@
1
1
  module VirtualMaster
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualmaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-05 00:00:00.000000000 Z
12
+ date: 2012-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
16
- requirement: &70257759342520 !ruby/object:Gem::Requirement
16
+ requirement: &70327968586800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.1.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70257759342520
24
+ version_requirements: *70327968586800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: deltacloud-client
27
- requirement: &70257759342020 !ruby/object:Gem::Requirement
27
+ requirement: &70327968586300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70257759342020
35
+ version_requirements: *70327968586300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: terminal-table
38
- requirement: &70257759341560 !ruby/object:Gem::Requirement
38
+ requirement: &70327967699220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.4.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70257759341560
46
+ version_requirements: *70327967699220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: net-ssh
49
- requirement: &70257759341100 !ruby/object:Gem::Requirement
49
+ requirement: &70327967698520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70257759341100
57
+ version_requirements: *70327967698520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70257755270800 !ruby/object:Gem::Requirement
60
+ requirement: &70327967697440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70257755270800
68
+ version_requirements: *70327967697440
69
69
  description: Command line interface to VirtualMaster. Control your virtual infrastructure.
70
70
  email:
71
71
  - radim@laststation.net