dropbox-folder-sync 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/Rakefile +10 -0
- data/dropbox-folder-sync.gemspec +1 -0
- data/lib/dropbox-folder-sync/app.rb +15 -8
- data/lib/dropbox-folder-sync/cli.rb +6 -0
- data/lib/dropbox-folder-sync/version.rb +1 -1
- metadata +19 -4
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -1,2 +1,12 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/testtask'
|
6
|
+
Rake::TestTask.new(:test) do |test|
|
7
|
+
test.libs << 'lib' << 'test'
|
8
|
+
test.pattern = 'test/**/test_*.rb'
|
9
|
+
test.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => :test
|
data/dropbox-folder-sync.gemspec
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'dropbox_sdk'
|
5
5
|
require 'launchy'
|
6
6
|
require 'keystorage'
|
7
|
+
require 'json'
|
7
8
|
|
8
9
|
class DropboxFolderSync::App
|
9
10
|
APP_KEY = ENV['DROPBOX_FOLDER_SYNC_APP_KEY']
|
@@ -16,6 +17,15 @@ class DropboxFolderSync::App
|
|
16
17
|
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
17
18
|
end
|
18
19
|
|
20
|
+
def json name
|
21
|
+
req_key = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name)
|
22
|
+
req_secret = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name)
|
23
|
+
key = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_USER_KEY",name)
|
24
|
+
secret = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_USER_SECRET",name)
|
25
|
+
h = {:name => name, :req_key =>req_key, :req_secret =>req_secret, :key =>key, :secret =>secret}
|
26
|
+
puts h.to_json
|
27
|
+
end
|
28
|
+
|
19
29
|
def login name
|
20
30
|
key = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_USER_KEY",name)
|
21
31
|
secret = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_USER_SECRET",name)
|
@@ -39,20 +49,12 @@ class DropboxFolderSync::App
|
|
39
49
|
end
|
40
50
|
end
|
41
51
|
|
42
|
-
|
43
52
|
@session.get_request_token
|
44
53
|
authorize_url = @session.get_authorize_url
|
45
54
|
log "Login: [#{name}] ---> #{authorize_url}"
|
46
55
|
Launchy.open authorize_url
|
47
56
|
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name,@session.request_token.key.to_s)
|
48
57
|
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name,@session.request_token.secret.to_s)
|
49
|
-
|
50
|
-
#while 1
|
51
|
-
# @session.get_access_token rescue {}
|
52
|
-
# break if @session.authorized?
|
53
|
-
# sleep 1
|
54
|
-
#end
|
55
|
-
#true
|
56
58
|
end
|
57
59
|
|
58
60
|
def logout name
|
@@ -199,6 +201,11 @@ class DropboxFolderSync::App
|
|
199
201
|
def logout name
|
200
202
|
new.logout(name)
|
201
203
|
end
|
204
|
+
|
205
|
+
def json name
|
206
|
+
new.json name
|
207
|
+
end
|
208
|
+
|
202
209
|
end
|
203
210
|
|
204
211
|
end
|
@@ -20,6 +20,12 @@ class DropboxFolderSync::CLI < Thor
|
|
20
20
|
def sync remote,local
|
21
21
|
DropboxFolderSync::App.sync(remote,local,options)
|
22
22
|
end
|
23
|
+
|
24
|
+
desc 'json [NAME]', "Output scedentials in json fomat."
|
25
|
+
def json name = "default"
|
26
|
+
DropboxFolderSync::App.json name
|
27
|
+
end
|
28
|
+
|
23
29
|
end
|
24
30
|
|
25
31
|
if $0 == __FILE__
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropbox-folder-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yoshihiro TAKAHARA
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -101,6 +101,20 @@ dependencies:
|
|
101
101
|
type: :runtime
|
102
102
|
prerelease: false
|
103
103
|
requirement: *id006
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
name: json
|
115
|
+
type: :runtime
|
116
|
+
prerelease: false
|
117
|
+
requirement: *id007
|
104
118
|
description: Sync Dropbox folder with local directory
|
105
119
|
email:
|
106
120
|
- y.takahara@gmail.com
|
@@ -112,6 +126,7 @@ extra_rdoc_files: []
|
|
112
126
|
|
113
127
|
files:
|
114
128
|
- .gitignore
|
129
|
+
- .travis.yml
|
115
130
|
- Gemfile
|
116
131
|
- LICENSE
|
117
132
|
- README.md
|