veewee 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veewee (0.1.2)
4
+ veewee (0.1.3)
5
5
  highline (~> 1.6.1)
6
6
  net-ssh (~> 2.1.0)
7
7
  popen4 (~> 0.1.2)
@@ -21,17 +21,22 @@ module Veewee
21
21
  class Command < Vagrant::Command::GroupBase
22
22
  register "basebox","Commands to manage baseboxes"
23
23
 
24
- desc "templates", "List the currently available box templates"
24
+ desc "templates", "List the currently available basebox templates"
25
25
  def templates
26
26
  Veewee::Session.list_templates
27
27
  end
28
28
 
29
- desc "define BOXNAME TEMPLATE", "Define a new box starting from a template"
29
+ desc "define BOXNAME TEMPLATE", "Define a new basebox starting from a template"
30
30
  method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "overwrite the definition"
31
31
  def define(boxname, template)
32
32
  Veewee::Session.define(boxname,template,options)
33
33
  end
34
34
 
35
+ desc "undefine BOXNAME", "Removes the definition of a basebox "
36
+ def undefine(boxname)
37
+ Veewee::Session.undefine(boxname)
38
+ end
39
+
35
40
  desc "build BOXNAME", "Build the box BOXNAME"
36
41
  method_option :force,:type => :boolean , :default => false, :aliases => "-f", :desc => "overwrite the basebox"
37
42
  def build(boxname)
@@ -43,17 +48,17 @@ class Command < Vagrant::Command::GroupBase
43
48
  Veewee::Session.list_ostypes
44
49
  end
45
50
 
46
- desc "destroy BOXNAME", "Destroy the virtualmachine of a basebox"
51
+ desc "destroy BOXNAME", "Destroys the virtualmachine that was build for a basebox"
47
52
  def destroy(boxname)
48
53
  puts Veewee::Session.destroy_vm(boxname)
49
54
  end
50
55
 
51
- desc "list", "Lists all defined boxes"
56
+ desc "list", "Lists all defined baseboxes"
52
57
  def list
53
58
  Veewee::Session.list_definitions
54
59
  end
55
60
 
56
- desc "export [NAME]", "export the box"
61
+ desc "export [NAME]", "Exports the basebox to the vagrant box format"
57
62
  method_options :force => :boolean
58
63
  def export(boxname)
59
64
  if (!boxname.nil?)
@@ -100,6 +100,7 @@ module Veewee
100
100
  name_dir=File.join(@definition_dir,boxname)
101
101
  if File.directory?(name_dir)
102
102
  #TODO: Needs to be more defensive!!
103
+ puts "Removing definition #{boxname}"
103
104
  FileUtils.rm_rf(name_dir)
104
105
  else
105
106
  puts "Can not undefine , definition #{boxname} does not exist"
@@ -131,7 +132,11 @@ module Veewee
131
132
  end
132
133
 
133
134
  def self.list_definitions
134
- puts "Not yet implemented"
135
+ puts "The following defined baseboxes exit:"
136
+ subdirs=Dir.glob("#{@definition_dir}/*")
137
+ subdirs.each do |sub|
138
+ puts "- "+File.basename(sub)
139
+ end
135
140
  end
136
141
 
137
142
  def self.clean
@@ -156,6 +161,11 @@ module Veewee
156
161
 
157
162
  question=ask("Download? (Yes/No)") {|q| q.default="No"}
158
163
  if question.downcase == "yes"
164
+ if !File.exists?(@iso_dir)
165
+ puts "Creating an iso directory"
166
+ FileUtils.mkdir(@iso_dir)
167
+ end
168
+
159
169
  download_progress(@definition[:iso_src],full_path)
160
170
  else
161
171
  puts "You have choosen for manual download: "
@@ -175,6 +185,10 @@ module Veewee
175
185
  load_definition(boxname)
176
186
 
177
187
  Veewee::Export.vagrant(boxname,@box_dir,@definition)
188
+ #vagrant removes the mapping
189
+ #we need to restore it in order to be able to login again
190
+ add_ssh_nat_mapping(boxname)
191
+
178
192
  end
179
193
 
180
194
  def self.remove_box(boxname)
@@ -637,7 +651,7 @@ module Veewee
637
651
  #puts "remove old snapshots"
638
652
 
639
653
  for s in (last_good_state+1)..(snapnames.length-1)
640
- puts "Removing step [s] snapshot as it is no more valid"
654
+ puts "Removing step [#{s}] snapshot as it is no more valid"
641
655
  snapshot=vm.find_snapshot(snapnames[s])
642
656
  snapshot.destroy
643
657
  #puts snapshot
@@ -651,7 +665,8 @@ module Veewee
651
665
  sleep 2
652
666
  #TODO:Restore snapshot!!!
653
667
  vm.start
654
-
668
+ sleep 2
669
+ puts "Starting machine"
655
670
  end
656
671
 
657
672
  #puts "last good state #{last_good_state}"
data/lib/veewee/ssh.rb CHANGED
@@ -8,7 +8,7 @@ module Veewee
8
8
  options=defaults.merge(options)
9
9
 
10
10
  puts
11
- puts "Trying ssh login with user #{options[:user]} to sshd on port => #{options[:port]}"
11
+ puts "Waiting for ssh login with user #{options[:user]} to sshd on port => #{options[:port]} to work"
12
12
 
13
13
  begin
14
14
  Timeout::timeout(options[:timeout]) do
@@ -1,3 +1,3 @@
1
1
  module Veewee
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -33,7 +33,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
33
33
  cd /tmp
34
34
  wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
35
35
  mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
36
- sh /mnt/VBoxLinuxAdditions-x86.run
36
+ sh /mnt/VBoxLinuxAdditions.run
37
37
  umount /mnt
38
38
 
39
39
  rm VBoxGuestAdditions_$VBOX_VERSION.iso
@@ -33,7 +33,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
33
33
  cd /tmp
34
34
  wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
35
35
  mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
36
- sh /mnt/VBoxLinuxAdditions-x86.run
36
+ sh /mnt/VBoxLinuxAdditions.run
37
37
  umount /mnt
38
38
 
39
39
  rm VBoxGuestAdditions_$VBOX_VERSION.iso
@@ -33,7 +33,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
33
33
  cd /tmp
34
34
  wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
35
35
  mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
36
- sh /mnt/VBoxLinuxAdditions-x86.run
36
+ sh /mnt/VBoxLinuxAdditions.run
37
37
  umount /mnt
38
38
 
39
39
  rm VBoxGuestAdditions_$VBOX_VERSION.iso
@@ -36,7 +36,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
36
36
  cd /tmp
37
37
  wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
38
38
  mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
39
- sh /mnt/VBoxLinuxAdditions-x86.run
39
+ sh /mnt/VBoxLinuxAdditions.run
40
40
  umount /mnt
41
41
 
42
42
  rm VBoxGuestAdditions_$VBOX_VERSION.iso
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: veewee
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Patrick Debois
@@ -109,7 +109,6 @@ files:
109
109
  - README.md
110
110
  - Rakefile
111
111
  - bin/veewee
112
- - iso/.gitignore
113
112
  - lib/vagrant_init.rb
114
113
  - lib/veewee.rb
115
114
  - lib/veewee/command.rb
@@ -164,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
163
  requirements:
165
164
  - - ">="
166
165
  - !ruby/object:Gem::Version
167
- hash: 1560906446498783228
166
+ hash: 4379394221836518214
168
167
  segments:
169
168
  - 0
170
169
  version: "0"
data/iso/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *
2
- !.gitignore