veewee 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,12 +3,10 @@ require 'veewee/provider/core/helper/ssh'
3
3
  require 'veewee/provider/core/helper/web'
4
4
  require 'veewee/provider/core/helper/shell'
5
5
  require 'veewee/provider/core/helper/iso'
6
- require 'veewee/provider/core/helper/winrm'
7
6
  require 'veewee/provider/core/helper/comm'
8
7
 
9
8
  require 'veewee/provider/core/box/build'
10
9
  require 'veewee/provider/core/box/scp'
11
- require 'veewee/provider/core/box/wincp'
12
10
  require 'veewee/provider/core/box/copy'
13
11
  require 'veewee/provider/core/box/exec'
14
12
  require 'veewee/provider/core/box/poweroff'
@@ -16,7 +14,8 @@ require 'veewee/provider/core/box/halt'
16
14
  require 'veewee/provider/core/box/sudo'
17
15
  require 'veewee/provider/core/box/ssh'
18
16
  require 'veewee/provider/core/box/issh'
19
- require 'veewee/provider/core/box/winrm'
17
+
18
+
20
19
  require 'veewee/provider/core/box/floppy'
21
20
  require 'veewee/provider/core/box/validate_tags'
22
21
 
@@ -33,7 +32,6 @@ module Veewee
33
32
  include ::Veewee::Provider::Core::Helper::Web
34
33
  include ::Veewee::Provider::Core::Helper::Shell
35
34
  include ::Veewee::Provider::Core::Helper::Ssh
36
- include ::Veewee::Provider::Core::Helper::Winrm
37
35
  include ::Veewee::Provider::Core::Helper::Comm
38
36
  include ::Veewee::Provider::Core::Helper::Iso
39
37
 
@@ -52,8 +50,42 @@ module Veewee
52
50
  self.set_definition(name)
53
51
  end
54
52
 
53
+ def gem_available?(gemname)
54
+ env.logger.info "Checking for gem #{gemname}"
55
+ available=false
56
+ begin
57
+ available=true unless Gem::Specification::find_by_name("#{gemname}").nil?
58
+ rescue Gem::LoadError
59
+ env.logger.info "Error loading gem #{gemname}"
60
+ available=false
61
+ rescue
62
+ env.logger.info "Falling back to old syntax for #{gemname}"
63
+ available=Gem.available?("#{gemname}")
64
+ env.logger.info "Old syntax #{gemname}.available? #{available}"
65
+ end
66
+ return available
67
+ end
68
+
55
69
  def set_definition(definition_name)
56
70
  @definition=env.definitions[definition_name]
71
+
72
+ # We check for windows as em-winrm is not available on ruby1.9
73
+ is_windows = @definition.os_type_id.start_with?('Windows')
74
+
75
+ # On windows systems
76
+ if is_windows
77
+ # Check if winrm is available
78
+ if gem_available?('em-winrm')
79
+ require 'veewee/provider/core/box/winrm'
80
+ require 'veewee/provider/core/helper/winrm'
81
+ require 'veewee/provider/core/box/wincp'
82
+
83
+ self.class.send(:include, ::Veewee::Provider::Core::Helper::Winrm)
84
+ else
85
+ raise Veewee::Error, "\nTo build a windows basebox you need to install the gem 'em-winrm' first"
86
+ end
87
+ end
88
+
57
89
  return self
58
90
  end
59
91
 
@@ -4,5 +4,5 @@ end
4
4
 
5
5
  # Only set the version constant if it wasn't set before
6
6
  unless defined?(Veewee::VERSION)
7
- ::Veewee::VERSION="0.3.2"
7
+ ::Veewee::VERSION="0.3.3"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veewee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-08 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vagrant
@@ -1271,7 +1271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1271
1271
  version: '0'
1272
1272
  segments:
1273
1273
  - 0
1274
- hash: 1802147097597498635
1274
+ hash: -1615161607995468934
1275
1275
  required_rubygems_version: !ruby/object:Gem::Requirement
1276
1276
  none: false
1277
1277
  requirements: