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 +4 -4
- data/.travis.yml +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -2
- data/Rakefile +4 -1
- data/changelog.md +6 -0
- data/lib/ruby_doc/cli/ui.rb +39 -20
- data/lib/ruby_doc/data/data_processor.rb +1 -1
- data/lib/ruby_doc/data/scraper.rb +8 -9
- data/lib/ruby_doc/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23787b43ce20d4680b93a29e6a7721ea68995abdde3c16bb0393de33c14f5c06
|
4
|
+
data.tar.gz: 01326f6b467e6fd4b6e7b57c58b0e04ded7c0b24baf1b9648bf1543284fab932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9589e5b3c8d6d75f68ef31c9f8976a4cc15da85acc4fddaa83544a84d5440493edbbe95b8a4ab0a8618d455c535a1640162d336915c2c3f980cbe83922db7aac
|
7
|
+
data.tar.gz: d5f3ac5eca09fb1a85a7e4df0cb9f726cc0690ebda230645325088a60d755ba3afb269285d616ef97a01b20d8f8b2d7b15a952cc75877f9423b080e5a33e3946
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|

|
5
5
|

|
6
6
|
|
7
|
-
[](https://travis-ci.org/AlphaDaniel/ruby_doc)
|
8
|
+
[](https://rubygems.org/gems/ruby_doc)
|
9
|
+
[](https://rubygems.org/gems/ruby_doc)
|
8
10
|
[](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
|
9
|
-
[](https://rubygems.org/gems/ruby_doc)
|
10
11
|
[](https://github.com/AlphaDaniel/alpha-ruby_doc/blob/master/changelog.md)
|
11
12
|
[](http://a1phacoding.com/)
|
12
13
|
|
data/Rakefile
CHANGED
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
|
|
data/lib/ruby_doc/cli/ui.rb
CHANGED
@@ -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
|
-
|
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
|
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 "
|
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
|
-
|
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
|
-
|
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=
|
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
|
-
|
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(
|
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 +
|
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(
|
101
|
-
Meth.all.none?{|method| method.
|
99
|
+
def self.method_uniq(name)
|
100
|
+
Meth.all.none?{|method| method.name == name}
|
102
101
|
end
|
103
102
|
|
104
|
-
def self.doc_uniq(
|
105
|
-
$DocDB.none?{|doc| doc.
|
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 = ""
|
data/lib/ruby_doc/version.rb
CHANGED
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.
|
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
|