修訂 | 2cd6fd5cb2041206779b68a8314bdc7c3bf81f7e (tree) |
---|---|
時間 | 2016-07-01 15:53:43 |
作者 | Tatsuki Sugiura <sugi@nemu...> |
Commiter | Tatsuki Sugiura |
Version 0.1.4: frs_uplaod, relfile: Allow multiple target arguments.
@@ -1,3 +1,8 @@ | ||
1 | +2016-07-01 Tatsuki Sugiura <sugi@nemui.org> | |
2 | + | |
3 | + * Versino 0.1.4 | |
4 | + * frs_upload, relfile: Add progress options. | |
5 | + | |
1 | 6 | 2016-05-26 Tatsuki Sugiura <sugi@nemui.org> |
2 | 7 | |
3 | 8 | * Version 0.1.3 |
@@ -10,6 +10,8 @@ module OSDN; module CLI; module Command | ||
10 | 10 | puts " -v --visibility=<public|private|hidden>" |
11 | 11 | puts " Default visibility for newly created items" |
12 | 12 | puts " --force-digest Calc local file digest forcely" |
13 | + puts " --progress Force to show upload progress" | |
14 | + puts " --no-progress Force to hide upload progress" | |
13 | 15 | end |
14 | 16 | |
15 | 17 | def run |
@@ -21,6 +23,8 @@ module OSDN; module CLI; module Command | ||
21 | 23 | [ '--release', GetoptLong::REQUIRED_ARGUMENT ], |
22 | 24 | [ '--visibility', '-v', GetoptLong::REQUIRED_ARGUMENT ], |
23 | 25 | [ '--force-digest', GetoptLong::NO_ARGUMENT], |
26 | + [ '--progress', GetoptLong::NO_ARGUMENT], | |
27 | + [ '--no-progress', GetoptLong::NO_ARGUMENT], | |
24 | 28 | ) |
25 | 29 | opts.each do |opt, arg| |
26 | 30 | case opt |
@@ -43,6 +47,10 @@ module OSDN; module CLI; module Command | ||
43 | 47 | @force_digest = true |
44 | 48 | when '--dry-run' |
45 | 49 | @dry_run = true |
50 | + when '--progress' | |
51 | + @show_progress = true | |
52 | + when '--no-progress' | |
53 | + @show_progress = false | |
46 | 54 | end |
47 | 55 | end |
48 | 56 |
@@ -182,7 +190,7 @@ module OSDN; module CLI; module Command | ||
182 | 190 | if @dry_run |
183 | 191 | finfo = Hashie::Mash.new id: '(dry-run)', url: '(dry-run)' |
184 | 192 | else |
185 | - logger.level <= Logger::INFO and | |
193 | + logger.level <= Logger::INFO && @show_progress != false || @show_progress and | |
186 | 194 | OSDN::CLI._show_progress = true |
187 | 195 | fio = file.open |
188 | 196 | logger.info "Starting upload #{file}..." |
@@ -15,6 +15,8 @@ module OSDN; module CLI; module Command | ||
15 | 15 | puts " --release=<release-id> Target release (numeric id)" |
16 | 16 | puts " -v --visibility=<public|private|hidden>" |
17 | 17 | puts " --force-digest Calc local file digest forcely" |
18 | + puts " --progress Force to show upload progress" | |
19 | + puts " --no-progress Force to hide upload progress" | |
18 | 20 | end |
19 | 21 | |
20 | 22 | def self.description |
@@ -29,6 +31,8 @@ module OSDN; module CLI; module Command | ||
29 | 31 | [ '--release', GetoptLong::REQUIRED_ARGUMENT ], |
30 | 32 | [ '--visibility', '-v', GetoptLong::REQUIRED_ARGUMENT ], |
31 | 33 | [ '--force-digest', GetoptLong::NO_ARGUMENT], |
34 | + [ '--progress', GetoptLong::NO_ARGUMENT], | |
35 | + [ '--no-progress', GetoptLong::NO_ARGUMENT], | |
32 | 36 | ) |
33 | 37 | opts.each do |opt, arg| |
34 | 38 | case opt |
@@ -52,6 +56,10 @@ module OSDN; module CLI; module Command | ||
52 | 56 | exit |
53 | 57 | end |
54 | 58 | @visibility = arg |
59 | + when '--progress' | |
60 | + @show_progress = true | |
61 | + when '--no-progress' | |
62 | + @show_progress = false | |
55 | 63 | end |
56 | 64 | end |
57 | 65 | end |
@@ -105,7 +113,7 @@ module OSDN; module CLI; module Command | ||
105 | 113 | end |
106 | 114 | |
107 | 115 | fio = file.open |
108 | - logger.level <= Logger::INFO and | |
116 | + logger.level <= Logger::INFO && @show_progress != false || @show_progress and | |
109 | 117 | OSDN::CLI._show_progress = true |
110 | 118 | logger.info "Starting upload #{file}..." |
111 | 119 | f = api.create_release_file target_proj, target_package, target_release, fio, visibility: @visibility |
@@ -23,6 +23,7 @@ module Typhoeus | ||
23 | 23 | end |
24 | 24 | if OSDN::CLI._show_progress |
25 | 25 | Ethon::Curl.set_option(:noprogress, false, easy.handle) |
26 | + | |
26 | 27 | else |
27 | 28 | Ethon::Curl.set_option(:noprogress, true, easy.handle) |
28 | 29 | end |
@@ -1,5 +1,5 @@ | ||
1 | 1 | module OSDN |
2 | 2 | module CLI |
3 | - VERSION = "0.1.3" | |
3 | + VERSION = "0.1.4" | |
4 | 4 | end |
5 | 5 | end |