ruby_doc 2.0.3 → 2.1.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: 23787b43ce20d4680b93a29e6a7721ea68995abdde3c16bb0393de33c14f5c06
4
- data.tar.gz: 01326f6b467e6fd4b6e7b57c58b0e04ded7c0b24baf1b9648bf1543284fab932
3
+ metadata.gz: 01b6da9b8372ff4c0936c9ad7204f56d76eebf1b4e3dc7165f2194c0ea87190c
4
+ data.tar.gz: 96b39ab1f3aa1275741a83d690d4ee894beea0453f111e38b53268cfbee4793c
5
5
  SHA512:
6
- metadata.gz: 9589e5b3c8d6d75f68ef31c9f8976a4cc15da85acc4fddaa83544a84d5440493edbbe95b8a4ab0a8618d455c535a1640162d336915c2c3f980cbe83922db7aac
7
- data.tar.gz: d5f3ac5eca09fb1a85a7e4df0cb9f726cc0690ebda230645325088a60d755ba3afb269285d616ef97a01b20d8f8b2d7b15a952cc75877f9423b080e5a33e3946
6
+ metadata.gz: 9f1fca901c8bc951e57c225865cd5ce9deb5b9aa57b0fb3a6dcc86ec7da7bf81b7e13e4b37f10a09b4f2308f2cecda73a92a4e476c6d028485711d3ee92e411e
7
+ data.tar.gz: b7b38dd6156e44bc9f7537acde8b905f3ed22acd0ec76f5f4b96748d7c4fdeb7407a41ff836940a303154f09c5e08e91f2581417ee1a25181b7a613bbbaa9cb5
data/.gitignore CHANGED
@@ -6,4 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- private
9
+ private
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_doc (2.0.3)
4
+ ruby_doc (2.1.0)
5
5
  colorize (~> 0.8.1)
6
6
  nokogiri (~> 1.8, >= 1.8.1)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,8 @@
6
6
 
7
7
  [![Build Status](https://img.shields.io/travis/AlphaDaniel/ruby_doc.svg)](https://travis-ci.org/AlphaDaniel/ruby_doc)
8
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)
9
+ [![Release Date](https://img.shields.io/github/release-date/AlphaDaniel/ruby_doc.svg)](https://github.com/AlphaDaniel/ruby_doc/releases)
10
+ [![Downloads](https://img.shields.io/gem/dt/ruby_doc.svg)](https://rubygems.org/gems/ruby_doc)
10
11
  [![GitHub last commit](https://img.shields.io/github/last-commit/AlphaDaniel/alpha-ruby_doc.svg)](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
11
12
  [![Changelog](https://img.shields.io/badge/change-log-blue.svg)](https://github.com/AlphaDaniel/alpha-ruby_doc/blob/master/changelog.md)
12
13
  [![Site](https://img.shields.io/badge/Alpha-Coding-blue.svg?&colorB=0F80C0&?&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAIAAACQKrqGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4OUY5MDgyNzE4RjQxMUU4QjBCREE1NUVCQkYxMDJFMiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4OUY5MDgyODE4RjQxMUU4QjBCREE1NUVCQkYxMDJFMiI%2BIDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjg5RjkwODI1MThGNDExRThCMEJEQTU1RUJCRjEwMkUyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg5RjkwODI2MThGNDExRThCMEJEQTU1RUJCRjEwMkUyIi8%2BIDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY%2BIDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8%2BLUvNgAAAAkRJREFUeNocUFtP02AY7td%2BbVfoGFvHzmxjgzEOc0ETb0BvQCFMgfhzvPAQNPwSEm%2BJiTEBEhQvxDsUOQSyMoSxso2Vtmv7de3qp%2B%2FFk%2FfiyXMCoUg4Gk0kUtn00NDau9cHh8dvVt%2B7Tof39uuaYtlOQ6riZ3h0ggqHIwEh1BcIsiwTHBgYTCSqUj0UifC8j4a0CwDDsMg0EDLB3EKJ6%2B0LCIKnh%2Ff5fE3pcndnW2%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/)
@@ -16,9 +17,15 @@
16
17
 
17
18
  <!--![image](https://images.huffingtonpost.com/2013-08-23-tumblr_m08celcrnT1r3isxuo1_500.gif)-->
18
19
 
19
- Ever get tired of leaving your editor / environment to google a method, or more in depth info on a class or module? This gem aims to make Ruby referencing quick and more importantly, **LOCAL!**
20
+ **THE ULTIMATE RUBY DEVELOPER REFERENCING TOOL!**
21
+
22
+ **Alpha Ruby Doc** aims to make Ruby referencing quick and painless. This gem scrapes Ruby documentation and allows users to quickly reference Ruby classes, modules and methods all on your terminal in STYLE!
23
+
24
+ Features include Search by Name, Paginated Browsing, Full documentation including Syntax and Source Code, Save to Favorites, Source Links, Seamless Navigation, and more.
25
+
26
+ Have a query? **Run, Hunt, and Done**. Never lose momentum, keep all things in your line of sight, and get right back to coding!
27
+
20
28
 
21
- **Alpha Ruby Doc** scrapes Ruby documentation and allows users to quickly reference Ruby methods and additional information all on your terminal. Have a query? **Run, Hunt, and Done**. Never lose momentum, keep all things in your line of sight, and get right back to coding!
22
29
 
23
30
  ---
24
31
  ## A Look Inside
@@ -28,19 +35,19 @@ Ever get tired of leaving your editor / environment to google a method, or more
28
35
 
29
36
  ---
30
37
  ### Features:
31
- Search for Ruby Documentation by Class, Module or Method Name
38
+ Search for Ruby Documentation by Class, Module or Method Name
32
39
 
33
- Browse all Documentation (Paginated Output To Terminal)
40
+ Full documentation including description, syntax and source code!
34
41
 
35
- View Descriptions and Syntax
42
+ Save Docs to Favorites! for quick referencing
36
43
 
37
- View Source Code
44
+ Browse all Documentation (Paginated Output To Terminal)
38
45
 
39
- Source Links Provided
46
+ Source Links Provided
40
47
 
41
- Easy Navigation
48
+ Easy Navigation
42
49
 
43
- Random Dev Quotes (For fun and motivation)
50
+ Random Dev Quotes (For fun and motivation)
44
51
 
45
52
 
46
53
  ---
@@ -50,7 +57,6 @@ Ever get tired of leaving your editor / environment to google a method, or more
50
57
  ---
51
58
  ### To do list:
52
59
  * Multiple Doc sources
53
- * Save Favorites
54
60
  * Add Notes
55
61
 
56
62
  ---
@@ -93,6 +99,10 @@ To exit
93
99
  To Learn More (From Main Menu)
94
100
 
95
101
  $ ?
102
+
103
+ To List Favorites (From Main Menu)
104
+
105
+ $ *
96
106
 
97
107
  ---
98
108
  ## Contributing
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-time-machine
@@ -1,7 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- require "bundler/setup"
2
+ #=======================================
3
3
  require_relative '../config/environment'
4
-
4
+ #=======================================
5
+ # if dir does not exist
6
+ if !File.exist?('usr')
7
+ # Creates usr dir
8
+ FileUtils::mkdir 'usr'
9
+ # Creates favorites.txt
10
+ FileUtils::touch 'usr/favorites.txt'
11
+ end
12
+ #=======================================
5
13
  RubyDoc::CLI.start_load
6
14
 
7
15
 
@@ -1,3 +1,9 @@
1
+ v2.1.0 (2018-03-01)
2
+ ------------------
3
+
4
+ * Feature - Add docs to favorites!
5
+ * User X - cleaned up menus
6
+
1
7
  v2.0.3 (2018-02-24)
2
8
  ------------------
3
9
 
@@ -1,4 +1,6 @@
1
1
  #====================Requires===================
2
+ require "bundler/setup"
3
+ require 'fileutils'
2
4
  require 'colorize'
3
5
  require 'open-uri'
4
6
  require 'nokogiri'
@@ -15,5 +17,5 @@ require_relative '../lib/ruby_doc/data/data_processor'
15
17
  #====================DataBase===================
16
18
  $DocDB = []
17
19
  #====================Testing====================
18
- # Scraper.changelog
20
+
19
21
  #===============================================
@@ -18,10 +18,11 @@ class UI
18
18
  main_error
19
19
  elsif input == "b"
20
20
  paginate("start")
21
+ elsif input == "*"
22
+ favorites_list
21
23
  elsif input == "exit!"
22
24
  exit!
23
25
  elsif input == "?"
24
- clear
25
26
  learn_more
26
27
  else
27
28
  matches = Processor.search(input)
@@ -31,6 +32,22 @@ class UI
31
32
  end
32
33
  end
33
34
 
35
+ def self.favorites_list_control(list)
36
+ prompt
37
+ input = my_gets
38
+
39
+ if input == "m"
40
+ RubyDoc::CLI.start
41
+ elsif input == "exit!"
42
+ exit!
43
+ elsif !input.to_i.between?(1,list.count)
44
+ list_error(list)
45
+ else
46
+ Processor.find_fav(list[input.to_i-1])
47
+ end
48
+ favorites_list_control(list)
49
+ end
50
+
34
51
  def self.display_class_control(doc)
35
52
  prompt
36
53
  input = my_gets
@@ -40,6 +57,8 @@ class UI
40
57
  display_class(doc, "full")
41
58
  when "1"
42
59
  method_list(doc)
60
+ when "s"
61
+ Processor.save(doc)
43
62
  when "m"
44
63
  RubyDoc::CLI.start
45
64
  when "exit!"
@@ -49,11 +68,13 @@ class UI
49
68
  end
50
69
  end
51
70
 
52
- def self.display_method_control
71
+ def self.display_method_control(doc)
53
72
  prompt
54
73
  input = my_gets
55
74
 
56
75
  case input
76
+ when "s"
77
+ Processor.save(doc)
57
78
  when "m"
58
79
  RubyDoc::CLI.start
59
80
  when "exit!"
@@ -114,29 +135,33 @@ class UI
114
135
  #==================Display=====================
115
136
  #-------------------docs-----------------------
116
137
  def self.display_class(doc, view="short")
117
- UI.sepL
138
+ puts sepL
139
+ # header #
118
140
  puts "TITLE: ".cyan + doc.name.upcase
119
141
  puts "TYPE: ".cyan + doc.type.upcase
120
142
  puts "\nDESCRIPTION:".cyan
121
143
 
122
- if view == "short"
144
+ # documentation #
145
+ if view == "short"
123
146
  puts wrapped(doc.short)
124
147
  puts view_full
125
148
 
126
- elsif view == "full"
149
+ elsif view == "full"
127
150
  puts doc.documentation
128
151
  end
129
152
 
153
+ # footer #
130
154
  puts "Methods: ".cyan + "#{doc.methods.count}".yellow
131
155
  puts "Source: #{doc.url}".red
132
156
  puts sepR
133
157
 
158
+ # control #
134
159
  display_class_menu(doc)
135
160
  display_class_control(doc)
136
161
  end
137
162
 
138
163
  def self.display_method(doc)
139
- UI.sepL
164
+ puts sepL
140
165
  puts "Title: ".cyan + doc.name.upcase
141
166
  puts "Type: ".cyan + doc.type.upcase
142
167
  puts "\nDescription:".cyan
@@ -150,11 +175,40 @@ class UI
150
175
  #-----------future fix------------#
151
176
 
152
177
  display_method_menu
153
- display_method_control
178
+ display_method_control(doc)
154
179
  end
155
180
  #-------------------lists----------------------
181
+ def self.favorites_list
182
+ # Normalize Favorites List
183
+ list = []
184
+ File.open("usr/favorites.txt").each do |li|
185
+ list << li.chomp
186
+ end
187
+
188
+ # if favorites is empty error & back to main control
189
+ if list.empty?
190
+ favorites_error
191
+ main_control
192
+
193
+ else
194
+ puts sepL
195
+ puts favorites_message
196
+ puts sepB
197
+
198
+ # Iterated and display normalized favorites list
199
+ list.each_with_index do |f, index|
200
+ li = ["#{index + 1}.".yellow, f.cyan]
201
+ puts li.join(" ")
202
+ end
203
+ puts sepR
204
+
205
+ list_menu(list)
206
+ favorites_list_control(list)
207
+ end
208
+ end
209
+
156
210
  def self.search_list(matches)
157
- UI.sepL
211
+ puts sepL
158
212
  matches.each_with_index do |doc, index|
159
213
 
160
214
  if doc.type == "Class" || doc.type == "Module"
@@ -195,7 +249,7 @@ class UI
195
249
 
196
250
  if doc.type == "Class" || doc.type == "Module"
197
251
  li = ["#{index + 1}.".yellow, doc.name.light_cyan]
198
- else
252
+ else
199
253
  li = ["#{index + 1}.".yellow, doc.name.cyan]
200
254
  end
201
255
 
@@ -215,8 +269,20 @@ class UI
215
269
  end
216
270
  #-----------------learn more-------------------
217
271
  def self.learn_more
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
272
+ puts sepB
273
+ puts "FAVORITES".cyan
274
+ puts sepB
275
+ puts wrapped("In this early version of the favorites feature there are a few things to note, for this to work properly.", 55)
276
+ puts "\n"
277
+ puts wrapped("When you install ruby_doc we create a dir (usr) with a file inside (favorites.txt) in your current directory. In order for favorites to read from this file and output your saved entries this dir/file must remain in your current dir.", 55)
278
+ puts "\n"
279
+ puts wrapped("If at any point you switch directories and want to have access to your favorites simply copy or move the (usr) dir to the root/top level of the directory you'd like to have access to your ruby_doc favorites in.", 55)
280
+ puts "\n"
281
+ puts "Please do not modify this file!".red
282
+ puts wrapped("If you do accidentally, and encounter any problems displaying, do the following. Open the favorites.txt file in your usr dir and make sure each entry is on a new/separate line. If you still have issues you will have to delete your usr folder. When you run ruby_doc again it will check for the usr dir, if it doesn't exist, it will create a new one for you. Would be a good idea to save your entries before deleting usr for reference.", 55)
283
+ puts "\n"
284
+ puts wrapped("This is something that obviously will be improved to persist through all your directories in the future, but give me time. Thanks for using RUBY DOC!", 55)
285
+
220
286
  puts sepB
221
287
  puts "COMING SOON".cyan
222
288
  puts sepB
@@ -232,48 +298,49 @@ class UI
232
298
  end
233
299
  #===================Menus======================
234
300
  def self.main_menu(from="default")
235
- puts sepR#
236
- puts "Enter a ".cyan + "word ".yellow + "associated with the Ruby Language & I will ".cyan
237
- puts "try to find a match in my database for you.".cyan
238
- sepL#
239
- puts "\You can also enter".cyan + " 'b'".yellow + " to browse instead.".cyan + " Happy Hunting!".cyan
240
- sepB
241
- puts "Enter '?' to Learn More about Alpha Ruby-Doc".black unless from == "learn"
242
- print cyanH("\n If You're Searching... Single Word Inputs Only Please ")
301
+ puts sepR
302
+ puts "To search... enter a single (".cyan + "word".yellow + ") associated with Ruby. \nI will try to find a match in my database for you.".cyan
303
+ puts sepB
304
+ puts "To Browse enter (".cyan + "b".yellow + ")".cyan + " ||| ".black + "To view your favorites enter (".cyan + "*".yellow + ")".cyan
305
+ puts sepR
306
+ puts "Enter '?' to Learn More about Alpha Ruby-Doc\n".black unless from == "learn"
307
+ print cyanH("\n Happy Hunting! ")
243
308
  end
244
309
 
245
310
  def self.list_menu(matches)
246
- puts "To ".cyan + "View ".yellow + "(Enter ".cyan + "#".yellow + ")".cyan
247
- puts "To return to".cyan + " Main Menu".yellow + " (Enter ".cyan + "'m'".yellow + ")".cyan
248
- puts "To".cyan + " Leave".yellow + " (".cyan + "'exit!'".yellow + ")\n".cyan
311
+ puts "View Doc ".light_cyan + "(".cyan + "#".yellow + ")".cyan
312
+ puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
313
+ puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
249
314
  print randQ
250
315
  end
251
316
 
252
317
  def self.display_class_menu(doc)
253
- puts "To ".cyan + "View Methods ".yellow + "For".cyan + " #{doc.name}".yellow + " (Enter ".cyan + "'1'".yellow + ")".cyan
254
- puts "To Return To".cyan + " Main Menu".yellow + " (Enter ".cyan + "'m'".yellow + ")".cyan
255
- puts "To".cyan + " Leave".yellow + " (".cyan + "'exit!'".yellow + ")\n".cyan
318
+ puts "Save To ".cyan + "Favorites ".light_cyan + "(".cyan + "s".yellow + ")".cyan
319
+ puts "View ".cyan + "Methods ".light_cyan + "For #{doc.name} (".cyan + "1".yellow + ")".cyan
320
+ puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
321
+ puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
256
322
  print randQ
257
323
  end
258
324
 
259
325
  def self.display_method_menu
260
- puts "To Return To".cyan + " Main Menu".yellow + " (Enter ".cyan + "'m'".yellow + ")".cyan
261
- puts "To".cyan + " Leave".yellow + " (".cyan + "'exit!'".yellow + ")\n".cyan
326
+ puts "Save To ".cyan + "Favorites ".light_cyan + "(".cyan + "s".yellow + ")".cyan
327
+ puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
328
+ puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
262
329
  print randQ
263
330
  end
264
331
 
265
332
  def self.browse_menu(page)
266
- puts "To ".cyan + "View ".yellow + "(Enter ".cyan + "#".yellow + ")".cyan + " eg. #{page.count.to_s} for #{page[page.count-1].name}".black
267
- puts "To ".cyan + "Browse Next Page ".yellow + "(Enter ".cyan + "'n'".yellow + ")".cyan
268
- puts "To Return To".cyan + " Main Menu".yellow + " (Enter ".cyan + "'m'".yellow + ")".cyan
269
- puts "To".cyan + " Leave".yellow + " (".cyan + "'exit!'".yellow + ")\n".cyan
333
+ puts "View Doc ".light_cyan + "(".cyan + "#".yellow + ")".cyan
334
+ puts "Next Page ".light_cyan + "(".cyan + "n".yellow + ")".cyan
335
+ puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
336
+ puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
270
337
  print randQ
271
338
  end
272
339
 
273
340
  def self.last_page_menu(page)
274
- puts "To ".cyan + "View ".yellow + "(Enter ".cyan + "#".yellow + ")".cyan + " eg. #{page.count.to_s} for #{page[page.count-1].name}".black
275
- puts "To Return To".cyan + " Main Menu".yellow + " (Enter ".cyan + "'m'".yellow + ")".cyan
276
- puts "To".cyan + " Leave".yellow + " (".cyan + "'exit!'".yellow + ")\n".cyan
341
+ puts "View Doc ".light_cyan + "(".cyan + "#".yellow + ")".cyan
342
+ puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
343
+ puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
277
344
  print randQ
278
345
  end
279
346
  #===================Error======================
@@ -283,6 +350,12 @@ class UI
283
350
  main_control
284
351
  end
285
352
 
353
+ def self.favorites_error
354
+ sleep(0.1)
355
+ print redH("\n You have no favorites saved ")
356
+ main_control
357
+ end
358
+
286
359
  def self.search_error
287
360
  puts sepB
288
361
  puts "NO CIGAR!".red
@@ -365,7 +438,7 @@ class UI
365
438
  end
366
439
  #-----------------separators-------------------
367
440
  def self.sepL
368
- puts "=".cyan*28 + "=".white*28
441
+ "=".cyan*28 + "=".white*28
369
442
  end
370
443
 
371
444
  def self.sepR
@@ -376,13 +449,17 @@ class UI
376
449
  "=".black*56
377
450
  end
378
451
  #------------------messages--------------------
452
+ def self.favorites_message
453
+ "Please Note: ".black + "/usr".light_black + " dir must exist in your current dir for\nthis to work. To learn more go to main menu & enter (".black + "?" + ")".black
454
+ end
455
+
379
456
  def self.redH(str)
380
457
  str.colorize(color: :white, background: :red)
381
- end#red highlight
458
+ end #red highlight
382
459
 
383
460
  def self.cyanH(str)
384
461
  str.colorize(color: :white, background: :cyan)
385
- end#cyan highlight
462
+ end #cyan highlight
386
463
  #------------------strings---------------------
387
464
  def self.rdo_prefix
388
465
  "https://ruby-doc.org/core-2.4.3/"
@@ -1,10 +1,10 @@
1
1
  class Klass
2
- #=======================properties==================================
2
+ #=============================properties============================
3
3
  attr_accessor :type, :name, :url, :short, :documentation, :methods
4
- #-------------------------------------------------------------------
4
+ #-------------------------------------------------------------------
5
5
  @@all = []
6
6
  def self.all; @@all; end
7
- #===================================================================
7
+ #=============================intialize=============================
8
8
  # count = 125
9
9
  def initialize(type, name, url)
10
10
  self.type = type
@@ -27,6 +27,33 @@ class Processor
27
27
  UI.nil_error
28
28
  end
29
29
  end
30
+ #===============================Save Doc==============================
31
+ def self.save(doc)
32
+ # if entry does not exist write else inform entry exist
33
+ if uniq(doc)
34
+ File.open("usr/favorites.txt", "a"){|l| l.puts doc.name}
35
+ puts "\r"
36
+ print doc.name.cyan + " Saved!".light_cyan
37
+
38
+ UI.display_class_control(doc)
39
+ else
40
+ puts "\r"
41
+ print doc.name.cyan + " Already Saved!".light_red
42
+
43
+ UI.display_class_control(doc)
44
+ end
45
+ end
46
+
47
+ def self.uniq(doc) # save(doc) Helper Method
48
+ # read => uniq boolean
49
+ File.open("usr/favorites.txt").none?{|l| l.chomp == doc.name}
50
+ end
51
+ #===============================Find Fav==============================
52
+ def self.find_fav(name)
53
+ doc = $DocDB.find{|doc| doc.name == name}
54
+
55
+ load_doc(doc)
56
+ end
30
57
  #================================SEARCH===============================
31
58
  def self.search(name)
32
59
  $DocDB.find_all{|doc| doc.name.downcase.include?(name)}
@@ -1,10 +1,10 @@
1
1
  class Meth
2
- #============================================================
2
+ #=========================properties=========================
3
3
  attr_accessor :type, :name, :url, :documentation
4
- #------------------------------------------------------------
4
+ #------------------------------------------------------------
5
5
  @@all = []
6
6
  def self.all; @@all; end
7
- #============================================================
7
+ #=========================intialize==========================
8
8
  # count 1839
9
9
  def initialize(type="n/a", name, url)
10
10
  self.type = type
@@ -12,9 +12,9 @@ class Meth
12
12
  self.url = url
13
13
  @@all << self
14
14
  end
15
- #============================================================
15
+ #===========================find=============================
16
16
  def self.find_by(url)
17
17
  Meth.all.find{|m| m.url == url}
18
18
  end
19
- #============================================================
19
+ #============================================================
20
20
  end
@@ -16,7 +16,7 @@ class Scraper < UI
16
16
  doc = Klass.new(type, name, url) if class_uniq(url)
17
17
  # keeps copy in DocDB
18
18
  $DocDB << doc if doc_uniq(url)
19
- end
19
+ end
20
20
  end
21
21
  #===========================LOAD METHODS=================================
22
22
  def self.load_methods
@@ -1,3 +1,3 @@
1
1
  module RubyDoc
2
- VERSION = "2.0.3"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Daniel Nunez"]
10
10
  spec.email = ["daniel.nunez.nyc@gmail.com"]
11
11
 
12
- spec.summary = %q{A CLI Gem that scrapes Ruby documentation.}
13
- spec.description = %q{Ever get tired of leaving your editor/environment to google a method, or more in depth info on a class or module? This gem aims to make Ruby referencing quick and more importantly, LOCAL. Ruby Doc scrapes Ruby documentation and allows users to quickly reference Ruby Language methods and additional information all on your terminal. Have a query? run, hunt, and done. Never lose momentum, keep all things in your line of sight and get right back to coding. Enjoy.}
12
+ spec.summary = %q{THE ULTIMATE RUBY DEVELOPER REFERENCING TOOL!}
13
+ spec.description = %q{Ruby Doc aims to make Ruby referencing quick and painless. This gem scrapes Ruby documentation and allows users to quickly reference Ruby classes, modules and methods all on your terminal in STYLE! Features include Search by Name, Paginated Browsing, Full documentation including Syntax and Source Code, Save to Favorites, Source Links, Seamless Navigation, and more. Have a query? Run, Hunt, and Done. Never lose momentum, keep all things in your line of sight, and get right back to coding!}
14
14
  spec.homepage = "https://github.com/AlphaDaniel/ruby_doc"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Nunez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-24 00:00:00.000000000 Z
11
+ date: 2018-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,12 +106,13 @@ dependencies:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: 1.8.1
109
- description: Ever get tired of leaving your editor/environment to google a method,
110
- or more in depth info on a class or module? This gem aims to make Ruby referencing
111
- quick and more importantly, LOCAL. Ruby Doc scrapes Ruby documentation and allows
112
- users to quickly reference Ruby Language methods and additional information all
113
- on your terminal. Have a query? run, hunt, and done. Never lose momentum, keep all
114
- things in your line of sight and get right back to coding. Enjoy.
109
+ description: Ruby Doc aims to make Ruby referencing quick and painless. This gem scrapes
110
+ Ruby documentation and allows users to quickly reference Ruby classes, modules and
111
+ methods all on your terminal in STYLE! Features include Search by Name, Paginated
112
+ Browsing, Full documentation including Syntax and Source Code, Save to Favorites,
113
+ Source Links, Seamless Navigation, and more. Have a query? Run, Hunt, and Done.
114
+ Never lose momentum, keep all things in your line of sight, and get right back to
115
+ coding!
115
116
  email:
116
117
  - daniel.nunez.nyc@gmail.com
117
118
  executables:
@@ -127,6 +128,7 @@ files:
127
128
  - LICENSE.txt
128
129
  - README.md
129
130
  - Rakefile
131
+ - _config.yml
130
132
  - bin/console
131
133
  - bin/ruby_doc
132
134
  - bin/setup
@@ -161,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
163
  version: '0'
162
164
  requirements: []
163
165
  rubyforge_project:
164
- rubygems_version: 2.7.4
166
+ rubygems_version: 2.7.6
165
167
  signing_key:
166
168
  specification_version: 4
167
- summary: A CLI Gem that scrapes Ruby documentation.
169
+ summary: THE ULTIMATE RUBY DEVELOPER REFERENCING TOOL!
168
170
  test_files: []