dbox 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.6.5 / 2012-02-03
2
+ * Bug Fixes
3
+ * Fixed issue with threads continuing after Dbox crashes when using Ruby API.
4
+
1
5
  == 0.6.4 / 2011-11-29
2
6
  * Minor Enhancements
3
7
  * Removed workaround for /put_files API bug, as Dropbox has fixed it.
data/README.md CHANGED
@@ -11,7 +11,7 @@ $ dbox clone Public
11
11
  $ cd Public
12
12
  $ echo "Hello World" > hello.txt
13
13
  $ dbox sync
14
- [INFO] Uploading /Public/hello2.txt
14
+ [INFO] Uploading /Public/hello.txt
15
15
  ```
16
16
 
17
17
  **IMPORTANT:** This is **not** an automated Dropbox client. It will exit after sucessfully pushing/pulling, so if you want regular updates, you can run it in cron, a loop, etc. If you do want to run it in a loop, take a look at [sample_polling_script.rb](http://github.com/kenpratt/dbox/blob/master/sample_polling_script.rb). You get deterministic control over what you want Dropbox to do and when you want it to happen.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.4
1
+ 0.6.5
data/dbox.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dbox"
8
- s.version = "0.6.4"
8
+ s.version = "0.6.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ken Pratt"]
12
- s.date = "2011-11-29"
12
+ s.date = "2012-02-03"
13
13
  s.description = "An easy-to-use Dropbox client with fine-grained control over syncs."
14
14
  s.email = "ken@kenpratt.net"
15
15
  s.executables = ["dbox"]
data/lib/dbox/database.rb CHANGED
@@ -319,7 +319,7 @@ module Dbox
319
319
  end
320
320
 
321
321
  def update_entry(where_clause, fields)
322
- log.debug "Updating entry: #{where_clause}, #{fields.inspect}"
322
+ log.debug "Updating entry: #{where_clause.inspect}, #{fields.inspect}"
323
323
  h = fields.clone
324
324
  h[:modified] = h[:modified].to_i if h[:modified]
325
325
  conditions, *args = *where_clause
@@ -51,7 +51,14 @@ class ParallelTasks
51
51
  end
52
52
  end
53
53
  end
54
- task.call if task
54
+ if task
55
+ begin
56
+ task.call
57
+ rescue Exception => e
58
+ log.error e.inspect
59
+ task.call
60
+ end
61
+ end
55
62
  end
56
63
  end
57
64
  end
data/lib/dbox/syncer.rb CHANGED
@@ -208,7 +208,7 @@ module Dbox
208
208
  changelist[:conflicts] ||= []
209
209
  changelist[:conflicts] << res[1]
210
210
  end
211
- rescue Dbox::ServerError => e
211
+ rescue Exception => e
212
212
  log.error "Error while downloading #{c[:path]}: #{e.inspect}"
213
213
  parent_ids_of_failed_entries << c[:parent_id]
214
214
  changelist[:failed] << { :operation => :create, :path => c[:path], :error => e }
@@ -231,7 +231,7 @@ module Dbox
231
231
  changelist[:conflicts] ||= []
232
232
  changelist[:conflicts] << res[1]
233
233
  end
234
- rescue Dbox::ServerError => e
234
+ rescue Exception => e
235
235
  log.error "Error while downloading #{c[:path]}: #{e.inspect}"
236
236
  parent_ids_of_failed_entries << c[:parent_id]
237
237
  changelist[:failed] << { :operation => :create, :path => c[:path], :error => e }
@@ -320,8 +320,12 @@ module Dbox
320
320
  # recursively process new & existing subdirectories in parallel
321
321
  threads = recur_dirs.map do |operation, dir|
322
322
  Thread.new do
323
- clone_api_into_current_thread()
324
- Thread.current[:out] = calculate_changes(dir, operation)
323
+ begin
324
+ clone_api_into_current_thread()
325
+ Thread.current[:out] = calculate_changes(dir, operation)
326
+ rescue Exception => e
327
+ log.error "Error while caclulating changes #{dir}: #{operation}"
328
+ end
325
329
  end
326
330
  end
327
331
  threads.each {|t| t.join; out += t[:out] }
@@ -467,7 +471,7 @@ module Dbox
467
471
  changelist[:conflicts] ||= []
468
472
  changelist[:conflicts] << { :original => c[:path], :renamed => res[:path] }
469
473
  end
470
- rescue Dbox::ServerError => e
474
+ rescue Exception => e
471
475
  log.error "Error while uploading #{c[:path]}: #{e.inspect}"
472
476
  changelist[:failed] << { :operation => :create, :path => c[:path], :error => e }
473
477
  end
@@ -496,7 +500,7 @@ module Dbox
496
500
  changelist[:conflicts] ||= []
497
501
  changelist[:conflicts] << { :original => c[:path], :renamed => res[:path] }
498
502
  end
499
- rescue Dbox::ServerError => e
503
+ rescue Exception => e
500
504
  log.error "Error while uploading #{c[:path]}: #{e.inspect}"
501
505
  changelist[:failed] << { :operation => :update, :path => c[:path], :error => e }
502
506
  end
@@ -517,7 +521,7 @@ module Dbox
517
521
  end
518
522
  database.delete_entry_by_path(c[:path])
519
523
  changelist[:deleted] << c[:path]
520
- rescue Dbox::ServerError => e
524
+ rescue Exception => e
521
525
  log.error "Error while deleting #{c[:path]}: #{e.inspect}"
522
526
  changelist[:failed] << { :operation => :delete, :path => c[:path], :error => e }
523
527
  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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 4
10
- version: 0.6.4
9
+ - 5
10
+ version: 0.6.5
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-11-29 00:00:00 Z
18
+ date: 2012-02-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: multipart-post