ochibako_share 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ochibako-share +10 -12
- data/bin/ochibako-share-auth +24 -26
- data/lib/ochibako_share.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd3a14f1ef6262060be9393d3bcee5aa0ad2ef23
|
4
|
+
data.tar.gz: e0b3dc1a0485f12ada430c852c875ac5003d5c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 268c500e252778d87513c33ba7538fc70e714fd8d9026f500fd03aef724c919008ec98ae53741d47675a0bf71b226d014f7fe758ed5562124d8064f240b56012
|
7
|
+
data.tar.gz: 162b9927ed8bdcedde558389f65fa331d05e4d628d1731a5708a9bc20cb5d99a74050d2d5791a09581072c16b99bf3d511995b313eebf491d4b6b548393ff775
|
data/bin/ochibako-share
CHANGED
@@ -3,20 +3,18 @@
|
|
3
3
|
# This will upload your file into the App folder
|
4
4
|
require 'ochibako_share'
|
5
5
|
|
6
|
-
|
7
|
-
include OchibakoShare
|
6
|
+
include OchibakoShare
|
8
7
|
|
9
|
-
|
8
|
+
load ACCESS_TOKEN_FILE
|
10
9
|
|
11
|
-
|
10
|
+
client = DropboxClient.new(ACCESS_TOKEN)
|
12
11
|
|
13
|
-
|
12
|
+
$stderr.puts "Uploading files to DropBox as #{client.account_info['email']}"
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
14
|
+
ARGV.each do |src|
|
15
|
+
$stderr.print "#{src} -> "
|
16
|
+
dst = File.basename(src)
|
17
|
+
result = client.put_file(dst, File.read(src))
|
18
|
+
shares = client.shares(dst)
|
19
|
+
$stderr.puts "\n" + db_download_url(follow_url(shares['url']))
|
22
20
|
end
|
data/bin/ochibako-share-auth
CHANGED
@@ -3,34 +3,32 @@
|
|
3
3
|
# https://www.dropbox.com/developers/core/start/ruby
|
4
4
|
require 'ochibako_share'
|
5
5
|
|
6
|
-
|
7
|
-
include OchibakoShare
|
6
|
+
include OchibakoShare
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
flow = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET)
|
17
|
-
authorize_url = flow.start()
|
18
|
-
$stderr.puts 'Go to the following URL, Click "Allow", and Copy the authorization code.'
|
19
|
-
$stderr.puts authorize_url
|
20
|
-
$stderr.print 'Authorization code: '
|
21
|
-
code = gets.strip
|
8
|
+
begin
|
9
|
+
load APP_KEY_FILE
|
10
|
+
rescue LoadError => err
|
11
|
+
$stderr.puts "Create #{app_key_file} following README.md:\n#{err.message}"
|
12
|
+
exit 1
|
13
|
+
end
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
flow = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET)
|
16
|
+
authorize_url = flow.start()
|
17
|
+
$stderr.puts 'Go to the following URL, Click "Allow", and Copy the authorization code.'
|
18
|
+
$stderr.puts authorize_url
|
19
|
+
$stderr.print 'Authorization code: '
|
20
|
+
code = gets.strip
|
29
21
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
22
|
+
begin
|
23
|
+
access_token, user_id = flow.finish(code)
|
24
|
+
rescue DropboxError => err
|
25
|
+
$stderr.puts "Invalid authorization code: #{code.inspect}"
|
26
|
+
exit 1
|
27
|
+
end
|
34
28
|
|
35
|
-
|
29
|
+
File.open(ACCESS_TOKEN_FILE, "w", 0600) do |f|
|
30
|
+
f.puts "#user_id: #{user_id}"
|
31
|
+
f.puts "ACCESS_TOKEN = #{access_token.dump}"
|
36
32
|
end
|
33
|
+
|
34
|
+
$stderr.puts "Access token is stored in: #{ACCESS_TOKEN_FILE}"
|
data/lib/ochibako_share.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ochibako_share
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zunda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dropbox-sdk
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
27
|
description: A Ruby CLI client to upload files to your Dropbox and obtain URL to share
|
@@ -35,10 +35,10 @@ extra_rdoc_files:
|
|
35
35
|
- README.md
|
36
36
|
- license.md
|
37
37
|
files:
|
38
|
-
-
|
38
|
+
- lib/ochibako_share.rb
|
39
39
|
- bin/ochibako-share
|
40
40
|
- bin/ochibako-share-auth
|
41
|
-
-
|
41
|
+
- README.md
|
42
42
|
- license.md
|
43
43
|
homepage: https://github.com/zunda/ochibako-share#readme
|
44
44
|
licenses:
|
@@ -50,17 +50,17 @@ require_paths:
|
|
50
50
|
- lib
|
51
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
63
|
+
rubygems_version: 2.0.14
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: A CLI client for uploading and sharing files
|