vagrant-snap 0.03 → 0.04

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,7 +1,7 @@
1
1
  LICENSE.txt
2
2
  Manifest
3
3
  README.md
4
+ Rakefile
4
5
  VERSION
5
6
  lib/vagrant_init.rb
6
7
  lib/vagrant_snap.rb
7
- Rakefile
data/README.md CHANGED
@@ -17,6 +17,10 @@ can handle multi-vm envirnment.
17
17
  vagrant snap list # list snapshot
18
18
  vagrant snap take [NAME] [-d DESC] # take snapshot
19
19
 
20
+ ## Screen capture
21
+
22
+ ![vagrant_snap_list](https://github.com/t9md/vagrant-snap/raw/master/misc/vagrant_snap_list.png)
23
+
20
24
  ## Example
21
25
 
22
26
  In actual example, current snapshot is highlighted with yellow ANSI color.
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ Echoe.new "vagrant-snap", File.read("./VERSION").chomp do |p|
8
8
  p.summary = %Q{vagrant snapshot managemen plugin}
9
9
  p.project = nil
10
10
  p.url = "http://github.com/t9md/vagrant-snap"
11
+ p.ignore_pattern = ["misc/*"]
11
12
  p.runtime_dependencies << 'vagrant'
12
13
  p.runtime_dependencies << 'colored'
13
14
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.03
1
+ 0.04
@@ -12,6 +12,7 @@ module Snap
12
12
  def parse_tree(vmname)
13
13
  vm = VirtualBox::VM.find( vmname )
14
14
  @@current = vm.current_snapshot
15
+ @@indent = ""
15
16
  return unless @@current
16
17
  _parse(vm.root_snapshot)
17
18
  end
@@ -36,16 +37,24 @@ module Snap
36
37
  end
37
38
  end
38
39
 
39
- def _parse(snaps, level=0)
40
+ ## [TODO] darty hack, should be written more simply
41
+ def _parse(snaps, guide = "")
40
42
  @@snaps << snaps.name
41
- # time = snaps.time_stamp.strftime "%m%d-%H:%M"
42
43
  time = time_elapse(Time.now - snaps.time_stamp)
43
- result = "#{' ' * level}+-#{snaps.name} [ #{time} ]"
44
+ snapinfo = "#{snaps.name} [ #{time} ]"
45
+ snapinfo = snapinfo.yellow if snaps.uuid == @@current.uuid
46
+ result = "#{guide} #{snapinfo}"
44
47
  result << " #{snaps.description}" unless snaps.description.empty?
45
- result = result.yellow if snaps.uuid == @@current.uuid
46
48
  result << "\n"
47
- snaps.children.each do |e|
48
- result << _parse(e, level+1)
49
+ snaps.children.each_with_index do |e, idx|
50
+ tmp = guide.sub("`", " ").chop.chop + " "
51
+ nextguide = if snaps.children.size == idx + 1
52
+ "`"
53
+ else
54
+ "|"
55
+ end
56
+ tmp << nextguide << "--"
57
+ result << _parse(e, "#{tmp}")
49
58
  end
50
59
  result
51
60
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{vagrant-snap}
5
- s.version = "0.03"
5
+ s.version = "0.04"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["t9md"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{vagrant snapshot managemen plugin}
11
11
  s.email = %q{taqumd@gmail.com}
12
12
  s.extra_rdoc_files = ["LICENSE.txt", "README.md", "lib/vagrant_init.rb", "lib/vagrant_snap.rb"]
13
- s.files = ["LICENSE.txt", "Manifest", "README.md", "VERSION", "lib/vagrant_init.rb", "lib/vagrant_snap.rb", "Rakefile", "vagrant-snap.gemspec"]
13
+ s.files = ["LICENSE.txt", "Manifest", "README.md", "Rakefile", "VERSION", "lib/vagrant_init.rb", "lib/vagrant_snap.rb", "vagrant-snap.gemspec"]
14
14
  s.homepage = %q{http://github.com/t9md/vagrant-snap}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Vagrant-snap", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-snap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.03"
8
+ - 4
9
+ version: "0.04"
10
10
  platform: ruby
11
11
  authors:
12
12
  - t9md
@@ -60,10 +60,10 @@ files:
60
60
  - LICENSE.txt
61
61
  - Manifest
62
62
  - README.md
63
+ - Rakefile
63
64
  - VERSION
64
65
  - lib/vagrant_init.rb
65
66
  - lib/vagrant_snap.rb
66
- - Rakefile
67
67
  - vagrant-snap.gemspec
68
68
  has_rdoc: true
69
69
  homepage: http://github.com/t9md/vagrant-snap