ghcurl 0.7.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/ghcurl +15 -9
  4. data/lib/ghcurl.rb +6 -3
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efa8ec89c9537aeb042258adb82a8b4c5b5906fee9f75d1ac348bb59d98095a7
4
- data.tar.gz: a95f9e3385e1bb9766c1b807520ae191f768801e83fffe29a7231a10f4926cf8
3
+ metadata.gz: 6c0e61752e6dd439bf1d0f6f08dc55bf4c2e956df4ec8b07330fa19d75b463cc
4
+ data.tar.gz: 5ac05c87788fac6b3574f843cf4a3f7652e3146d9302cf3a56b1ae87347eb093
5
5
  SHA512:
6
- metadata.gz: f1839ed2a13c403b71a7ea01773f7ec9b4b7b13b3a7f2aade2fa567703e46fb3b8b2b05395f17fa690924d93a8c570195b57d733768883f07b6f44aab58c5fb3
7
- data.tar.gz: b37c28392213b7b0a73343b8fa61399d510edc3ff8fc51758e95e79c10bf30f7188851d3e5df53411b3275bee72980f5f6acf66aa69a3b4a8e57f5c3c6f8bd6b
6
+ metadata.gz: 274ee82a30fe217f1b4654188145f0587c9165ff56e808a101152e957964a73159ab1b8eb995eb9324ef31901a1ebcd450a580d90a43966466979559a08beceb
7
+ data.tar.gz: 930fd4563cf8fa781ce8e0e0c5403e9f5dac769920b41d7a927bb5d7f76ffcea4ef68ea308be12c57165dfdc0a2ffb707c2ab6b11e45101dd7b023bee42c58dd
data/README.md CHANGED
@@ -37,7 +37,7 @@ This is optional, download will default to `~/.cache/ghcurl`
37
37
 
38
38
  **-i**
39
39
  1. `-i` Install to `/usr/local/bin` or `GHCURL_BIN_PATH`
40
- 2. `-i path` Install to path`
40
+ 2. `-i path` Install to path
41
41
 
42
42
  **-r**
43
43
  1. `-r name` Install the binary as name
data/bin/ghcurl CHANGED
@@ -3,7 +3,7 @@
3
3
  # File : ghcurl.rb
4
4
  # Authors : ccmywish <ccmywish@qq.com>
5
5
  # Created on : <2022-04-12>
6
- # Last modified : <2022-04-26>
6
+ # Last modified : <2022-04-30>
7
7
  #
8
8
  # ghcurl:
9
9
  #
@@ -51,7 +51,11 @@ module Ghcurl
51
51
  end
52
52
 
53
53
  cmd = "curl -L #{url} --create-dirs -o #{to}"
54
- system cmd
54
+ status = system cmd
55
+ if status == false || status.nil?
56
+ log "Download error!"
57
+ exit
58
+ end
55
59
  log "Downloaded to #{to}"
56
60
  return to
57
61
  end
@@ -139,7 +143,7 @@ module Ghcurl
139
143
  elsif !repo.include?('/')
140
144
  got_repo = DEFAULT_WARES[repo.to_sym]
141
145
  if not got_repo
142
- user = HL.ask "Who developed the awesome '#{repo}' ? "
146
+ user = HL.ask "Who developed the awesome #{repo}? "
143
147
  repo = user + '/' + repo
144
148
  else
145
149
  repo = got_repo
@@ -155,10 +159,11 @@ module Ghcurl
155
159
  doc = Octokit::Client.new.release_for_tag(repo, 'v' + version)
156
160
  end
157
161
  rescue Octokit::NotFound
158
- puts "ghcurl: Not found #{repo} v#{version} !"
159
- rescue Error => e
160
- puts e
161
- exit 0
162
+ log "Not found #{repo} v#{version} !"
163
+ exit
164
+ rescue StandardError => e
165
+ log e
166
+ exit
162
167
  end
163
168
 
164
169
  links = doc.to_hash[:assets]
@@ -323,7 +328,7 @@ module Ghcurl
323
328
  name.include?('-') ||
324
329
  name.include?('_')) && (not rename_as)
325
330
  log "Do you want to rename the '#{name}'?"
326
- re = HL.ask "Input name, or just leave it blank to say no."
331
+ re = HL.ask "Input new name, or leave it blank to not rename."
327
332
  if !re.empty?
328
333
  rename_as = re
329
334
  end
@@ -386,6 +391,7 @@ module Ghcurl
386
391
  # For -l option
387
392
  #
388
393
  def list_wares
394
+ FileUtils.mkdir_p(WAREHOUSE)
389
395
  puts blue("ghcurl: #{WAREHOUSE}")
390
396
  Dir.children(WAREHOUSE).each_with_index do |dict,i|
391
397
  puts "#{blue(i+1)}. #{bold(green(dict))}"
@@ -400,7 +406,7 @@ module Ghcurl
400
406
  begin
401
407
 
402
408
  if name.nil?
403
- re = HL.ask "Do you want to delete all downloaded files?"
409
+ re = HL.ask "Do you want to delete all downloaded files? [Y/n]"
404
410
  case re.downcase
405
411
  when '','y','ye','yes','true'
406
412
  FileUtils.rm_rf WAREHOUSE
data/lib/ghcurl.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # File : ghcurl.rb
3
3
  # Authors : ccmywish <ccmywish@qq.com>
4
4
  # Created on : <2022-04-12>
5
- # Last modified : <2022-04-26>
5
+ # Last modified : <2022-04-30>
6
6
  #
7
7
  # ghcurl:
8
8
  #
@@ -12,7 +12,7 @@
12
12
 
13
13
  module Ghcurl
14
14
 
15
- VERSION = "0.7.0"
15
+ VERSION = "0.8.1"
16
16
 
17
17
  end
18
18
 
@@ -64,5 +64,8 @@ Ghcurl::DEFAULT_WARES = {
64
64
 
65
65
  scc: 'boyter/scc',
66
66
  rbspy: 'rbspy/rbspy',
67
- starship: 'starship/starship'
67
+ starship: 'starship/starship',
68
+
69
+ glow: 'charmbracelet/glow'
70
+
68
71
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghcurl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ccmywish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.3.11
91
+ rubygems_version: 3.3.12
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Download files (and install) from Github releases