ochibako_share 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0e3908ff0dfacff123baddd47b6c0dc5a33a013
4
- data.tar.gz: 471bcbaf46b5706d9aa93289387308229d951ec7
3
+ metadata.gz: dd3a14f1ef6262060be9393d3bcee5aa0ad2ef23
4
+ data.tar.gz: e0b3dc1a0485f12ada430c852c875ac5003d5c40
5
5
  SHA512:
6
- metadata.gz: 6b187a337dd83ba674dc422843dcd2a23672d8bf6f60f084eb650723695086e8fa6b77a5282b48d93bce6892efdb87c99e2b3cbec15a7263923e3049cf3d202e
7
- data.tar.gz: 01e015e191a2b458707af1c1da864b8943e5e63812bd2bcfab534d7c5f298acc3ccc57e904930e32d191d530001cd98019dff1250d8a8b534817f91ee483b5a8
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
- if __FILE__ == $0
7
- include OchibakoShare
6
+ include OchibakoShare
8
7
 
9
- load ACCESS_TOKEN_FILE
8
+ load ACCESS_TOKEN_FILE
10
9
 
11
- client = DropboxClient.new(ACCESS_TOKEN)
10
+ client = DropboxClient.new(ACCESS_TOKEN)
12
11
 
13
- $stderr.puts "Uploading files to DropBox as #{client.account_info['email']}"
12
+ $stderr.puts "Uploading files to DropBox as #{client.account_info['email']}"
14
13
 
15
- ARGV.each do |src|
16
- $stderr.print "#{src} -> "
17
- dst = File.basename(src)
18
- result = client.put_file(dst, File.read(src))
19
- shares = client.shares(dst)
20
- $stderr.puts "\n" + db_download_url(follow_url(shares['url']))
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
@@ -3,34 +3,32 @@
3
3
  # https://www.dropbox.com/developers/core/start/ruby
4
4
  require 'ochibako_share'
5
5
 
6
- if __FILE__ == $0
7
- include OchibakoShare
6
+ include OchibakoShare
8
7
 
9
- begin
10
- load APP_KEY_FILE
11
- rescue LoadError => err
12
- $stderr.puts "Create #{app_key_file} following README.md:\n#{err.message}"
13
- exit 1
14
- end
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
- begin
24
- access_token, user_id = flow.finish(code)
25
- rescue DropboxError => err
26
- $stderr.puts "Invalid authorization code: #{code.inspect}"
27
- exit 1
28
- end
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
- File.open(ACCESS_TOKEN_FILE, "w", 0600) do |f|
31
- f.puts "#user_id: #{user_id}"
32
- f.puts "ACCESS_TOKEN = #{access_token.dump}"
33
- end
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
- $stderr.puts "Access token is stored in: #{ACCESS_TOKEN_FILE}"
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}"
@@ -5,7 +5,7 @@ require 'net/http'
5
5
  require 'uri'
6
6
 
7
7
  module OchibakoShare
8
- VERSION = '0.1.4'
8
+ VERSION = '0.1.5'
9
9
  APP_KEY_FILE = File.expand_path('~/.ochibako-share-app')
10
10
  ACCESS_TOKEN_FILE = File.expand_path('~/.ochibako-share-auth')
11
11
 
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
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-08 00:00:00.000000000 Z
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
- - README.md
38
+ - lib/ochibako_share.rb
39
39
  - bin/ochibako-share
40
40
  - bin/ochibako-share-auth
41
- - lib/ochibako_share.rb
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.4.5
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