ruby_doc 2.0.2 → 2.0.3

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: 571d2f3fb80211c495f5fd0f8aa5190042b1174f6254dd6b3dc9af99ef5cadd8
4
- data.tar.gz: 8eda5a9cc02ce582202f47040d7e81078775898999f3ce4e661d6858a4ae016e
3
+ metadata.gz: 23787b43ce20d4680b93a29e6a7721ea68995abdde3c16bb0393de33c14f5c06
4
+ data.tar.gz: 01326f6b467e6fd4b6e7b57c58b0e04ded7c0b24baf1b9648bf1543284fab932
5
5
  SHA512:
6
- metadata.gz: 5d191f54742c6129c793669f5e662cee156ac1ba6c104f12fad129c8c8a1b43c96965637d9448339809e6f5b9c0cd8f10e242a6171eee5f317ebc0898ae62a39
7
- data.tar.gz: 3e2b2b6146323ecd503f4d7072005a2c03c6521393f4e9df8d7bee2bb4c43a4c079add28834f16108c2b4cfb0240c23d3ad9e4575170f72156f2ca631096dcdf
6
+ metadata.gz: 9589e5b3c8d6d75f68ef31c9f8976a4cc15da85acc4fddaa83544a84d5440493edbbe95b8a4ab0a8618d455c535a1640162d336915c2c3f980cbe83922db7aac
7
+ data.tar.gz: d5f3ac5eca09fb1a85a7e4df0cb9f726cc0690ebda230645325088a60d755ba3afb269285d616ef97a01b20d8f8b2d7b15a952cc75877f9423b080e5a33e3946
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ branches:
5
+ only:
6
+ - master
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_doc (2.0.2)
4
+ ruby_doc (2.0.3)
5
5
  colorize (~> 0.8.1)
6
6
  nokogiri (~> 1.8, >= 1.8.1)
7
7
 
data/README.md CHANGED
@@ -4,9 +4,10 @@
4
4
  ![fun](http://forthebadge.com/images/badges/powered-by-electricity.svg)
5
5
  ![fun](http://forthebadge.com/images/badges/pretty-risque.svg)
6
6
 
7
- [![Gem Version](https://img.shields.io/gem/v/ruby_doc.svg?&label=latest%20version&?&colorB=3FB911)](https://rubygems.org/gems/ruby_doc)
7
+ [![Build Status](https://img.shields.io/travis/AlphaDaniel/ruby_doc.svg)](https://travis-ci.org/AlphaDaniel/ruby_doc)
8
+ [![Gem Version](https://img.shields.io/gem/v/ruby_doc.svg?&label=version&?&colorB=brightgreen)](https://rubygems.org/gems/ruby_doc)
9
+ [![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/ruby_doc?type=total&color=brightgreen)](https://rubygems.org/gems/ruby_doc)
8
10
  [![GitHub last commit](https://img.shields.io/github/last-commit/AlphaDaniel/alpha-ruby_doc.svg)](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
9
- [![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/ruby_doc/?type=total&color=brightgreen)](https://rubygems.org/gems/ruby_doc)
10
11
  [![Changelog](https://img.shields.io/badge/change-log-blue.svg)](https://github.com/AlphaDaniel/alpha-ruby_doc/blob/master/changelog.md)
11
12
  [![Site](https://img.shields.io/badge/Alpha-Coding-blue.svg?&colorB=0F80C0&?&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAIAAACQKrqGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG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Ff5fE3pcndnW2%2FrNMOEI7HceBFZmKafHv%2BGPV4%2F62Ep2tPLewkKbn7%2BdHEuEv%2FPdpyphzNewJuIR2mDHM3nUqlkUOj3%2B%2F33p4r3CgVMgpDCOJLLPV2YG5%2BcrNfrlfIZXH310nEcXddlVfv29Uuz2finZzsYGYo8Odjf3Nm9vhAtsw1xCWRZXaxEgoOf%2BxzHZTMZRVUASZ5Xzre3tm5bius62IeifcGjsnh1c%2BsCcrH0TPD3tzXVw3oUrT09PfN2dU2W78TymWkalAWAcqcCSBuW1ek4zdplRRQ1Q7%2BRpOdLK%2FmJQiQ%2BGIzG2qpG4kCQAkqrURHLDOFqqlqTpNOTE0AQeCbbtmVNjSXTC8svIM6k3MldlyiMhR8Ux%2FMjqXQ282F9HUJ6aXklGhZasrz365DDkt0O6iDD1NXF%2BVmG5apX1x83NnieJwgXWR3HcTOp5HAyjvfBxSDOWHr0OB6Nmggh2%2BF4H0lSXar9p9YIBEMcyxTH8s3WLbQMIxYfnJ19gveq3jRqij4zvzQgBE6PDve%2B%2F%2BjhPMPZNMuwtOv%2BFWAADfsWB%2FHBnC4AAAAASUVORK5CYII%3D)](http://a1phacoding.com/)
12
13
 
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
2
3
  task :default => :spec
3
4
 
4
5
  require_relative './config/environment'
5
6
 
6
7
  task :console do
7
8
  Pry.start
8
- end
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new
data/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ v2.0.3 (2018-02-24)
2
+ ------------------
3
+
4
+ * Patch - Fixed repeat methods
5
+ * User X - Made default doc view short with option to view full by request. Felt was a cleaner look and helps avoid extra scrolling if user chooses wrong doc index #.
6
+
1
7
  v2.0.2 (2018-02-23)
2
8
  ------------------
3
9
 
@@ -5,6 +5,10 @@ class UI
5
5
  def self.my_gets
6
6
  gets.strip.to_s.downcase
7
7
  end
8
+
9
+ def self.clear
10
+ system "clear" or system "cls"
11
+ end
8
12
  #==================Control=====================
9
13
  def self.main_control
10
14
  prompt
@@ -17,9 +21,10 @@ class UI
17
21
  elsif input == "exit!"
18
22
  exit!
19
23
  elsif input == "?"
24
+ clear
20
25
  learn_more
21
26
  else
22
- matches = Processor.search(input)
27
+ matches = Processor.search(input)
23
28
 
24
29
  search_error if matches.empty?
25
30
  search_list(matches) if matches
@@ -31,6 +36,8 @@ class UI
31
36
  input = my_gets
32
37
 
33
38
  case input
39
+ when "full"
40
+ display_class(doc, "full")
34
41
  when "1"
35
42
  method_list(doc)
36
43
  when "m"
@@ -106,12 +113,20 @@ class UI
106
113
  end
107
114
  #==================Display=====================
108
115
  #-------------------docs-----------------------
109
- def self.display_class(doc)
116
+ def self.display_class(doc, view="short")
110
117
  UI.sepL
111
118
  puts "TITLE: ".cyan + doc.name.upcase
112
119
  puts "TYPE: ".cyan + doc.type.upcase
113
120
  puts "\nDESCRIPTION:".cyan
114
- puts doc.documentation
121
+
122
+ if view == "short"
123
+ puts wrapped(doc.short)
124
+ puts view_full
125
+
126
+ elsif view == "full"
127
+ puts doc.documentation
128
+ end
129
+
115
130
  puts "Methods: ".cyan + "#{doc.methods.count}".yellow
116
131
  puts "Source: #{doc.url}".red
117
132
  puts sepR
@@ -120,10 +135,6 @@ class UI
120
135
  display_class_control(doc)
121
136
  end
122
137
 
123
- def self.view_full
124
- "\nTo View Full Documentation Enter 'full'\n".cyan
125
- end # put back in strings
126
-
127
138
  def self.display_method(doc)
128
139
  UI.sepL
129
140
  puts "Title: ".cyan + doc.name.upcase
@@ -205,6 +216,8 @@ class UI
205
216
  #-----------------learn more-------------------
206
217
  def self.learn_more
207
218
  puts "\n" + sepB
219
+ puts wrapped("Alot in store for this section. For now more so a placeholder but feel free to see what's on the way, and what's been done below.").black
220
+ puts sepB
208
221
  puts "COMING SOON".cyan
209
222
  puts sepB
210
223
  puts "\n" + Scraper.coming_soon + "\n"
@@ -214,18 +227,18 @@ class UI
214
227
  puts sepB
215
228
  puts "\n" + Scraper.changelog
216
229
 
217
- main_menu
230
+ main_menu("learn")
218
231
  main_control
219
232
  end
220
233
  #===================Menus======================
221
- def self.main_menu
234
+ def self.main_menu(from="default")
222
235
  puts sepR#
223
236
  puts "Enter a ".cyan + "word ".yellow + "associated with the Ruby Language & I will ".cyan
224
237
  puts "try to find a match in my database for you.".cyan
225
238
  sepL#
226
239
  puts "\You can also enter".cyan + " 'b'".yellow + " to browse instead.".cyan + " Happy Hunting!".cyan
227
240
  sepB
228
- puts "Enter '?' to Learn More about Alpha Ruby-Doc".black
241
+ puts "Enter '?' to Learn More about Alpha Ruby-Doc".black unless from == "learn"
229
242
  print cyanH("\n If You're Searching... Single Word Inputs Only Please ")
230
243
  end
231
244
 
@@ -271,14 +284,15 @@ class UI
271
284
  end
272
285
 
273
286
  def self.search_error
274
- puts "\nNO CIGAR!".red
287
+ puts sepB
288
+ puts "NO CIGAR!".red
275
289
  puts "I couldn't find what you're looking for.".black
276
290
  puts "How about trying a Ruby ".black + "Method" + ", ".black + "Class" + " or ".black + "Module" + " name.".black
277
- sepB
291
+ puts sepB
278
292
 
279
- puts "\nNOT SURE?".red
293
+ puts "NOT SURE?".red
280
294
  puts "You can always browse with ".black + "'b'" + " & learn something new.".black + ":)"
281
- sepB
295
+ puts sepB
282
296
 
283
297
  print redH("\n Try a new word, enter 'b' to browse, or 'exit!' to leave ")
284
298
  main_control
@@ -288,7 +302,7 @@ class UI
288
302
  print redH("\n Enter selection number, 'm' for main or 'exit!' to leave ")
289
303
  end
290
304
 
291
- def self.nil_error
305
+ def self.nil_error
292
306
  print redH("\n Enter selection number, 'm' for main or 'exit!' to leave ")
293
307
  end
294
308
 
@@ -317,8 +331,9 @@ class UI
317
331
  end
318
332
  #==============================================
319
333
  #CANDY
320
- #===============Quote Scraper==================
321
- def self.randQ
334
+ #================== Quotes=====================
335
+ def self.randQ
336
+ puts sepB
322
337
  html = Nokogiri::HTML(open("https://fortrabbit.github.io/quotes/"))
323
338
  container = html.search(".row.gutter-l.wrap")
324
339
 
@@ -373,10 +388,14 @@ class UI
373
388
  "https://ruby-doc.org/core-2.4.3/"
374
389
  end
375
390
 
376
- # view_full here
377
-
391
+ def self.view_full
392
+ puts sepB
393
+ puts "To View Full Documentation Enter".cyan + " full".yellow
394
+ puts sepB
395
+ end
396
+
378
397
  # currently not being used
379
- def self.wrapped(s, width=78)
398
+ def self.wrapped(s, width=60)
380
399
  lines = []
381
400
  line = ""
382
401
 
@@ -29,7 +29,7 @@ class Processor
29
29
  end
30
30
  #================================SEARCH===============================
31
31
  def self.search(name)
32
- matches = $DocDB.find_all{|doc| doc.name.downcase.include?(name)}
32
+ $DocDB.find_all{|doc| doc.name.downcase.include?(name)}
33
33
  end
34
34
  #=====================================================================
35
35
  end
@@ -29,7 +29,7 @@ class Scraper < UI
29
29
  type = "Method"
30
30
 
31
31
  # assigns - Method :names, :urls
32
- doc = Meth.new("Method", name, url) if method_uniq(url)
32
+ doc = Meth.new("Method", name, url) if method_uniq(name)
33
33
  # keeps copy in DocDB
34
34
  $DocDB << doc if doc_uniq(name)
35
35
 
@@ -43,7 +43,7 @@ class Scraper < UI
43
43
  #--------------------------documentation---------------------------------
44
44
  container = html.search("#description")
45
45
 
46
- short = container.search("p")[0].text + UI.view_full
46
+ short = container.search("p")[0].text + "\n"
47
47
 
48
48
  text = ""
49
49
  container.search("p, pre, h2").each {|p| text << p.text + "\n\n"}
@@ -81,7 +81,6 @@ class Scraper < UI
81
81
 
82
82
  # assign
83
83
  doc.documentation = text
84
- # default
85
84
  else
86
85
  container = html.search(selector)[0]
87
86
 
@@ -97,19 +96,19 @@ class Scraper < UI
97
96
  Klass.all.none?{|klass| klass.url == url}
98
97
  end
99
98
 
100
- def self.method_uniq(url)
101
- Meth.all.none?{|method| method.url == url}
99
+ def self.method_uniq(name)
100
+ Meth.all.none?{|method| method.name == name}
102
101
  end
103
102
 
104
- def self.doc_uniq(url)
105
- $DocDB.none?{|doc| doc.url == url}
103
+ def self.doc_uniq(name)
104
+ $DocDB.none?{|doc| doc.name == name}
106
105
  end
107
106
 
108
107
  def self.class_method_uniq(doc, method)
109
108
  doc.methods.none?{|m| m == method }
110
109
  end
111
- #========================================================================
112
- def self.coming_soon
110
+ #===========================LEARN MORE===================================
111
+ def self.coming_soon
113
112
  html = Nokogiri::HTML(open("https://github.com/AlphaDaniel/ruby_doc/blob/master/README.md"))
114
113
 
115
114
  list = ""
@@ -1,3 +1,3 @@
1
1
  module RubyDoc
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Nunez
@@ -120,6 +120,7 @@ extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
122
  - ".gitignore"
123
+ - ".travis.yml"
123
124
  - CODE_OF_CONDUCT.md
124
125
  - Gemfile
125
126
  - Gemfile.lock