bjt 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 0acbd168979e88dfec3ae99a8b5fc9f94d748a2b7c5babdd5a1baddf07df27df
4
- data.tar.gz: 17001dda154bdaf413a367283ee4472bff7a1bb4e178b572f9c558052e5a5255
3
+ metadata.gz: 6846a18e246a8ad66a0be7f0a6ced974c7e89eefd24d92c52614abccbeafaf75
4
+ data.tar.gz: 6728870ec21b2551261f54ae1f19123c520006b6e86217955e4d6c4ee27c3001
5
5
  SHA512:
6
- metadata.gz: bb70b84a460e689ab048f29100c42847683204d4ca7dca1a4c54d6dcdd21fda09168540414cdce0eaecdc23e3e3ecfd988b0a75a3059e9c1b47f343cabd9132f
7
- data.tar.gz: 2a976ac223036a668dce7e43f5ae13f6704d6402a58ca61556ab95e2f77ee210f97024d8386d182f195e3a088bf7802940e30ca6ef04cc72b577a52fde6b28bf
6
+ metadata.gz: 0bfbcadfb1bf92ac6c814fdecdc9682d9fc8abb7e06384aca63e0d723922d88ad810c6d68e85cfeefa0d563674edcce163d522929482e8ed339c0bdbcebb69fc
7
+ data.tar.gz: 1be9cd388b91e8e7c6af3d7b88c0043610fd2c7edc1a6b8a96fd9f5f1b5e6b19c2ed163b8ad2fecd0e1bd88e5fce5b5866903b2b142ca826dfacf569388fe60b
@@ -31,6 +31,11 @@ module Bjt
31
31
  Bjt::Jumper.new(:r, package).jump
32
32
  end
33
33
 
34
+ desc 'd', 'Jump To Library RDocs'
35
+ def d(package)
36
+ Bjt::Jumper.new(:d, package).jump
37
+ end
38
+
34
39
  desc 'l', 'Jump To Local Dir'
35
40
  def l(package)
36
41
  Bjt::Jumper.new(:l, package).jump
@@ -22,6 +22,7 @@ module Bjt
22
22
  i[:release_uri] = release_uri_with(bundle_info.metadata['source_code_uri'], bundle_info.homepage)
23
23
  i[:source] = source_with(bundle_info.source).empty? ? 'https://rubygems.org' : source_with(bundle_info.source)
24
24
  i[:package_uri] = package_uri_with(i[:source], i[:version])
25
+ i[:doc_uri] = bundle_info.metadata['documentation_uri'] || doc_uri_with(i[:source], i[:version])
25
26
  end
26
27
  end
27
28
  end
@@ -46,6 +47,12 @@ module Bjt
46
47
  package_uri
47
48
  end
48
49
 
50
+ def doc_uri_with(source, version)
51
+ return source if source.end_with?('.git') && !github?(source)
52
+
53
+ format('https://www.rubydoc.info/gems/%s/%s', package, version)
54
+ end
55
+
49
56
  def release_uri_with(source, homepage)
50
57
  if github_or_gitlab?(homepage)
51
58
  format('%s/releases', homepage)
@@ -57,7 +64,15 @@ module Bjt
57
64
  end
58
65
 
59
66
  def github_or_gitlab?(url)
60
- url =~ /github.com/ || url =~ /gitlab.com/
67
+ github?(url) || gitlab?(url)
68
+ end
69
+
70
+ def github?(url)
71
+ url =~ /github.com/
72
+ end
73
+
74
+ def gitlab?(url)
75
+ url =~ /gitlab.com/
61
76
  end
62
77
  end
63
78
  end
@@ -15,13 +15,14 @@ module Bjt
15
15
  when :h then Browser.new(info[:homepage]).open
16
16
  when :p then Browser.new(info[:package_uri]).open
17
17
  when :r then Browser.new(info[:release_uri]).open
18
+ when :d then Browser.new(info[:doc_uri]).open
18
19
  when :l then system(command(info[:gem_path]))
19
20
  else raise UnknownEventError, package
20
21
  end
21
22
  rescue Bjt::Fetcher::NotFoundPackageError => e
22
23
  puts "[ERROR] not found this package: #{package}, please make sure this package installed"
23
24
  rescue Bjt::Jumper::UnknownEventError => e
24
- puts "[ERROR] unknown event: #{event}, support g s h p r l events"
25
+ puts "[ERROR] unknown event: #{event}, support g s h p r d l events"
25
26
  rescue StandardError => e
26
27
  puts "[ERROR] has error: #{e.message}"
27
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bjt
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bjt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YingRui Lu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler