ruby_doc 2.1.1 → 2.2.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 +4 -4
- data/Gemfile.lock +41 -0
- data/README.md +9 -4
- data/Rakefile +1 -0
- data/bin/ruby_doc +3 -13
- data/changelog.md +6 -0
- data/config/environment.rb +14 -8
- data/lib/ruby_doc/cli/ui.rb +21 -15
- data/lib/ruby_doc/data/data_processor.rb +9 -3
- data/lib/ruby_doc/version.rb +1 -1
- data/ruby_doc.gemspec +5 -3
- metadata +3 -3
- data/usr/favorites.txt +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 272850ea470347e025462827fb6429c161f1408afb96b87c63bbed09153a4d07
|
4
|
+
data.tar.gz: e0578513904f9a86277d31d5790e95ed181b58df409fdc3ab0170b082b91e973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62bb04ae57ecbcf6b77c832e367fae050369c8d0746cb97ffd15625efbc0d2d60863c20a130ffea1de2e8f00a61eab95e8012f4b5bc3849561e53b10bce9881b
|
7
|
+
data.tar.gz: 80f48133dbda303531c01e3ac8a7ad3ddf4d44cb79ea65eb22fdaf00969393cbbd3ffd7c280bd72e80396a3a566c28ac6cb500f67131d3bd21673f3d63a4de4c
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby_doc (2.2.0)
|
5
|
+
colorize (~> 0.8.1)
|
6
|
+
nokogiri (~> 1.8, >= 1.8.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
colorize (0.8.1)
|
12
|
+
diff-lcs (1.3)
|
13
|
+
mini_portile2 (2.3.0)
|
14
|
+
nokogiri (1.8.2)
|
15
|
+
mini_portile2 (~> 2.3.0)
|
16
|
+
rake (10.5.0)
|
17
|
+
rspec (3.7.0)
|
18
|
+
rspec-core (~> 3.7.0)
|
19
|
+
rspec-expectations (~> 3.7.0)
|
20
|
+
rspec-mocks (~> 3.7.0)
|
21
|
+
rspec-core (3.7.1)
|
22
|
+
rspec-support (~> 3.7.0)
|
23
|
+
rspec-expectations (3.7.0)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.7.0)
|
26
|
+
rspec-mocks (3.7.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.7.0)
|
29
|
+
rspec-support (3.7.1)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler (~> 1.16)
|
36
|
+
rake (~> 10.0)
|
37
|
+
rspec (~> 3.7, >= 3.7.0)
|
38
|
+
ruby_doc!
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.16.1
|
data/README.md
CHANGED
@@ -6,12 +6,13 @@
|
|
6
6
|
|
7
7
|
[](https://travis-ci.org/AlphaDaniel/ruby_doc)
|
8
8
|
[](https://rubygems.org/gems/ruby_doc)
|
9
|
-
[](https://github.com/AlphaDaniel/ruby_doc/releases)
|
10
|
-
[](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
|
9
|
+
[](https://github.com/AlphaDaniel/ruby_doc/releases)
|
10
|
+
[](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
|
12
11
|
[](https://github.com/AlphaDaniel/alpha-ruby_doc/blob/master/changelog.md)
|
13
12
|
[](http://a1phacoding.com/)
|
14
13
|
|
14
|
+
[](https://rubygems.org/gems/ruby_doc)
|
15
|
+
|
15
16
|
---
|
16
17
|
## A CLI Gem That Scrapes Ruby Documentation
|
17
18
|
|
@@ -31,7 +32,7 @@ Have a query? **Run, Hunt, and Done**. Never lose momentum, keep all things in y
|
|
31
32
|
## A Look Inside
|
32
33
|
[](http://forthebadge.com)
|
33
34
|
|
34
|
-

|
35
36
|
|
36
37
|
---
|
37
38
|
### Features:
|
@@ -83,6 +84,10 @@ And then execute
|
|
83
84
|
#### For Yourself:
|
84
85
|
|
85
86
|
$ gem install ruby_doc
|
87
|
+
|
88
|
+
And then execute
|
89
|
+
|
90
|
+
$ bundle
|
86
91
|
|
87
92
|
|
88
93
|
---
|
data/Rakefile
CHANGED
data/bin/ruby_doc
CHANGED
@@ -1,15 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
#=============================================================
|
3
3
|
require_relative '../config/environment'
|
4
|
-
|
5
|
-
|
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
|
-
#=======================================
|
13
|
-
RubyDoc::CLI.start_load
|
14
|
-
|
15
|
-
|
4
|
+
#=============================================================
|
5
|
+
RubyDoc::CLI.start_load
|
data/changelog.md
CHANGED
data/config/environment.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
-
|
1
|
+
# comment out before push
|
2
|
+
# require_relative './patches'
|
3
|
+
#====================Requires==============================
|
2
4
|
require "bundler/setup"
|
3
5
|
require 'fileutils'
|
4
6
|
require 'colorize'
|
5
7
|
require 'open-uri'
|
6
8
|
require 'nokogiri'
|
7
|
-
# require_relative './patches'
|
8
9
|
require_relative '../lib/ruby_doc/version'
|
9
|
-
|
10
|
+
#===========================Cli============================
|
10
11
|
require_relative '../lib/ruby_doc/cli/cli'
|
11
12
|
require_relative '../lib/ruby_doc/cli/ui'
|
12
|
-
|
13
|
+
#===========================Data===========================
|
13
14
|
require_relative '../lib/ruby_doc/data/class'
|
14
15
|
require_relative '../lib/ruby_doc/data/method'
|
15
16
|
require_relative '../lib/ruby_doc/data/scraper'
|
16
17
|
require_relative '../lib/ruby_doc/data/data_processor'
|
17
|
-
|
18
|
+
#=========================DataBase=========================
|
18
19
|
$DocDB = []
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
#========================Favorites=========================
|
21
|
+
def fav_dir
|
22
|
+
"#{Gem.path[0]}/gems/ruby_doc-#{RubyDoc::VERSION}/favs.txt"
|
23
|
+
end
|
24
|
+
FileUtils::touch "#{fav_dir}"
|
25
|
+
#=========================Testing==========================
|
26
|
+
# binding.pry
|
27
|
+
#==========================================================
|
data/lib/ruby_doc/cli/ui.rb
CHANGED
@@ -36,7 +36,10 @@ class UI
|
|
36
36
|
prompt
|
37
37
|
input = my_gets
|
38
38
|
|
39
|
-
if input == "
|
39
|
+
if input == "reset!"
|
40
|
+
Processor.reset_favs
|
41
|
+
RubyDoc::CLI.start
|
42
|
+
elsif input == "m"
|
40
43
|
RubyDoc::CLI.start
|
41
44
|
elsif input == "exit!"
|
42
45
|
exit!
|
@@ -181,7 +184,7 @@ class UI
|
|
181
184
|
def self.favorites_list
|
182
185
|
# Normalize Favorites List
|
183
186
|
list = []
|
184
|
-
File.open("
|
187
|
+
File.open("#{fav_dir}").each do |li|
|
185
188
|
list << li.chomp
|
186
189
|
end
|
187
190
|
|
@@ -192,8 +195,6 @@ class UI
|
|
192
195
|
|
193
196
|
else
|
194
197
|
puts sepL
|
195
|
-
puts favorites_message
|
196
|
-
puts sepB
|
197
198
|
|
198
199
|
# Iterated and display normalized favorites list
|
199
200
|
list.each_with_index do |f, index|
|
@@ -272,16 +273,12 @@ class UI
|
|
272
273
|
puts sepB
|
273
274
|
puts "FAVORITES".cyan
|
274
275
|
puts sepB
|
275
|
-
puts wrapped("
|
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)
|
276
|
+
puts wrapped("Favorites now persisting to gem directory. Your favorites will be accessible globally throughout all your directories unless/until you uninstall this gem.", 55)
|
278
277
|
puts "\n"
|
279
|
-
puts wrapped("
|
278
|
+
puts wrapped("When updating this gem, ruby_doc will check if your favorites file contains any entries (you have favorites saved). If you have entries at the time of the update, it will copy your favorites over to your new (version) gem directory so that you never lose your entries.", 55)
|
280
279
|
puts "\n"
|
281
|
-
puts "
|
282
|
-
puts wrapped("
|
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)
|
280
|
+
puts "Note:".red
|
281
|
+
puts wrapped("The aforementioned 'Update Proof' will not be coded in until the next update but it won't be needed until then regardless so save away.", 55)
|
285
282
|
|
286
283
|
puts sepB
|
287
284
|
puts "COMING SOON".cyan
|
@@ -309,6 +306,7 @@ class UI
|
|
309
306
|
|
310
307
|
def self.list_menu(matches)
|
311
308
|
puts "View Doc ".light_cyan + "(".cyan + "#".yellow + ")".cyan
|
309
|
+
puts "Reset Favorites ".light_cyan + "(".cyan + "reset!".yellow + ")".cyan if matches.first.is_a?(String)
|
312
310
|
puts "Return To ".cyan + "Main Menu ".light_cyan + "(".cyan + "m".yellow + ")".cyan
|
313
311
|
puts "Leave".light_cyan + " (".cyan + "exit!".yellow + ")".cyan
|
314
312
|
print randQ
|
@@ -372,7 +370,11 @@ class UI
|
|
372
370
|
end
|
373
371
|
|
374
372
|
def self.list_error(matches)
|
375
|
-
|
373
|
+
if matches.first.is_a?(String)
|
374
|
+
print redH("\n Enter '#' to view, 'reset!', 'm' for main or 'exit!' to leave ")
|
375
|
+
else
|
376
|
+
print redH("\n Enter selection number, 'm' for main or 'exit!' to leave ")
|
377
|
+
end
|
376
378
|
end
|
377
379
|
|
378
380
|
def self.nil_error
|
@@ -449,8 +451,12 @@ class UI
|
|
449
451
|
"=".black*56
|
450
452
|
end
|
451
453
|
#------------------messages--------------------
|
452
|
-
def self.
|
453
|
-
|
454
|
+
def self.reset_favs_message
|
455
|
+
puts sepB
|
456
|
+
puts "Favorites Deleted!".red
|
457
|
+
puts "Redirecting to main menu ..."
|
458
|
+
puts sepB
|
459
|
+
sleep(2.5)
|
454
460
|
end
|
455
461
|
|
456
462
|
def self.redH(str)
|
@@ -31,7 +31,7 @@ class Processor
|
|
31
31
|
def self.save(doc)
|
32
32
|
# if entry does not exist write else inform entry exist
|
33
33
|
if uniq(doc)
|
34
|
-
File.open("
|
34
|
+
File.open("#{fav_dir}", "a"){|l| l.puts doc.name}
|
35
35
|
puts "\r"
|
36
36
|
print doc.name.cyan + " Saved!".light_cyan
|
37
37
|
|
@@ -46,14 +46,20 @@ class Processor
|
|
46
46
|
|
47
47
|
def self.uniq(doc) # save(doc) Helper Method
|
48
48
|
# read => uniq boolean
|
49
|
-
File.open("
|
49
|
+
File.open("#{fav_dir}").none?{|l| l.chomp == doc.name}
|
50
50
|
end
|
51
51
|
#===============================Find Fav==============================
|
52
52
|
def self.find_fav(name)
|
53
53
|
doc = $DocDB.find{|doc| doc.name == name}
|
54
54
|
|
55
55
|
load_doc(doc)
|
56
|
-
end
|
56
|
+
end
|
57
|
+
#==============================Reset Favs=============================
|
58
|
+
def self.reset_favs
|
59
|
+
open("#{fav_dir}", File::TRUNC) {}
|
60
|
+
|
61
|
+
UI.reset_favs_message
|
62
|
+
end
|
57
63
|
#================================SEARCH===============================
|
58
64
|
def self.search(name)
|
59
65
|
$DocDB.find_all{|doc| doc.name.downcase.include?(name)}
|
data/lib/ruby_doc/version.rb
CHANGED
data/ruby_doc.gemspec
CHANGED
@@ -24,9 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
|
27
|
-
|
28
|
-
#==============================================
|
27
|
+
#==============================================================
|
29
28
|
spec.add_dependency "colorize", "~>0.8.1"
|
30
29
|
spec.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.1'
|
31
|
-
|
30
|
+
#==============================================================
|
31
|
+
# comment out before push
|
32
|
+
# spec.add_development_dependency "pry", "~>0.11.3"
|
33
|
+
#==============================================================
|
32
34
|
end
|
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.
|
4
|
+
version: 2.2.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-03-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".travis.yml"
|
111
111
|
- CODE_OF_CONDUCT.md
|
112
112
|
- Gemfile
|
113
|
+
- Gemfile.lock
|
113
114
|
- LICENSE.txt
|
114
115
|
- README.md
|
115
116
|
- Rakefile
|
@@ -128,7 +129,6 @@ files:
|
|
128
129
|
- lib/ruby_doc/data/scraper.rb
|
129
130
|
- lib/ruby_doc/version.rb
|
130
131
|
- ruby_doc.gemspec
|
131
|
-
- usr/favorites.txt
|
132
132
|
homepage: https://github.com/AlphaDaniel/ruby_doc
|
133
133
|
licenses:
|
134
134
|
- MIT
|
data/usr/favorites.txt
DELETED
File without changes
|