kovid 0.3.1 β 0.3.2
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 +1 -1
- data/README.md +22 -26
- data/kovid.gemspec +23 -23
- data/lib/kovid/cli.rb +12 -10
- data/lib/kovid/request.rb +2 -2
- data/lib/kovid/tablelize.rb +4 -4
- data/lib/kovid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4205df6f2e487214f535dda994a132264a9966b6c7527dec22f908f7aad76ed
|
4
|
+
data.tar.gz: 24b98f27cddcff29ed2a75d02be4af8d81fb2078d138890d75c9fb3541207bdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5e2f6b14c57dc707d81f5711ea6d2004300d253f8ba7afb0d453d14bd2f73210de62d73d2457caf7ed221ad8d27b192db2e511e749903bb25cd31bbfe3be02
|
7
|
+
data.tar.gz: 7fc35f3888744cbadcfe131e080ef56a3d9b0055f8437316f5286f364ab71391a6322df951c86c707ab43d3669b839aaed58fa3108913c36d6d252ce3759dca5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,59 +1,55 @@
|
|
1
1
|
# π¦ Kovid
|
2
2
|
|
3
|
-
[
|
4
|
-
|
5
|
-
Kovid is a small CLI app to fetch data surrounding the coronavirus pandemic of 2019. I found myself checking [Wikipedia](https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic) constantly for information and since I work mostly in the terminal, like some of you, I thought I'd build this to put the data right at our fingertips.
|
3
|
+
Kovid is a small CLI app to fetch data surrounding the coronavirus pandemic of 2019. I found myself checking [Wikipedia](https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic) constantly for information so I thought I'd build this to provide info directly in the terminal. It's where some of us spend time more.
|
6
4
|
|
7
5
|
Code contribution and ideas welcome.
|
8
6
|
|
9
7
|
|
10
8
|
## βοΈ Installation
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
βοΈ Wash your hands with soap and water for at least 20 seconds.
|
15
|
-
|
16
|
-
βοΈ Run `gem install kovid`
|
10
|
+
To install:
|
17
11
|
|
18
|
-
|
12
|
+
* οΈ Wash your hands with soap and water for at least 20 seconds.
|
19
13
|
|
14
|
+
* Run `gem install kovid`.
|
20
15
|
|
16
|
+
It's recommended you update often with `gem update kovid`.
|
21
17
|
|
22
18
|
## βοΈ Usage
|
23
19
|
|
24
20
|
You can run `kovid --help` to see the full list of available commands.
|
25
21
|
|
26
|
-
**NOTE:** If you find it irritating to have to type `kovid state STATE`, `covid state STATE` works as well.
|
27
|
-
|
28
22
|
#### Commands Overview
|
29
23
|
π· **Fetching**
|
30
|
-
* `kovid check COUNTRY`
|
31
|
-
* `kovid check COUNTRY -f` OR `kovid check COUNTRY --full
|
24
|
+
* `kovid check COUNTRY` OR `kovid country COUNTRY`.
|
25
|
+
* `kovid check COUNTRY -f` OR `kovid check COUNTRY --full`.
|
32
26
|
|
33
|
-
|
34
|
-
|
27
|
+
πΊπΈπΊπΈπΊπΈ
|
28
|
+
|
29
|
+
You can fetch US state-specific data:
|
30
|
+
* `kovid state STATE` OR `kovid state "STATE NAME"`.
|
35
31
|
|
36
32
|
π· **Comparing**
|
37
|
-
* `kovid compare
|
38
|
-
* `kovid compare
|
33
|
+
* `kovid compare FOO BAR` (sorts by cases DESC).
|
34
|
+
* `kovid compare FOO BAR -f` OR `kovid compare FOO BAR --full` (sorts by cases DESC).
|
35
|
+
|
36
|
+
Where `FOO` and `BAR` are different countries.
|
39
37
|
|
40
|
-
You can compare as many countries as you want
|
38
|
+
You can compare as many countries as you want; `kovid compare FOO BAR BAZ` OR `kovid compare FOO BAR BAZ -f`
|
41
39
|
|
42
40
|
π· **History**
|
43
|
-
* `kovid history COUNTRY` (full history)
|
44
|
-
* `kovid history COUNTRY N` (history in the last N days)
|
41
|
+
* `kovid history COUNTRY` (full history).
|
42
|
+
* `kovid history COUNTRY N` (history in the last N days).
|
45
43
|
|
46
44
|
π· **Total figures**
|
47
|
-
* `kovid cases`
|
48
|
-
|
45
|
+
* `kovid cases` (summary of reported incidents globally).
|
49
46
|
|
47
|
+
**NOTE:** If you find it irritating to have to type `kovid state STATE`, `covid state STATE` works as well.
|
50
48
|
|
51
49
|
#### Commands Details
|
52
50
|
To fetch basic data on a country run:
|
53
51
|
|
54
|
-
`kovid check ghana`
|
55
|
-
|
56
|
-
If the location contains spaces: `kovid check "Diamond Princess"`
|
52
|
+
`kovid check ghana`. If the location contains spaces: `kovid check "Diamond Princess"`
|
57
53
|
|
58
54
|

|
59
55
|
|
@@ -106,7 +102,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
106
102
|
|
107
103
|
## π€² Contributing
|
108
104
|
|
109
|
-
There are multiple areas in this repo that can be improved or use some refactoring(there's a lot to be
|
105
|
+
There are multiple areas in this repo that can be improved or use some refactoring(there's a lot to be refactored in fact!). For that reason, bug reports and pull requests are welcome! 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/siaw23/kovid/blob/master/CODE_OF_CONDUCT.md).
|
110
106
|
|
111
107
|
|
112
108
|
## π License
|
data/kovid.gemspec
CHANGED
@@ -14,6 +14,29 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
16
16
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/siaw23/kovid"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/siaw23/kovid"
|
20
|
+
|
21
|
+
spec.add_dependency "thor", "~> 1.0"
|
22
|
+
spec.add_dependency "terminal-table", "~> 1.8"
|
23
|
+
spec.add_dependency "typhoeus", "~> 1.3"
|
24
|
+
spec.add_dependency "rainbow", "~> 3.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "cucumber"
|
28
|
+
spec.add_development_dependency "aruba"
|
29
|
+
spec.add_development_dependency "simplecov"
|
30
|
+
|
31
|
+
# Specify which files should be added to the gem when it is released.
|
32
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
34
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
|
+
end
|
36
|
+
spec.bindir = "exe"
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
17
40
|
spec.post_install_message = %q{
|
18
41
|
============================================================================
|
19
42
|
COVID-19 has devasted the world. But while we're fighting
|
@@ -31,27 +54,4 @@ Gem::Specification.new do |spec|
|
|
31
54
|
Emmanuel Hayford.
|
32
55
|
============================================================================
|
33
56
|
}
|
34
|
-
|
35
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
36
|
-
spec.metadata["source_code_uri"] = "https://github.com/siaw23/kovid"
|
37
|
-
spec.metadata["changelog_uri"] = "https://github.com/siaw23/kovid"
|
38
|
-
|
39
|
-
# Specify which files should be added to the gem when it is released.
|
40
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
41
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
42
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
43
|
-
end
|
44
|
-
spec.bindir = "exe"
|
45
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
46
|
-
spec.require_paths = ["lib"]
|
47
|
-
|
48
|
-
spec.add_dependency "thor", "~> 1.0"
|
49
|
-
spec.add_dependency "terminal-table", "~> 1.8"
|
50
|
-
spec.add_dependency "typhoeus", "~> 1.3"
|
51
|
-
spec.add_dependency "rainbow", "~> 3.0"
|
52
|
-
|
53
|
-
spec.add_development_dependency "pry"
|
54
|
-
spec.add_development_dependency "cucumber"
|
55
|
-
spec.add_development_dependency "aruba"
|
56
|
-
spec.add_development_dependency "simplecov"
|
57
57
|
end
|
data/lib/kovid/cli.rb
CHANGED
@@ -15,21 +15,13 @@ module Kovid
|
|
15
15
|
desc 'check COUNTRY or check "COUNTRY NAME"', 'Returns reported data on provided country. eg: "kovid check "hong kong".'
|
16
16
|
method_option :full, aliases: '-f'
|
17
17
|
def check(name)
|
18
|
-
|
19
|
-
puts Kovid.country_full(name)
|
20
|
-
else
|
21
|
-
puts Kovid.country(name)
|
22
|
-
end
|
18
|
+
fetch_country_stats(name)
|
23
19
|
end
|
24
20
|
|
25
21
|
desc 'country COUNTRY or country "COUNTRY NAME"', 'Returns reported data on provided country. eg: "kovid country "hong kong".'
|
26
22
|
method_option :full, aliases: '-f'
|
27
23
|
def country(name)
|
28
|
-
|
29
|
-
puts Kovid.country_full(name)
|
30
|
-
else
|
31
|
-
puts Kovid.country(name)
|
32
|
-
end
|
24
|
+
fetch_country_stats(name)
|
33
25
|
end
|
34
26
|
|
35
27
|
desc 'state STATE', 'Return reported data on provided state.'
|
@@ -59,5 +51,15 @@ module Kovid
|
|
59
51
|
puts Kovid.history(params.first, nil)
|
60
52
|
end
|
61
53
|
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def fetch_country_stats(country)
|
58
|
+
if options[:full]
|
59
|
+
puts Kovid.country_full(country)
|
60
|
+
else
|
61
|
+
puts Kovid.country(country)
|
62
|
+
end
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
data/lib/kovid/request.rb
CHANGED
@@ -59,8 +59,8 @@ module Kovid
|
|
59
59
|
private
|
60
60
|
|
61
61
|
def no_case_in(country)
|
62
|
-
rows = [[
|
63
|
-
Terminal::Table.new
|
62
|
+
rows = [["Wrong spelling of location/API has no info on #{country.upcase} at the moment."]]
|
63
|
+
Terminal::Table.new title: "You checked: #{country.upcase}", rows: rows
|
64
64
|
end
|
65
65
|
|
66
66
|
def fetch_countries(list)
|
data/lib/kovid/tablelize.rb
CHANGED
@@ -28,7 +28,7 @@ module Kovid
|
|
28
28
|
rows = [[data['cases'], data['deaths'], data['recovered']]]
|
29
29
|
|
30
30
|
if iso = data['countryInfo']['iso2']
|
31
|
-
Terminal::Table.new(title:
|
31
|
+
Terminal::Table.new(title: data['country'].upcase.to_s, headings: headings, rows: rows)
|
32
32
|
else
|
33
33
|
Terminal::Table.new(title: data['country'].upcase, headings: headings, rows: rows)
|
34
34
|
end
|
@@ -63,9 +63,9 @@ module Kovid
|
|
63
63
|
# headings: headings,
|
64
64
|
# rows: rows)
|
65
65
|
# else
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
Terminal::Table.new(title: data['country'].upcase,
|
67
|
+
headings: headings,
|
68
|
+
rows: rows)
|
69
69
|
# end
|
70
70
|
# TODO: Rafactor this
|
71
71
|
end
|
data/lib/kovid/version.rb
CHANGED