npr_cli_news_reader 0.2.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6bc48b3aa6d5410a0a6bd8ceab34c05615646322a0e7d3e63b2871d9ba44d9f
4
- data.tar.gz: caa3b3ca9ae015d245156380ae3eb7c01086b08eedb2fae0808590db80e1299e
3
+ metadata.gz: e84a560e21395d64e3d60fd172abbd040f48d58dbea05eb1a90c200a1610a646
4
+ data.tar.gz: b610e35446bcc0e1d314ca3ff90b311f257e360132691e82aa30b17fea22ccc9
5
5
  SHA512:
6
- metadata.gz: 24e3a943d90ad23e31097b7764b73b20731db83bc987871ac4711788b65458d4d16b54dc177f73cbcbcd57321b7f8873a906dbcb9ced69e05e06b6fa23a9e1cf
7
- data.tar.gz: 57fa73b4db9f2990b6ae13d2cd204e15af1b94799f0b52e602f7bde9c34a1790bfacf12f64225290a3aeb8145796795e16aad48d9f05156ef3b4b069e5132976
6
+ metadata.gz: fb772892317dd365e4d5b8dd02067b45ab11a848b77a6dea48ba06ffb9c942ad6247bf64d268b7638e00b0dc619f8f94510f5d3803d05cbdf89da560b5bdba02
7
+ data.tar.gz: 6a39af3d47cd75659cd36c72bf1e24b153e0318f0515b1dd2297d44b5e4210f488224fcb1463e2ca165cec7e285ef8c7caea2bc33422b547b4e683f5051ee84f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- npr_cli_news_reader (0.2.0)
4
+ npr_cli_news_reader (0.2.1)
5
5
  nokogiri
6
6
  rainbow
7
7
 
@@ -17,7 +17,7 @@ GEM
17
17
  coderay (~> 1.1.0)
18
18
  method_source (~> 0.9.0)
19
19
  rainbow (3.0.0)
20
- rake (10.5.0)
20
+ rake (13.0.1)
21
21
 
22
22
  PLATFORMS
23
23
  ruby
@@ -26,7 +26,7 @@ DEPENDENCIES
26
26
  bundler (~> 2.0)
27
27
  npr_cli_news_reader!
28
28
  pry
29
- rake (~> 10.0)
29
+ rake (~> 13.0)
30
30
 
31
31
  BUNDLED WITH
32
32
  2.0.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NprCliNewsReader
2
2
 
3
- This Gem allows a user to choose from a list of news categories. The ClI then displays the articles from npr.org that are under the selected category. Then the user can select a specific article. Once an article is selected then the full article will be displayed. Once the user gets to the end of the article they have a choice to exit the program or return to the category selection.
3
+ This Gem allows a user to choose from a list of news categories. The ClI then displays the articles from npr.org that are under the selected category. Then the user can select a specific article. Once an article is selected then the full article will be displayed. Once the user gets to the end of the article they have a choice to exit the program, return to the category selection, or return back to the article selection from the previous category selected.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,15 +18,19 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install npr_cli_news_reader
20
20
 
21
+ Or clone the git repository from github
22
+
23
+ In your terminal run:
24
+
25
+ $ git clone https://github.com/jgarcia4444/npr_cli_news_reader.git
26
+
27
+ $ ./bin/setup
28
+
29
+ $ ./bin/npr_cli_news_reader
30
+
21
31
  ## Usage
22
32
 
23
- In Terminal enter once installed:
24
33
 
25
- irb
26
- > require 'npr_cli_news_reader'
27
- > NprCliNewsReader::Run.start
28
-
29
- This command will start up the CLI application
30
34
 
31
35
 
32
36
  ## Development
@@ -1,17 +1,52 @@
1
1
  class NprCliNewsReader::CLI
2
2
 
3
- attr_accessor :selected_category
3
+ attr_accessor :selected_category, :done
4
4
 
5
5
  def initialize
6
+ @done = false
6
7
  @categories = ["National", "World", "Politics", "Business", "Health", "Science", "Technology", "Race & Culture"]
7
8
  end
8
-
9
- def call
9
+
10
+ def call
10
11
  greet_user
11
12
  present_categories
12
13
  handle_category_input
13
14
  handle_article_selection
14
- end
15
+ display_app_end_user_options
16
+ while @done == false
17
+ user_input = gets.strip
18
+ if user_input.downcase == 'category'
19
+ go_back_to_category_selection
20
+ elsif user_input.downcase == 'article'
21
+ go_back_to_articles
22
+ else
23
+ puts Rainbow('Thank you for using Npr CLI News Reader!').bright.fg(:white)
24
+ puts Rainbow('Goodbye!').bright.fg(:green)
25
+ @done = true
26
+ end
27
+ end
28
+ end
29
+
30
+ def go_back_to_articles
31
+ display_category_articles
32
+ handle_article_selection
33
+ display_app_end_user_options
34
+ end
35
+
36
+
37
+ def go_back_to_category_selection
38
+ present_categories
39
+ handle_category_input
40
+ handle_article_selection
41
+ display_app_end_user_options
42
+ end
43
+
44
+ def display_app_end_user_options
45
+ puts Rainbow("What would you like to do?").bright.fg(:white)
46
+ puts "#{Rainbow('Exit Program:').bright.fg(:white)} #{Rainbow('exit').bright.fg(:green)}"
47
+ puts "#{Rainbow('Go back to Category Selection:').bright.fg(:white)} #{Rainbow('category').bright.fg(:green)}"
48
+ puts "#{Rainbow('Go back to article selection:').bright.fg(:white)} #{Rainbow('article').bright.fg(:green)}"
49
+ end
15
50
 
16
51
  def greet_user
17
52
  puts Rainbow("Hello fellow fact finder...").bright
@@ -104,11 +139,14 @@ class NprCliNewsReader::CLI
104
139
  puts "\t#{paragraph_node.text}"
105
140
  puts "--------------------"
106
141
  end
107
- puts Rainbow("Would you like to see the article on your default web browse? (y/n):").bright
108
- user_input = gets.strip
109
- if ["yes, y"].include?(user_input.downcase)
110
- system("open #{article.article_url}")
142
+ open_default_browser(article)
143
+ end
144
+
145
+ def open_default_browser(article)
146
+ puts Rainbow("Would you like to view this article on the npr website? (Y/n): ").bright.fg(:white)
147
+ user_input = gets.strip.downcase
148
+ if user_input == 'y'
149
+ system("open", "#{article.article_url}")
111
150
  end
112
151
  end
113
-
114
152
  end
@@ -1,3 +1,3 @@
1
1
  module NprCliNewsReader
2
- VERSION = "0.2.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.require_paths = ["lib"]
38
38
 
39
39
  spec.add_development_dependency "bundler", "~> 2.0"
40
- spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rake", "~> 13.0"
41
41
  spec.add_development_dependency "pry"
42
42
  spec.add_dependency "nokogiri"
43
43
  spec.add_dependency "rainbow"
data/to_do_notes.md CHANGED
@@ -1,14 +1,5 @@
1
1
  TO DO NOTES
2
2
 
3
- - Once the article is read, give the user options
4
- - exit the program
5
- - go back to article selection
6
- - go back to category selection
7
-
8
- - Another feature could be to add a clickable link at the bottom of
9
- the article that states if clicked it will take them to the article
10
- on the NPR website.
11
-
12
3
  - Complete documentation for github
13
4
  - description
14
5
  - collaboration guidelines
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: npr_cli_news_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'Jake Garcia'"
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-29 00:00:00.000000000 Z
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement