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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e87adb893e411ac96818aa6c5a04d8994e11d5aa2736a58fed3f6a2ce59f57ee
4
- data.tar.gz: 0a0402c800b03c74cd796b4025dc84579e02cc58eb91d233daf07c85659317b0
3
+ metadata.gz: 272850ea470347e025462827fb6429c161f1408afb96b87c63bbed09153a4d07
4
+ data.tar.gz: e0578513904f9a86277d31d5790e95ed181b58df409fdc3ab0170b082b91e973
5
5
  SHA512:
6
- metadata.gz: 46195b07b8bdb1d452b231245e6b48db6f44462a74dd65c1450f9bddbb3f936129041912ccc22d9184ee93b5879a408c415145e5b089aa21babf3858d3bbfdca
7
- data.tar.gz: d0eb31478f4fb7e08d8d988fd9ac041a274bb9c1a556693a97f4af37fbf0f1f402937b99f816a5c487686c7e9df30dd660419321b8fc3f97e4148d34ff87fc95
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
  [![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
- [![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)
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)
9
+ [![Release Date](https://img.shields.io/github/release-date/AlphaDaniel/ruby_doc.svg?colorB=49C529)](https://github.com/AlphaDaniel/ruby_doc/releases)
10
+ [![GitHub last commit](https://img.shields.io/github/last-commit/AlphaDaniel/alpha-ruby_doc.svg?colorB=49C529)](https://github.com/AlphaDaniel/alpha-ruby_doc/commits/master)
12
11
  [![Changelog](https://img.shields.io/badge/change-log-blue.svg)](https://github.com/AlphaDaniel/alpha-ruby_doc/blob/master/changelog.md)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ding.com/)
14
13
 
14
+ [![Downloads](https://ruby-gem-downloads-badge.herokuapp.com/ruby_doc?type=total&?&style=social)](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
  [![forthebadge](http://forthebadge.com/images/badges/thats-how-they-get-you.svg)](http://forthebadge.com)
33
34
 
34
- ![image](https://i.imgur.com/qAW4sNY.gif)
35
+ ![screenshots](https://i.imgur.com/UuEwILB.gif)
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
@@ -3,6 +3,7 @@ require 'rspec/core/rake_task'
3
3
  task :default => :spec
4
4
 
5
5
  require_relative './config/environment'
6
+ Scraper.load_classes and Scraper.load_methods
6
7
 
7
8
  task :console do
8
9
  Pry.start
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
- # 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
- #=======================================
13
- RubyDoc::CLI.start_load
14
-
15
-
4
+ #=============================================================
5
+ RubyDoc::CLI.start_load
data/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ v2.1.2 (2018-03-21)
2
+ ------------------
3
+
4
+ * Patch - Favorites now persist to gem directory, access globally
5
+ * Feature - Reset favorites option on favorites menu.
6
+
1
7
  v2.1.1 (2018-03-01)
2
8
  ------------------
3
9
 
@@ -1,21 +1,27 @@
1
- #====================Requires===================
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
- #======================Cli======================
10
+ #===========================Cli============================
10
11
  require_relative '../lib/ruby_doc/cli/cli'
11
12
  require_relative '../lib/ruby_doc/cli/ui'
12
- #=====================Data======================
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
- #====================DataBase===================
18
+ #=========================DataBase=========================
18
19
  $DocDB = []
19
- #====================Testing====================
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
+ #==========================================================
@@ -36,7 +36,10 @@ class UI
36
36
  prompt
37
37
  input = my_gets
38
38
 
39
- if input == "m"
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("usr/favorites.txt").each do |li|
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("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)
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("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)
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 "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)
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
- print redH("\n Enter selection number, 'm' for main or 'exit!' to leave ")
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.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
+ 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("usr/favorites.txt", "a"){|l| l.puts doc.name}
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("usr/favorites.txt").none?{|l| l.chomp == doc.name}
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)}
@@ -1,3 +1,3 @@
1
1
  module RubyDoc
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
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
- # spec.add_development_dependency "pry", "~>0.11.3"
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.1.1
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-01 00:00:00.000000000 Z
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