paparazzi 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -2
- data/lib/paparazzi/camera.rb +5 -2
- data/lib/paparazzi/version.rb +1 -1
- data/test/source/test.exclude +1 -0
- data/test/unit/camera_test.rb +8 -3
- metadata +4 -2
data/README.md
CHANGED
@@ -30,8 +30,8 @@ Create a ruby script that you'll run hourly from a cron.
|
|
30
30
|
settings = {
|
31
31
|
:source => '/full/path/to/source/directory/', # note the trailing '/'
|
32
32
|
:destination => '/mnt/external_drive/backup_folder',
|
33
|
-
:rsync_flags => '-L'
|
34
|
-
}
|
33
|
+
:rsync_flags => '-L --exclude lost+found' # see 'man rsync' for available options.
|
34
|
+
} # Paparazzi sends '-aq --delete', plus whatever you add.
|
35
35
|
|
36
36
|
Paparazzi::Camera.trigger(settings)
|
37
37
|
|
data/lib/paparazzi/camera.rb
CHANGED
@@ -29,6 +29,9 @@ module Paparazzi
|
|
29
29
|
if REQUIRED_SETTINGS.include?(setting_name) and settings[setting_name].nil?
|
30
30
|
raise MissingSettingError, "#{setting_name} is required"
|
31
31
|
else
|
32
|
+
if setting_name == :rsync_flags
|
33
|
+
settings[setting_name] = settings[setting_name].split(/\s/)
|
34
|
+
end
|
32
35
|
self.send("#{setting_name}=",settings[setting_name])
|
33
36
|
end
|
34
37
|
end
|
@@ -80,10 +83,10 @@ module Paparazzi
|
|
80
83
|
FREQUENCIES.each do |frequency|
|
81
84
|
Dir.mkdir(current_snapshot(frequency)) unless File.exists?(current_snapshot(frequency))
|
82
85
|
if frequency == :hourly and previous_snapshot_name(frequency) == ''
|
83
|
-
system 'rsync', *(['-aq', '--delete'] +
|
86
|
+
system 'rsync', *(['-aq', '--delete'] + rsync_flags + [source, current_snapshot(frequency)])
|
84
87
|
self.last_successful_hourly_snapshot = current_snapshot_name(:hourly)
|
85
88
|
elsif previous_snapshot_name(frequency) != current_snapshot_name(frequency)
|
86
|
-
system 'rsync', *(['-aq', '--delete', "--link-dest=#{link_destination(frequency)}"] +
|
89
|
+
system 'rsync', *(['-aq', '--delete', "--link-dest=#{link_destination(frequency)}"] + rsync_flags + [source, current_snapshot(frequency)])
|
87
90
|
self.last_successful_hourly_snapshot = current_snapshot_name(:hourly)
|
88
91
|
end
|
89
92
|
end
|
data/lib/paparazzi/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
exclude me
|
data/test/unit/camera_test.rb
CHANGED
@@ -17,7 +17,7 @@ class CameraTest < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
def test_should_store_valid_settings_in_attr_accessors
|
19
19
|
Paparazzi::Camera.trigger(default_test_settings)
|
20
|
-
[:source,:destination
|
20
|
+
[:source,:destination].each do |setting_name|
|
21
21
|
assert_equal(default_test_settings[setting_name],Paparazzi::Camera.send(setting_name),setting_name)
|
22
22
|
end
|
23
23
|
end
|
@@ -93,6 +93,11 @@ class CameraTest < Test::Unit::TestCase
|
|
93
93
|
assert_equal(5,File.stat("#{destination}/hourly/#{Paparazzi::Camera.send(:current_snapshot_name,:hourly)}/test.txt").nlink)
|
94
94
|
end
|
95
95
|
|
96
|
+
def test_excluded_files_are_not_backed_up
|
97
|
+
Paparazzi::Camera.trigger(default_test_settings)
|
98
|
+
assert(!File.exists?("#{destination}/hourly/#{Paparazzi::Camera.send(:current_snapshot_name,:hourly)}/test.exclude"))
|
99
|
+
end
|
100
|
+
|
96
101
|
#######
|
97
102
|
private
|
98
103
|
#######
|
@@ -102,10 +107,10 @@ class CameraTest < Test::Unit::TestCase
|
|
102
107
|
end
|
103
108
|
|
104
109
|
def default_test_settings
|
105
|
-
|
110
|
+
{
|
106
111
|
:source => "#{File.expand_path('../../source', __FILE__)}/",
|
107
112
|
:destination => destination,
|
108
|
-
:rsync_flags => '-L'
|
113
|
+
:rsync_flags => '-L --exclude test.exclude'
|
109
114
|
}
|
110
115
|
end
|
111
116
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jonathan S. Garvin
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/paparazzi/version.rb
|
52
52
|
- paparazzi.gemspec
|
53
53
|
- test/destination/.gitignore
|
54
|
+
- test/source/test.exclude
|
54
55
|
- test/source/test.txt
|
55
56
|
- test/unit/camera_test.rb
|
56
57
|
has_rdoc: true
|
@@ -87,5 +88,6 @@ specification_version: 3
|
|
87
88
|
summary: Rsync backup library with incremental snapshots.
|
88
89
|
test_files:
|
89
90
|
- test/destination/.gitignore
|
91
|
+
- test/source/test.exclude
|
90
92
|
- test/source/test.txt
|
91
93
|
- test/unit/camera_test.rb
|