covid_19_updates 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2ad7e8b17a3d5c38143a605e8eb00435d36d05fedecc226caef34059fe3a8de5
4
+ data.tar.gz: 94b65be7797916ca34910ccb711d2d0f203c1e3010b6b786a01a800715ec2c23
5
+ SHA512:
6
+ metadata.gz: 1848ffadea7048b82ce790def43f951e5db4187c8c420d83b4b8980d73436081efe634901282d4ae4420f386cedf86ff6c484d7c54e8553e8870cce10a27c03a
7
+ data.tar.gz: f42f6cca5388d8c3208989e65e14df85c11a1a413eccfc0c0c1999f8ff088afe73db2d54c77605e93958f8143463ff55ea9fd1cf94be1d2ba0565e11e2a39738
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.1
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jck13mad@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in covid_19_updates.gemspec
6
+ gemspec
7
+
8
+ gem 'covid_19_updates'
9
+ gem 'rake', '~> 12.0'
10
+ gem 'rspec', '~> 3.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ covid_19_updates (0.1.0)
5
+ colorize
6
+ nokogiri
7
+ thor (>= 1.0.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ colorize (0.8.1)
13
+ diff-lcs (1.3)
14
+ mini_portile2 (2.4.0)
15
+ nokogiri (1.10.9)
16
+ mini_portile2 (~> 2.4.0)
17
+ rake (12.3.3)
18
+ rspec (3.9.0)
19
+ rspec-core (~> 3.9.0)
20
+ rspec-expectations (~> 3.9.0)
21
+ rspec-mocks (~> 3.9.0)
22
+ rspec-core (3.9.1)
23
+ rspec-support (~> 3.9.1)
24
+ rspec-expectations (3.9.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.9.0)
27
+ rspec-mocks (3.9.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.9.0)
30
+ rspec-support (3.9.2)
31
+ thor (1.0.1)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ covid_19_updates!
38
+ rake (~> 12.0)
39
+ rspec (~> 3.0)
40
+
41
+ BUNDLED WITH
42
+ 1.17.2
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Covid19Updates
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/covid_19_updates`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'covid_19_updates'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install covid_19_updates
22
+
23
+ ## Usage
24
+ When gem has been downloaded, run 'cov list' to start program. All other instructions will be placed on screen for user to respond to. Thank you and be safe out there!
25
+
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jck13mad/covid_19_updates. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/jck13mad/covid_19_updates/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## Code of Conduct
39
+
40
+ Everyone interacting in the Covid19Updates project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/covid_19_updates/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'covid_19_updates'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/covid_19_updates/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'covid_19_updates'
7
+ spec.version = Covid19Updates::VERSION
8
+ spec.authors = ['Jack Madden']
9
+ spec.email = ['jck13mad@gmail.com']
10
+
11
+ spec.summary = 'Find out the latest on the Covd-19 Pandemic.'
12
+ spec.description = 'Find out the latest on the Covd-19 Pandemic.'
13
+ spec.homepage = 'https://rubygems.org/'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
15
+
16
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://rubygems.org/'
20
+ spec.metadata['changelog_uri'] = 'https://rubygems.org/'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_dependency 'colorize'
32
+ spec.add_dependency 'nokogiri'
33
+ spec.add_dependency 'thor', '>= 1.0.1'
34
+ end
data/exe/cov ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'covid_19_updates'
5
+
6
+ Covid19Updates::CLI.start
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'covid_19_updates'
5
+
6
+ Covid19Updates::CLI.start
data/lib/.DS_Store ADDED
Binary file
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'covid_19_updates/version'
4
+ require 'covid_19_updates/cli'
5
+
6
+ module Covid19Updates
7
+ # class CLI < Thor
8
+ # desc "greet NAME", "say hello to NAME"
9
+ # def greet(name)
10
+ # puts "Hello #{name}"
11
+ # end
12
+ # end
13
+ end
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'nokogiri'
5
+ require 'open-uri'
6
+ require 'colorize'
7
+
8
+ module Covid19Updates
9
+ class CLI < Thor
10
+ def self.exit_on_failure
11
+ true
12
+ end
13
+
14
+ desc 'start', 'Prints out greeting and basic commands'
15
+ def start
16
+ list
17
+ end
18
+
19
+ desc 'start', 'Prints out greeting and basic commands'
20
+ def list
21
+ list_new_networks
22
+
23
+ news_net = ask('Enter number assigned to news network')
24
+
25
+ case news_net
26
+ when '1'
27
+ cnbc_headline
28
+ when '2'
29
+ fox_headline
30
+ when '3'
31
+ stat_headline
32
+ else
33
+ puts 'No news source by that number.'.red.bold
34
+ puts ""
35
+ puts ""
36
+ call
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ def cnbc_headline
43
+ doc = Nokogiri::HTML(URI.open('https://www.cnbc.com/coronavirus/'))
44
+
45
+ items = doc.css('div.Card-titleContainer')
46
+
47
+ array = []
48
+ items.each do |item|
49
+ array << { title: item.text, link: item.children.attribute('href').value }
50
+ end
51
+
52
+ array.each_with_index do |news, index|
53
+ puts "#{index.succ}: #{news[:title]}"
54
+ end
55
+
56
+ puts
57
+ pick = ask('Please pick a number to view an update: ')
58
+ puts
59
+
60
+ print Nokogiri::HTML(URI.open((array[pick.to_i - 1][:link]).to_s)).css('div.group').text.gsub('Â', '').light_blue
61
+ puts
62
+
63
+ continue
64
+ end
65
+
66
+ def fox_headline
67
+ doc = Nokogiri::HTML(URI.open('https://www.foxnews.com/category/health/infectious-disease/coronavirus'))
68
+ items = doc.css('header.info-header')
69
+
70
+ array = []
71
+ items.each do |item|
72
+ if item.at_css('h4.title a')&.text != nil
73
+ array << { title: item.at_css('h4.title a')&.text, link: item.at_css('h4.title a')&.attribute('href')&.value }
74
+ end
75
+ end
76
+
77
+ final = array.map! do |item|
78
+ item unless item[:link].start_with?('https')
79
+ end.compact.each do |item|
80
+ item[:link] = item[:link].prepend('https://foxnews.com')
81
+ end
82
+
83
+ final.each_with_index do |news, index|
84
+ puts "#{index.succ}: #{news[:title]}"
85
+ end
86
+
87
+ puts
88
+ pick = ask('Please pick a number to view an update: ')
89
+ puts
90
+
91
+
92
+ # n.css('p')[rand(3..(n.css('p').count))].text (n.css('p').count)
93
+ n = final[pick.to_i - 1][:link].to_s
94
+ node = Nokogiri::HTML(URI.open(n)).css('p')
95
+
96
+ print node[rand(3..(node.count-4))].text.light_blue
97
+ puts
98
+
99
+ continue
100
+ end
101
+
102
+ def stat_headline
103
+ doc = Nokogiri::HTML(URI.open('https://www.statnews.com/tag/coronavirus/'))
104
+ items = doc.css('a.post-title-link')
105
+
106
+ # binding.irb
107
+
108
+ array = []
109
+ items.each do |item|
110
+ array << { title: item.text, link: item.attribute('href').value }
111
+ end
112
+
113
+ array.each_with_index do |news, index|
114
+ puts "#{index.succ}: #{news[:title]}"
115
+ end
116
+
117
+ puts
118
+ pick = ask('Please pick a number to view an update: ')
119
+ puts
120
+
121
+ print Nokogiri::HTML(URI.open((array[pick.to_i - 1][:link]).to_s)).css('a.post-title-link').text.light_blue
122
+ puts
123
+
124
+ continue
125
+ end
126
+
127
+ def continue
128
+ puts ""
129
+ puts ""
130
+ message = ask('Would you like to continue reading updates? (y/n)')
131
+
132
+ if message == "y"
133
+ call
134
+ else
135
+ puts "Thank you and be safe out there!".light_blue
136
+ end
137
+ end
138
+
139
+
140
+ def call
141
+ greeting = <<~DOC
142
+
143
+ 1. CNBC
144
+ 2. FOX NEWS
145
+ 3. STAT NEWS
146
+
147
+ Enter the number of news website you would like to see updates from.\n Please type cov list to see options or exit to leave.
148
+ DOC
149
+ puts greeting.green.bold
150
+ news_net = ask('Enter number assigned to news network')
151
+
152
+ case news_net
153
+ when '1'
154
+ cnbc_headline
155
+ when '2'
156
+ fox_headline
157
+ when '3'
158
+ stat_headline
159
+ else
160
+ puts 'No news source by that number.'.red.bold
161
+ puts ""
162
+ puts ""
163
+ call
164
+ end
165
+ end
166
+
167
+
168
+ def list_new_networks
169
+ greeting = <<~DOC
170
+ Welcome to Covid-19 Updates!
171
+ View the top headlines from the following sites:
172
+
173
+ 1. CNBC
174
+ 2. FOX NEWS
175
+ 3. STAT NEWS
176
+
177
+ Enter the number of news website you would like to see updates from.\n Please type list to see options or exit to leave.
178
+ DOC
179
+ puts greeting.cyan.bold
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Covid19Updates
4
+ VERSION = '0.1.1'
5
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: covid_19_updates
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Jack Madden
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.1
55
+ description: Find out the latest on the Covd-19 Pandemic.
56
+ email:
57
+ - jck13mad@gmail.com
58
+ executables:
59
+ - cov
60
+ - covid_19_updates
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".DS_Store"
65
+ - ".gitignore"
66
+ - ".rspec"
67
+ - ".travis.yml"
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - covid_19_updates.gemspec
76
+ - exe/cov
77
+ - exe/covid_19_updates
78
+ - lib/.DS_Store
79
+ - lib/covid_19_updates.rb
80
+ - lib/covid_19_updates/cli.rb
81
+ - lib/covid_19_updates/version.rb
82
+ homepage: https://rubygems.org/
83
+ licenses: []
84
+ metadata:
85
+ allowed_push_host: https://rubygems.org/
86
+ homepage_uri: https://rubygems.org/
87
+ source_code_uri: https://rubygems.org/
88
+ changelog_uri: https://rubygems.org/
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 2.3.0
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.0.3
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Find out the latest on the Covd-19 Pandemic.
108
+ test_files: []