dbox 0.4.0 → 0.4.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 +6 -0
- data/VERSION +1 -1
- data/dbox.gemspec +2 -2
- data/lib/dbox/api.rb +0 -2
- data/lib/dbox/db.rb +14 -11
- data/lib/dbox.rb +5 -0
- data/spec/dbox_spec.rb +17 -0
- metadata +4 -4
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/dbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dbox}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Ken Pratt}]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-17}
|
13
13
|
s.description = %q{An easy-to-use Dropbox client with fine-grained control over syncs.}
|
14
14
|
s.email = %q{ken@kenpratt.net}
|
15
15
|
s.executables = [%q{dbox}]
|
data/lib/dbox/api.rb
CHANGED
data/lib/dbox/db.rb
CHANGED
@@ -22,17 +22,6 @@ module Dbox
|
|
22
22
|
db.pull
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.load(local_path)
|
26
|
-
db_file = db_file(local_path)
|
27
|
-
if File.exists?(db_file)
|
28
|
-
db = File.open(db_file, "r") {|f| YAML::load(f.read) }
|
29
|
-
db.local_path = local_path
|
30
|
-
db
|
31
|
-
else
|
32
|
-
raise MissingDatabase, "No DB file found in #{local_path}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
25
|
def self.pull(local_path)
|
37
26
|
load(local_path).pull
|
38
27
|
end
|
@@ -45,6 +34,20 @@ module Dbox
|
|
45
34
|
load(local_path).move(new_remote_path)
|
46
35
|
end
|
47
36
|
|
37
|
+
def self.exists?(local_path)
|
38
|
+
File.exists?(db_file(local_path))
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.load(local_path)
|
42
|
+
if exists?(local_path)
|
43
|
+
db = File.open(db_file(local_path), "r") {|f| YAML::load(f.read) }
|
44
|
+
db.local_path = local_path
|
45
|
+
db
|
46
|
+
else
|
47
|
+
raise MissingDatabase, "No DB file found in #{local_path}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
48
51
|
# IMPORTANT: DropboxDb.new is private. Please use DropboxDb.create, DropboxDb.clone, or DropboxDb.load as the entry point.
|
49
52
|
private_class_method :new
|
50
53
|
def initialize(local_path, res)
|
data/lib/dbox.rb
CHANGED
data/spec/dbox_spec.rb
CHANGED
@@ -208,4 +208,21 @@ describe Dbox do
|
|
208
208
|
expect { Dbox.move(@new_remote, @local) }.to raise_error(Dbox::RemoteAlreadyExists)
|
209
209
|
end
|
210
210
|
end
|
211
|
+
|
212
|
+
describe "#exists?" do
|
213
|
+
it "should be false if the local dir is missing" do
|
214
|
+
Dbox.exists?(@local).should be_false
|
215
|
+
end
|
216
|
+
|
217
|
+
it "should be true if the dir exists" do
|
218
|
+
Dbox.create(@remote, @local)
|
219
|
+
Dbox.exists?(@local).should be_true
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should be false if the dir exists but is missing a .dropbox.db file" do
|
223
|
+
Dbox.create(@remote, @local)
|
224
|
+
rm "#{@local}/.dropbox.db"
|
225
|
+
Dbox.exists?(@local).should be_false
|
226
|
+
end
|
227
|
+
end
|
211
228
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ken Pratt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-17 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: An easy-to-use Dropbox client with fine-grained control over syncs.
|