cfbackup 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +4 -0
- data/VERSION.yml +2 -2
- data/cfbackup.gemspec +6 -5
- data/lib/cfbackup.rb +2 -1
- data/test/cfbackup_test.rb +45 -9
- data/test/data/cwd_bug_17/bug_17.txt +5 -0
- metadata +54 -21
data/CHANGELOG.markdown
CHANGED
data/VERSION.yml
CHANGED
data/cfbackup.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cfbackup}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jon Stacey"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-07-19}
|
13
13
|
s.default_executable = %q{cfbackup}
|
14
14
|
s.description = %q{A simple ruby program intended to serve as a useful tool for automated backups to Mosso Cloud Files.}
|
15
15
|
s.email = %q{jon@jonsview.com}
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
"temp/README",
|
37
37
|
"test/cfbackup_test.rb",
|
38
38
|
"test/cfconfig.yml",
|
39
|
+
"test/data/cwd_bug_17/bug_17.txt",
|
39
40
|
"test/data/data.txt",
|
40
41
|
"test/data/folder_1/file1.txt",
|
41
42
|
"test/data/folder_1/file2.txt",
|
@@ -47,7 +48,7 @@ Gem::Specification.new do |s|
|
|
47
48
|
s.homepage = %q{http://github.com/jmstacey/cfbackup}
|
48
49
|
s.rdoc_options = ["--charset=UTF-8"]
|
49
50
|
s.require_paths = ["lib"]
|
50
|
-
s.rubygems_version = %q{1.3.
|
51
|
+
s.rubygems_version = %q{1.3.7}
|
51
52
|
s.summary = %q{A simple ruby program intended to serve as a useful tool for automated backups to Mosso Cloud Files.}
|
52
53
|
s.test_files = [
|
53
54
|
"test/cfbackup_test.rb",
|
@@ -58,7 +59,7 @@ Gem::Specification.new do |s|
|
|
58
59
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
59
60
|
s.specification_version = 3
|
60
61
|
|
61
|
-
if Gem::Version.new(Gem::
|
62
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
63
|
s.add_runtime_dependency(%q<cloudfiles>, [">= 1.4.4"])
|
63
64
|
s.add_runtime_dependency(%q<gemcutter>, [">= 0.1.0"])
|
64
65
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
data/lib/cfbackup.rb
CHANGED
@@ -182,7 +182,8 @@ class CFBackup
|
|
182
182
|
pwd = Dir.getwd # Save current directory so we can come back
|
183
183
|
|
184
184
|
if FileTest::file?(path)
|
185
|
-
|
185
|
+
Dir.chdir(File.dirname(path))
|
186
|
+
glob_options = File.basename(path)
|
186
187
|
elsif @opts.options.recursive
|
187
188
|
Dir.chdir(path)
|
188
189
|
glob_options = File.join("**", "*")
|
data/test/cfbackup_test.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
|
+
# todo: finish bug 17 tests
|
6
|
+
# Assert everything by creating a Cloudfiles object and verifying file
|
7
|
+
# integrity
|
8
|
+
|
5
9
|
# CFBackup test class
|
6
10
|
class CfbackupTest < Test::Unit::TestCase
|
7
11
|
TEST_DIR = 'test/tmp' # Test directory
|
@@ -55,6 +59,25 @@ class CfbackupTest < Test::Unit::TestCase
|
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
62
|
+
context "with a single file push not in CWD [Bug #17]" do
|
63
|
+
setup do
|
64
|
+
File.copy('test/data/cwd_bug_17/bug_17.txt', '/tmp/cfbackup_bug_17.txt')
|
65
|
+
assert File.exist?('/tmp/cfbackup_bug_17.txt')
|
66
|
+
|
67
|
+
mock_ARGV = ['--action', 'push', '--local_path', '/tmp/cfbackup_bug_17.txt', '--container', 'test', '--config_file', 'test/cfconfig.yml', '-v']
|
68
|
+
@backup = CFBackup.new(mock_ARGV)
|
69
|
+
end
|
70
|
+
|
71
|
+
should "return true when file sucessfully sent" do
|
72
|
+
assert @backup.run
|
73
|
+
end
|
74
|
+
|
75
|
+
# should "result in file being pushed" do
|
76
|
+
# # Assert file uploaded
|
77
|
+
# end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
58
81
|
context "with a recursive directory push" do
|
59
82
|
setup do
|
60
83
|
mock_ARGV = ['--action', 'push', '-r', '--local_path', 'test/data', '--container', 'test', '--config_file', 'test/cfconfig.yml', '-v']
|
@@ -82,23 +105,36 @@ class CfbackupTest < Test::Unit::TestCase
|
|
82
105
|
@backup = CFBackup.new(mock_ARGV)
|
83
106
|
end
|
84
107
|
|
85
|
-
should "return true
|
108
|
+
should "return true and cause the file to exist" do
|
86
109
|
assert @backup.run
|
110
|
+
assert File.exist?(filepath)
|
87
111
|
end
|
88
112
|
|
89
|
-
# I don't know why this doesn't work. It's like File is caching results
|
90
|
-
# and not updating until the applicaiton exists. Overcoming by
|
91
|
-
# asserting the file deletion during teardown at the loss of shoulda
|
92
|
-
#
|
93
|
-
# should "result in test/tmp/#{file} existing" do
|
94
|
-
# assert File.exist?(filepath)
|
95
|
-
# end
|
96
|
-
|
97
113
|
teardown do
|
98
114
|
assert File.delete(filepath)
|
99
115
|
end
|
100
116
|
end
|
101
117
|
|
118
|
+
context "with a single file pull not in CWD [Bug #17]" do
|
119
|
+
file = 'folder_1/folder_3/file1.txt';
|
120
|
+
filepath = File.join(TEST_DIR, File::basename(file))
|
121
|
+
|
122
|
+
setup do
|
123
|
+
mock_ARGV = ['--action', 'pull', '--container', "test:#{file}", '--local_path', "#{filepath}", '--config_file', 'test/cfconfig.yml', '-v']
|
124
|
+
@backup = CFBackup.new(mock_ARGV)
|
125
|
+
end
|
126
|
+
|
127
|
+
should "return true and cause the file to exist" do
|
128
|
+
assert @backup.run
|
129
|
+
assert File.exist?(filepath)
|
130
|
+
end
|
131
|
+
|
132
|
+
teardown do
|
133
|
+
assert File.delete(filepath)
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
102
138
|
context "with a recursive pull" do
|
103
139
|
setup do
|
104
140
|
mock_ARGV = ['--action', 'pull', '--container', "test", '--local_path', "test/tmp", '--config_file', 'test/cfconfig.yml', '-v']
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfbackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 61
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 8
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jon Stacey
|
@@ -9,49 +15,69 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-07-19 00:00:00 -05:00
|
13
19
|
default_executable: cfbackup
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: cloudfiles
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
- 4
|
23
34
|
version: 1.4.4
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: gemcutter
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 1
|
49
|
+
- 0
|
33
50
|
version: 0.1.0
|
34
|
-
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
35
53
|
- !ruby/object:Gem::Dependency
|
36
54
|
name: shoulda
|
37
|
-
|
38
|
-
|
39
|
-
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
40
58
|
requirements:
|
41
59
|
- - ">="
|
42
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
43
64
|
version: "0"
|
44
|
-
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
45
67
|
- !ruby/object:Gem::Dependency
|
46
68
|
name: mocha
|
47
|
-
|
48
|
-
|
49
|
-
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
50
72
|
requirements:
|
51
73
|
- - ">="
|
52
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
53
78
|
version: "0"
|
54
|
-
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id004
|
55
81
|
description: A simple ruby program intended to serve as a useful tool for automated backups to Mosso Cloud Files.
|
56
82
|
email: jon@jonsview.com
|
57
83
|
executables:
|
@@ -79,6 +105,7 @@ files:
|
|
79
105
|
- temp/README
|
80
106
|
- test/cfbackup_test.rb
|
81
107
|
- test/cfconfig.yml
|
108
|
+
- test/data/cwd_bug_17/bug_17.txt
|
82
109
|
- test/data/data.txt
|
83
110
|
- test/data/folder_1/file1.txt
|
84
111
|
- test/data/folder_1/file2.txt
|
@@ -96,21 +123,27 @@ rdoc_options:
|
|
96
123
|
require_paths:
|
97
124
|
- lib
|
98
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
99
127
|
requirements:
|
100
128
|
- - ">="
|
101
129
|
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
102
133
|
version: "0"
|
103
|
-
version:
|
104
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
105
136
|
requirements:
|
106
137
|
- - ">="
|
107
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
140
|
+
segments:
|
141
|
+
- 0
|
108
142
|
version: "0"
|
109
|
-
version:
|
110
143
|
requirements: []
|
111
144
|
|
112
145
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.3.
|
146
|
+
rubygems_version: 1.3.7
|
114
147
|
signing_key:
|
115
148
|
specification_version: 3
|
116
149
|
summary: A simple ruby program intended to serve as a useful tool for automated backups to Mosso Cloud Files.
|