smarbs 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.9.4 / 2010-01-28
2
+
3
+ * fixed an ignore_leftovers bug
4
+ * new tests for ignore_leftovers
5
+ * require ruby >= 1.9.1
6
+
1
7
  === 0.9.3 / 2009-12-16
2
8
 
3
- * First gem release
9
+ * First gem release
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ require 'hoe'
5
5
 
6
6
  Hoe.spec 'smarbs' do
7
7
  developer('Jan Rueegg', 'rggjan@gmail.com')
8
+ spec_extras[:required_ruby_version] = '>= 1.9.1'
8
9
  end
9
10
 
10
11
  # vim: syntax=ruby
data/lib/backup.rb CHANGED
@@ -175,7 +175,8 @@ class Backup
175
175
  @logger.p("", 98)
176
176
  return cursize
177
177
  end
178
-
178
+
179
+ # Starts the backup itself. Can raise a normal exeption, indicating something with the configfile is wrong, or a NoConfigException, meaning something else went wrong. Like, for example, when unknown rsync errors occur.
179
180
  def backup
180
181
 
181
182
  dest = @backup_dir.to_s + Time.now.strftime("%Y-%m-%d.%Hh%M") + "-backup.0"
data/lib/helpers.rb CHANGED
@@ -323,7 +323,7 @@ end
323
323
 
324
324
  # Specifies a directory that contains smarbs backups.
325
325
  class SmarbsBackupDir < Directory
326
- # Creates or reads out a SmarbsBackupDir, testing if it has valid contents.
326
+ # Creates or reads out a SmarbsBackupDir, testing if it has valid contents. Can raise a NoConfigException, or a RuntimeError
327
327
  def initialize(directory, ignore_leftovers=false)
328
328
  super(directory, :writable)
329
329
 
@@ -343,7 +343,8 @@ class SmarbsBackupDir < Directory
343
343
  # '...backup.0' directory is left. Otherwise returns false.
344
344
  def directory_left
345
345
  list = dirlist
346
- if list[0][0] == 0
346
+
347
+ if not list.empty? and list[0][0] == 0
347
348
  return (list[0][1]).to_s+"-backup.0"
348
349
  else
349
350
  return false
data/lib/smarbs.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module SMARBS
2
- VERSION = "0.9.3"
3
- DATE = "16. December 2009"
2
+ VERSION = "0.9.4"
3
+ DATE = "28. Januar 2010"
4
4
  DATADIR = File.expand_path("../data/", __FILE__)
5
5
  end
data/test/test_backup.rb CHANGED
@@ -167,5 +167,31 @@ ls: cannot access /im/not/existing/too: No such file or directory") do
167
167
  assert_success do
168
168
  Script.new("/tmp/smarbs/smarbs")
169
169
  end
170
+
171
+ clean
172
+ cf = default_configfile
173
+ cf.ignore_leftovers=true
174
+ cf.write
175
+
176
+ assert_success do
177
+ Script.new("/tmp/smarbs/smarbs/")
178
+ end
179
+
180
+ assert_backup_dirs([1])
181
+
182
+ assert_success do
183
+ Script.new("/tmp/smarbs/smarbs/")
184
+ end
185
+
186
+ assert_backup_dirs([1, 2])
187
+
188
+ `mkdir -p /tmp/smarbs/backedup/smarbsbackup/a-backup.0`
189
+
190
+ assert_success do
191
+ Script.new("/tmp/smarbs/smarbs/")
192
+ end
193
+
194
+ assert_backup_dirs([1, 2, 3])
195
+
170
196
  end
171
197
  end
data/test/test_helpers.rb CHANGED
@@ -211,6 +211,8 @@ class TestSmarbsBackupDir < Test::Unit::TestCase
211
211
  SmarbsBackupDir.new("/tmp/smarbs/test_directory")
212
212
  end
213
213
 
214
+ assert_nothing_raised do SmarbsBackupDir.new("/tmp/smarbs/test_directory", true) end
215
+
214
216
  assert_equal "a-backup.0", SmarbsBackupDir.new("/tmp/smarbs/test_directory", true).directory_left
215
217
 
216
218
  `rm -r /tmp/smarbs/test_directory/a-backup.0`
@@ -220,6 +222,10 @@ class TestSmarbsBackupDir < Test::Unit::TestCase
220
222
 
221
223
  assert_equal false, SmarbsBackupDir.new("/tmp/smarbs/test_directory", true).directory_left
222
224
 
225
+ `mkdir -p /tmp/smarbs/test_directory2/`
226
+
227
+ assert_equal false, SmarbsBackupDir.new("/tmp/smarbs/test_directory2", true).directory_left
228
+
223
229
  assert_raise_message "/etc/smarbs/ is not writable!" do
224
230
  SmarbsBackupDir.new("/etc/smarbs")
225
231
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smarbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Rueegg
@@ -9,9 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-21 00:00:00 +01:00
12
+ date: 2010-01-28 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyforge
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: gemcutter
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ version:
15
35
  - !ruby/object:Gem::Dependency
16
36
  name: hoe
17
37
  type: :development
@@ -20,7 +40,7 @@ dependencies:
20
40
  requirements:
21
41
  - - ">="
22
42
  - !ruby/object:Gem::Version
23
- version: 2.4.0
43
+ version: 2.5.0
24
44
  version:
25
45
  description: |-
26
46
  smarbs is a backup script written in ruby capable of doing intelligent and
@@ -81,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
101
  requirements:
82
102
  - - ">="
83
103
  - !ruby/object:Gem::Version
84
- version: "0"
104
+ version: 1.9.1
85
105
  version:
86
106
  required_rubygems_version: !ruby/object:Gem::Requirement
87
107
  requirements:
@@ -97,11 +117,11 @@ signing_key:
97
117
  specification_version: 3
98
118
  summary: smarbs is a backup script written in ruby capable of doing intelligent and automated backups using rsync.
99
119
  test_files:
100
- - test/test_backup.rb
120
+ - test/test_script.rb
121
+ - test/test_smarbs.rb
101
122
  - test/test_types.rb
123
+ - test/test_log.rb
102
124
  - test/test_suite.rb
103
- - test/test_smarbs.rb
104
125
  - test/test_smarbs_test.rb
105
- - test/test_log.rb
126
+ - test/test_backup.rb
106
127
  - test/test_helpers.rb
107
- - test/test_script.rb