prlbackup 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,10 @@ module PrlBackup
28
28
  $/x
29
29
  new(:uuid => $2, :time => $4, :type => $5) if re.match(line)
30
30
  end
31
+
32
+ def to_s
33
+ 'Backup'
34
+ end
31
35
  end
32
36
 
33
37
  include PrlBackup
@@ -44,7 +48,7 @@ module PrlBackup
44
48
  end
45
49
 
46
50
  def time
47
- DateTime.parse(properties[:time])
51
+ DateTime.strptime(properties[:time], '%m/%d/%Y %H:%M:%S')
48
52
  end
49
53
 
50
54
  def full?
@@ -59,8 +63,11 @@ module PrlBackup
59
63
  time <=> other.time
60
64
  end
61
65
 
66
+ # Display time of backup.
62
67
  def to_s
63
- "Backup: #{time.strftime('%Y-%m-%d %H:%M:%S')}"
68
+ "#{self.class.to_s}: #{time.strftime('%Y-%m-%d %H:%M:%S')}"
69
+ rescue ArgumentError
70
+ "#{self.class.to_s}: Unknown"
64
71
  end
65
72
  end
66
73
  end
@@ -1,3 +1,3 @@
1
1
  module PrlBackup
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -18,6 +18,10 @@ module PrlBackup
18
18
  cmd = %w{prlctl list --all --output uuid}
19
19
  run(*cmd).split("\n").grep(/(\{[a-f0-9-]+\})/) { new($1) }
20
20
  end
21
+
22
+ def to_s
23
+ 'VM'
24
+ end
21
25
  end
22
26
 
23
27
  # Initialize with a valid name or UUID from the virtual machine.
@@ -58,9 +62,9 @@ module PrlBackup
58
62
  uuid == other_vm.uuid
59
63
  end
60
64
 
61
- # Return the name of the virtual machine.
65
+ # Return the virtual machine's name.
62
66
  def to_s
63
- name || 'Unknown VM'
67
+ "VM: %s" % (name || 'Unknown')
64
68
  end
65
69
 
66
70
  private
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PRLBACKUP" "1" "May 2012" "" "PRLBACKUP V1.2.0"
4
+ .TH "PRLBACKUP" "1" "May 2012" "" "PRLBACKUP V1.3.0"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBprlbackup\fR \- an awesome backup tool for Parallels Server Virtual Machines
@@ -58,6 +58,12 @@ module PrlBackup
58
58
  end
59
59
  end
60
60
 
61
+ describe '.to_s' do
62
+ it 'should display the context' do
63
+ Backup.to_s.should eql('Backup')
64
+ end
65
+ end
66
+
61
67
  describe '#uuid' do
62
68
  it 'should return the backup uuid' do
63
69
  backup = Backup.new(:uuid => '{ae6565dd-7f8f-42cb-a088-8b1d98f5160b}')
@@ -110,6 +116,11 @@ module PrlBackup
110
116
  backup = Backup.new(:time => '02/27/2012 13:11:32')
111
117
  backup.to_s.should eql('Backup: 2012-02-27 13:11:32')
112
118
  end
119
+
120
+ it 'should fallback to "Unknown" when no time is available' do
121
+ backup = Backup.new(:time => 'unparsable time string')
122
+ backup.to_s.should eql('Backup: Unknown')
123
+ end
113
124
  end
114
125
  end
115
126
  end
@@ -57,6 +57,12 @@ module PrlBackup
57
57
  end
58
58
  end
59
59
 
60
+ describe '.to_s' do
61
+ it 'should display the context' do
62
+ VirtualMachine.to_s.should eql('VM')
63
+ end
64
+ end
65
+
60
66
  describe '#config' do
61
67
  it 'should return the global config' do
62
68
  PrlBackup.should_receive(:config).and_return({:foo => 'bar'})
@@ -228,12 +234,12 @@ module PrlBackup
228
234
  describe '#to_s' do
229
235
  it 'should return the name' do
230
236
  @vm.should_receive('name').and_return('name_of_the_vm')
231
- @vm.to_s.should eql('name_of_the_vm')
237
+ @vm.to_s.should eql('VM: name_of_the_vm')
232
238
  end
233
239
 
234
240
  it 'should return "Unknown VM" if name is nil' do
235
241
  @vm.should_receive(:name).and_return(nil)
236
- @vm.to_s.should eql('Unknown VM')
242
+ @vm.to_s.should eql('VM: Unknown')
237
243
  end
238
244
  end
239
245
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prlbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
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-05-05 00:00:00.000000000Z
12
+ date: 2012-05-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-cli
16
- requirement: &70297487607280 !ruby/object:Gem::Requirement
16
+ requirement: &70338113234260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70297487607280
24
+ version_requirements: *70338113234260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gem-man
27
- requirement: &70297487605600 !ruby/object:Gem::Requirement
27
+ requirement: &70338113211180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.3.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70297487605600
35
+ version_requirements: *70338113211180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &70297487603540 !ruby/object:Gem::Requirement
38
+ requirement: &70338113209860 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70297487603540
46
+ version_requirements: *70338113209860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &70297487584840 !ruby/object:Gem::Requirement
49
+ requirement: &70338113208440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.4.11
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70297487584840
57
+ version_requirements: *70338113208440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: aruba-doubles
60
- requirement: &70297487583560 !ruby/object:Gem::Requirement
60
+ requirement: &70338113207380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.2.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70297487583560
68
+ version_requirements: *70338113207380
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-cucumber
71
- requirement: &70297487581460 !ruby/object:Gem::Requirement
71
+ requirement: &70338113206080 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.7.5
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70297487581460
79
+ version_requirements: *70338113206080
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &70297487579380 !ruby/object:Gem::Requirement
82
+ requirement: &70338113204860 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.5.1
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70297487579380
90
+ version_requirements: *70338113204860
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: ronn
93
- requirement: &70297487578400 !ruby/object:Gem::Requirement
93
+ requirement: &70338113183280 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.7.3
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70297487578400
101
+ version_requirements: *70338113183280
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &70297487576720 !ruby/object:Gem::Requirement
104
+ requirement: &70338113181380 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70297487576720
112
+ version_requirements: *70338113181380
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rb-fsevent
115
- requirement: &70297487574660 !ruby/object:Gem::Requirement
115
+ requirement: &70338113178740 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: 0.9.0
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70297487574660
123
+ version_requirements: *70338113178740
124
124
  description: an awesome backup tool for Parallels Server Virtual Machines
125
125
  email:
126
126
  - bjoernalbers@googlemail.com
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -855199531079728294
171
+ hash: -1782022784349519388
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
@@ -177,13 +177,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  segments:
179
179
  - 0
180
- hash: -855199531079728294
180
+ hash: -1782022784349519388
181
181
  requirements: []
182
182
  rubyforge_project:
183
183
  rubygems_version: 1.8.10
184
184
  signing_key:
185
185
  specification_version: 3
186
- summary: prlbackup-1.2.0
186
+ summary: prlbackup-1.3.0
187
187
  test_files:
188
188
  - features/cleanup.feature
189
189
  - features/create_backups.feature