mosbot 0.3.3 → 2.0.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mosbot +5 -3
  3. data/lib/mosbot.rb +22 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cdf5b899189e19999ba0447de1e7d4391b94d21
4
- data.tar.gz: f595cd3ce0c6d7d3ffe5df1bd62c4aafd8775be6
3
+ metadata.gz: 48f2a934330bae75cfa23289e6080a37b2e472d0
4
+ data.tar.gz: 149712637fc984eb4d3415867bdc0963a921bed7
5
5
  SHA512:
6
- metadata.gz: 609be4960593d4b005a6150c0a2fde0fcbe1bb94c2393dcffee03c3fd38398dcbbb798b693bef4fb9f1f4eb7a479d3fbc102464c4ebd07760735fff14e512575
7
- data.tar.gz: 7abecdcb09b61ecd233a5cb78c67e829c03fdbfa3e9dc387b90b47cb8b30238d0471a58e119a342a1a13d7567c85caff01a0f08f542671c4699bc4fb3974554d
6
+ metadata.gz: 03ae3378f7d9a356a7c06c8cb99d41ab043721037db9167c86a20f61b212b96c0192484dd2b21e3462c0fb20a05c6cc0c963b81a13514d2c7cb60c55b5513ce1
7
+ data.tar.gz: d46e7f53288136180e9604e94601d0245cfd37acbb6e203ce6ef4efc9c232823369a19df0f2e7734697fcbb29e209e2cdf03a470998dc3bc2ae134822cb8da0d
data/bin/mosbot CHANGED
@@ -20,7 +20,7 @@ type = 'doc'
20
20
  id = '0'
21
21
 
22
22
  # grab command line options
23
- if ARGV.empty?
23
+ if ARGV.empty? || ARGV.length < 2
24
24
  type='help'
25
25
  else
26
26
  ARGV.each do |arg|
@@ -55,9 +55,11 @@ OS_CONST = os
55
55
  MOS_COPY_URL = ENV['MOS_COPY_URL'] || "false"
56
56
  MOS_OPEN_URL = ENV['MOS_OPEN_URL'] || "false"
57
57
 
58
- if type == "help"
58
+ if type == "help" || id == "0"
59
59
  display_help()
60
60
  else
61
61
  mosurl = generate_url(type, id)
62
- handle_output(mosurl)
62
+ mospuburl = generate_public_url(id)
63
+ page_title = get_title(mospuburl)
64
+ handle_output(mosurl, page_title)
63
65
  end
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rbconfig'
4
+ require 'open-uri'
5
+ require 'cgi'
4
6
 
5
7
  def os
6
8
  @os ||= (
@@ -37,7 +39,26 @@ def generate_url(type, id)
37
39
  end
38
40
  end
39
41
 
40
- def handle_output(url)
42
+ def generate_public_url(id)
43
+ id = id.sub('.', '_')
44
+ mospuburl = "https://support.oracle.com/knowledge/PeopleSoft%20Enterprise/"+id+".html"
45
+ end
46
+
47
+ def get_title(mospuburl)
48
+ begin
49
+ open(mospuburl) do |f|
50
+ str = f.read
51
+ page_title = CGI.unescapeHTML(str.scan(/<title>(.*?)<\/title>/)[0][0])
52
+ end
53
+ rescue
54
+ page_title = ''
55
+ end
56
+ end
57
+
58
+ def handle_output(url, title)
59
+ if !title.empty?
60
+ puts title
61
+ end
41
62
  puts url
42
63
 
43
64
  if "#{MOS_COPY_URL}" == "true"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mosbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Iverson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-10 00:00:00.000000000 Z
12
+ date: 2018-11-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Use mosbot to generate URLs for MOS Docs, Bugs, Ideas and Patches.
15
15
  email: