osdn-cli 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 +4 -4
- data/ChangeLog +5 -0
- data/lib/osdn/cli.rb +12 -3
- data/lib/osdn/cli/command/frs_upload.rb +5 -0
- data/lib/osdn/cli/command/relfile.rb +5 -0
- data/lib/osdn/cli/overrides.rb +8 -1
- data/lib/osdn/cli/runner.rb +1 -0
- data/lib/osdn/cli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661a7bc947152bf778ac0fa53730e720ca9ea2d6
|
4
|
+
data.tar.gz: 11e3150a71086335a9f24af05d25319d2c74e3ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da57715c805c083613bab7d34c09078f89128b7ff3abe3ac208a8ea9023d1f29d2ff314c4b5c067bd043c79d15ac2a7cc9f5973c49fbdd9cc536ca33b0bf6e9
|
7
|
+
data.tar.gz: bb29906480917dfe61582fccc9623cea8a8897a62694bf772cda235324cc7e79af60e567a621df5c5ddc23703b24453732d98f86faae3c5cafa1f3296506fb8f
|
data/ChangeLog
CHANGED
data/lib/osdn/cli.rb
CHANGED
@@ -30,8 +30,17 @@ module OSDN
|
|
30
30
|
@@_show_progress = v
|
31
31
|
end
|
32
32
|
|
33
|
+
@@_rate_limit = nil
|
34
|
+
def _rate_limit
|
35
|
+
@@_rate_limit
|
36
|
+
end
|
37
|
+
def _rate_limit=(v)
|
38
|
+
@@_rate_limit = v
|
39
|
+
end
|
40
|
+
|
33
41
|
module_function :client_id, :client_secret,
|
34
|
-
:_show_progress, :_show_progress
|
42
|
+
:_show_progress, :_show_progress=,
|
43
|
+
:_rate_limit, :_rate_limit=
|
35
44
|
|
36
45
|
module Command
|
37
46
|
autoload :Login, 'osdn/cli/command/login'
|
@@ -92,7 +101,7 @@ module OSDN
|
|
92
101
|
return
|
93
102
|
end
|
94
103
|
|
95
|
-
logger.debug "Access token has been expired.
|
104
|
+
logger.debug "Access token has been expired. Trying to refresh token..."
|
96
105
|
api = OSDNClient::DefaultApi.new
|
97
106
|
begin
|
98
107
|
set_credential api.token(CLI.client_id, CLI.client_secret, grant_type: 'refresh_token', refresh_token: credential.refresh_token)
|
@@ -106,7 +115,7 @@ module OSDN
|
|
106
115
|
logger.fatal "Please login again."
|
107
116
|
return
|
108
117
|
end
|
109
|
-
logger.debug "Access token refreshed successfully."
|
118
|
+
logger.debug "Access token is refreshed successfully."
|
110
119
|
end
|
111
120
|
|
112
121
|
def set_credential(token, update_expires = true)
|
@@ -12,6 +12,7 @@ module OSDN; module CLI; module Command
|
|
12
12
|
puts " --force-digest Calc local file digest forcely"
|
13
13
|
puts " --progress Force to show upload progress"
|
14
14
|
puts " --no-progress Force to hide upload progress"
|
15
|
+
puts " --bwlimit=RATE Limit bandwidth (in KB)"
|
15
16
|
end
|
16
17
|
|
17
18
|
def run
|
@@ -25,6 +26,7 @@ module OSDN; module CLI; module Command
|
|
25
26
|
[ '--force-digest', GetoptLong::NO_ARGUMENT],
|
26
27
|
[ '--progress', GetoptLong::NO_ARGUMENT],
|
27
28
|
[ '--no-progress', GetoptLong::NO_ARGUMENT],
|
29
|
+
[ '--bwlimit', GetoptLong::REQUIRED_ARGUMENT ],
|
28
30
|
)
|
29
31
|
opts.each do |opt, arg|
|
30
32
|
case opt
|
@@ -51,6 +53,9 @@ module OSDN; module CLI; module Command
|
|
51
53
|
@show_progress = true
|
52
54
|
when '--no-progress'
|
53
55
|
@show_progress = false
|
56
|
+
when '--bwlimit'
|
57
|
+
arg.to_i != 0 and
|
58
|
+
OSDN::CLI._rate_limit = arg.to_i * 1024
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
@@ -17,6 +17,7 @@ module OSDN; module CLI; module Command
|
|
17
17
|
puts " --force-digest Calc local file digest forcely"
|
18
18
|
puts " --progress Force to show upload progress"
|
19
19
|
puts " --no-progress Force to hide upload progress"
|
20
|
+
puts " --bwlimit=RATE Limit bandwidth (in KB)"
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.description
|
@@ -33,6 +34,7 @@ module OSDN; module CLI; module Command
|
|
33
34
|
[ '--force-digest', GetoptLong::NO_ARGUMENT],
|
34
35
|
[ '--progress', GetoptLong::NO_ARGUMENT],
|
35
36
|
[ '--no-progress', GetoptLong::NO_ARGUMENT],
|
37
|
+
[ '--bwlimit', GetoptLong::REQUIRED_ARGUMENT ],
|
36
38
|
)
|
37
39
|
opts.each do |opt, arg|
|
38
40
|
case opt
|
@@ -60,6 +62,9 @@ module OSDN; module CLI; module Command
|
|
60
62
|
@show_progress = true
|
61
63
|
when '--no-progress'
|
62
64
|
@show_progress = false
|
65
|
+
when '--bwlimit'
|
66
|
+
arg.to_i != 0 and
|
67
|
+
OSDN::CLI._rate_limit = arg.to_i * 1024
|
63
68
|
end
|
64
69
|
end
|
65
70
|
end
|
data/lib/osdn/cli/overrides.rb
CHANGED
@@ -5,6 +5,7 @@ module Typhoeus
|
|
5
5
|
alias_method :get_orig, :get
|
6
6
|
def get(*args)
|
7
7
|
easy = get_orig(*args)
|
8
|
+
|
8
9
|
if ENV['CURL_CA_BUNDLE']
|
9
10
|
Ethon::Curl.set_option(:cainfo, ENV['CURL_CA_BUNDLE'], easy.handle)
|
10
11
|
else
|
@@ -21,12 +22,18 @@ module Typhoeus
|
|
21
22
|
Ethon::Curl.set_option(:cainfo, ca, easy.handle)
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
24
26
|
if OSDN::CLI._show_progress
|
25
27
|
Ethon::Curl.set_option(:noprogress, false, easy.handle)
|
26
|
-
|
27
28
|
else
|
28
29
|
Ethon::Curl.set_option(:noprogress, true, easy.handle)
|
29
30
|
end
|
31
|
+
|
32
|
+
if OSDN::CLI._rate_limit
|
33
|
+
Ethon::Curl.set_option(:max_send_speed_large, OSDN::CLI._rate_limit, easy.handle)
|
34
|
+
Ethon::Curl.set_option(:max_recv_speed_large, OSDN::CLI._rate_limit, easy.handle)
|
35
|
+
end
|
36
|
+
|
30
37
|
easy
|
31
38
|
end
|
32
39
|
end
|
data/lib/osdn/cli/runner.rb
CHANGED
data/lib/osdn/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osdn-cli
|
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
|
- OSDN
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.
|
61
|
+
version: 0.0.20160711
|
62
62
|
- - "<"
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 1.0.0
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.0.
|
71
|
+
version: 0.0.20160711
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.0.0
|