nhkore 0.3.7 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +53 -2
- data/Gemfile +0 -18
- data/Gemfile.lock +36 -33
- data/README.md +36 -30
- data/Rakefile +38 -52
- data/bin/nhkore +4 -15
- data/lib/nhkore/app.rb +235 -234
- data/lib/nhkore/article.rb +39 -53
- data/lib/nhkore/article_scraper.rb +293 -285
- data/lib/nhkore/cleaner.rb +20 -32
- data/lib/nhkore/cli/fx_cmd.rb +41 -53
- data/lib/nhkore/cli/get_cmd.rb +59 -70
- data/lib/nhkore/cli/news_cmd.rb +143 -153
- data/lib/nhkore/cli/search_cmd.rb +108 -118
- data/lib/nhkore/cli/sift_cmd.rb +109 -120
- data/lib/nhkore/datetime_parser.rb +88 -104
- data/lib/nhkore/defn.rb +48 -55
- data/lib/nhkore/dict.rb +26 -38
- data/lib/nhkore/dict_scraper.rb +31 -40
- data/lib/nhkore/entry.rb +43 -55
- data/lib/nhkore/error.rb +16 -21
- data/lib/nhkore/fileable.rb +10 -21
- data/lib/nhkore/lib.rb +5 -17
- data/lib/nhkore/missingno.rb +21 -33
- data/lib/nhkore/news.rb +58 -72
- data/lib/nhkore/polisher.rb +22 -34
- data/lib/nhkore/scraper.rb +74 -83
- data/lib/nhkore/search_link.rb +62 -76
- data/lib/nhkore/search_scraper.rb +81 -92
- data/lib/nhkore/sifter.rb +157 -171
- data/lib/nhkore/splitter.rb +19 -31
- data/lib/nhkore/user_agents.rb +28 -32
- data/lib/nhkore/util.rb +72 -84
- data/lib/nhkore/variator.rb +20 -32
- data/lib/nhkore/version.rb +4 -16
- data/lib/nhkore/word.rb +99 -97
- data/lib/nhkore.rb +8 -20
- data/nhkore.gemspec +30 -51
- data/samples/looper.rb +18 -29
- data/test/nhkore/test_helper.rb +3 -15
- data/test/nhkore_test.rb +6 -18
- metadata +33 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc298d17b3c9ee8377bbbe86758f8e25a0bbb3e876752c64968bef635a03c5a4
|
4
|
+
data.tar.gz: 5935c3ba9918290aaa81a0b41189dcc400df17eea543d2c5baa38d5f0363576d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d025d796348807303f2dcf74ef2901dc05f2b55f8b4bd4e28410ef64b26dea0bef7897a3cd46000996bfc60aff4303dad931bf97b176224b2395ec360cdf6e
|
7
|
+
data.tar.gz: cdc0938140e2d83b5b4f60a93781bc24d23445d1e5fd85ad6f7619dea78f06a2ae7d29fdf4d85c29d25d7bca37e60a2a397ea613cb3dd05a445b1e4970bbf775
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,48 @@
|
|
1
1
|
# Changelog | NHKore
|
2
2
|
|
3
|
-
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
Format is based on [Keep a Changelog v1.0.0](https://keepachangelog.com/en/1.0.0),
|
6
|
+
and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [[Unreleased]](https://github.com/esotericpig/nhkore/compare/v0.3.11...HEAD)
|
9
|
+
-
|
10
|
+
|
11
|
+
|
12
|
+
## [v0.3.11] - 2021-10-25
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Updated `nokogiri` gem for *Dependabot* security vulnerability.
|
16
|
+
|
17
|
+
|
18
|
+
## [v0.3.10] - 2021-07-13
|
19
|
+
|
20
|
+
### Fixed
|
21
|
+
- Updated `public_suffix` gem, which has a dependency on `addressable` gem vulnerability found by *Dependabot*.
|
22
|
+
|
23
|
+
|
24
|
+
## [v0.3.9] - 2021-06-26
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- Reverted `App#refresh_cmd()` back to not copying over the `default_proc` (from v0.3.8). Because the old code didn't know about this, it created some unintended issues with command options. Nothing major, but for example, specifying `output.html` with the `sift` command would not produce HTML output (however, using the `-e html` option still worked). This is the only instance that I know of, but reverting the code back in case of more instances. In the future, I'll need to thoroughly test all CLI options after changing `App#refresh_cmd()` to copy over the `default_proc`, but for now, not worrying about it (as it's not necessary).
|
28
|
+
|
29
|
+
|
30
|
+
## [v0.3.8] - 2021-06-26
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
- Fixed `App#refresh_cmd()` to also copy Cri's `default_proc` to the new Hash for the command options.
|
34
|
+
- Fixed to check for non-strings for JSON & URI.
|
35
|
+
- For JSON, convert `StringIO` to string in `DictScraper.scrape()`.
|
36
|
+
- For URL, convert URL using `URI()` because `URI.parse()` will crash with a non-string (URI object) in `Scraper.open_url()`.
|
37
|
+
- Fixed to scrape multiple HTML Ruby tag words (instead of just 1).
|
38
|
+
- I thought multiple Ruby bases/texts (`<rb>`/`<rt>`) were invalid, but after running into the article below and checking the HTML with a validator, it's actually valid HTML:
|
39
|
+
- https://www3.nhk.or.jp/news/easy/k10012759201000/k10012759201000.html
|
40
|
+
- No previous articles/URLs ran into this problem (would have raised an error), so it should only be a problem with this specific, new article.
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
- Formatted/Linted all code using RuboCop.
|
44
|
+
- Updated Gems.
|
4
45
|
|
5
|
-
## [[Unreleased]](https://github.com/esotericpig/nhkore/compare/v0.3.7...HEAD)
|
6
46
|
|
7
47
|
## [v0.3.7] - 2020-11-07
|
8
48
|
|
@@ -20,6 +60,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
20
60
|
- https://www3.nhk.or.jp/news/easy/k10012639271000/k10012639271000.html
|
21
61
|
- `第3のビール` should have HTML ruby tags around *第*
|
22
62
|
|
63
|
+
|
23
64
|
## [v0.3.6] - 2020-08-18
|
24
65
|
|
25
66
|
### Added
|
@@ -35,6 +76,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
35
76
|
- Ignored `/cgi2.*enqform/` URLs from SearchScraper (Bing)
|
36
77
|
- Added more detail to dictionary error in ArticleScraper
|
37
78
|
|
79
|
+
|
38
80
|
## [v0.3.5] - 2020-05-04
|
39
81
|
|
40
82
|
### Added
|
@@ -45,6 +87,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
45
87
|
- Fixed URLs stored in YAML data to always be of type String (not URI)
|
46
88
|
- This initially caused a problem in DictScraper.parse_url() from ArticleScraper, but fixed it for all data
|
47
89
|
|
90
|
+
|
48
91
|
## [v0.3.4] - 2020-04-25
|
49
92
|
|
50
93
|
### Added
|
@@ -66,12 +109,14 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
66
109
|
- `-d '3-3'`
|
67
110
|
- `-d '3'`
|
68
111
|
|
112
|
+
|
69
113
|
## [v0.3.3] - 2020-04-23
|
70
114
|
|
71
115
|
### Added
|
72
116
|
- Added JSON support to Sifter & SiftCmd.
|
73
117
|
- Added use of `attr_bool` Gem for `attr_accessor?` & `attr_reader?`.
|
74
118
|
|
119
|
+
|
75
120
|
## [v0.3.2] - 2020-04-22
|
76
121
|
|
77
122
|
### Added
|
@@ -95,6 +140,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
95
140
|
- ArticleScraper
|
96
141
|
- Renamed `mode` param to `strict`. `mode` was overshadowing File.open()'s in Scraper.
|
97
142
|
|
143
|
+
|
98
144
|
## [v0.3.1] - 2020-04-20
|
99
145
|
|
100
146
|
### Changed
|
@@ -112,6 +158,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
112
158
|
- BingScraper
|
113
159
|
- Fixed possible RSS infinite loop.
|
114
160
|
|
161
|
+
|
115
162
|
## [v0.3.0] - 2020-04-12
|
116
163
|
|
117
164
|
### Added
|
@@ -146,7 +193,9 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
146
193
|
- ignore empty filenames in the Zip for safety.
|
147
194
|
- ask to overwrite files instead of erroring.
|
148
195
|
|
196
|
+
|
149
197
|
## [v0.2.0] - 2020-04-01
|
198
|
+
|
150
199
|
First working version.
|
151
200
|
|
152
201
|
### Added
|
@@ -182,7 +231,9 @@ First working version.
|
|
182
231
|
- test/nhkore_tester.rb
|
183
232
|
- Renamed to `test/nhkore/test_helper.rb`
|
184
233
|
|
234
|
+
|
185
235
|
## [v0.1.0] - 2020-02-24
|
236
|
+
|
186
237
|
### Added
|
187
238
|
- .gitignore
|
188
239
|
- CHANGELOG.md
|
data/Gemfile
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of NHKore.
|
6
|
-
# Copyright (c) 2020 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# NHKore is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# NHKore is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with NHKore. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
4
|
|
23
5
|
source 'https://rubygems.org'
|
24
6
|
|
data/Gemfile.lock
CHANGED
@@ -1,86 +1,89 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nhkore (0.3.
|
4
|
+
nhkore (0.3.11)
|
5
5
|
attr_bool (~> 0.2)
|
6
6
|
bimyou_segmenter (~> 1.2)
|
7
7
|
cri (~> 2.15)
|
8
|
-
down (~> 5.
|
8
|
+
down (~> 5.2)
|
9
9
|
highline (~> 2.0)
|
10
10
|
http-cookie (~> 1.0)
|
11
11
|
japanese_deinflector (~> 0.0)
|
12
|
-
nokogiri (~> 1.
|
12
|
+
nokogiri (~> 1.12)
|
13
13
|
psychgus (~> 1.3)
|
14
14
|
public_suffix (~> 4.0)
|
15
15
|
rainbow (~> 3.0)
|
16
16
|
rubyzip (~> 2.3)
|
17
17
|
tiny_segmenter (~> 0.0)
|
18
|
-
tty-progressbar (~> 0.
|
18
|
+
tty-progressbar (~> 0.18)
|
19
19
|
tty-spinner (~> 0.9)
|
20
20
|
|
21
21
|
GEM
|
22
22
|
remote: https://rubygems.org/
|
23
23
|
specs:
|
24
|
-
addressable (2.
|
24
|
+
addressable (2.8.0)
|
25
25
|
public_suffix (>= 2.0.2, < 5.0)
|
26
|
-
attr_bool (0.2.
|
26
|
+
attr_bool (0.2.2)
|
27
27
|
bimyou_segmenter (1.2.0)
|
28
|
-
cri (2.15.
|
28
|
+
cri (2.15.11)
|
29
29
|
domain_name (0.5.20190701)
|
30
30
|
unf (>= 0.0.5, < 1.0.0)
|
31
|
-
down (5.2.
|
32
|
-
addressable (~> 2.
|
31
|
+
down (5.2.4)
|
32
|
+
addressable (~> 2.8)
|
33
33
|
highline (2.0.3)
|
34
|
-
http-cookie (1.0.
|
34
|
+
http-cookie (1.0.4)
|
35
35
|
domain_name (~> 0.5)
|
36
36
|
japanese_deinflector (0.0.2)
|
37
|
-
mini_portile2 (2.
|
38
|
-
minitest (5.14.
|
39
|
-
nokogiri (1.
|
40
|
-
mini_portile2 (~> 2.
|
41
|
-
|
42
|
-
|
37
|
+
mini_portile2 (2.6.1)
|
38
|
+
minitest (5.14.4)
|
39
|
+
nokogiri (1.12.5)
|
40
|
+
mini_portile2 (~> 2.6.1)
|
41
|
+
racc (~> 1.4)
|
42
|
+
psych (4.0.2)
|
43
|
+
psychgus (1.3.4)
|
43
44
|
psych (>= 3.0)
|
44
45
|
public_suffix (4.0.6)
|
46
|
+
racc (1.6.0)
|
45
47
|
rainbow (3.0.0)
|
46
|
-
rake (13.0.
|
47
|
-
raketeer (0.2.
|
48
|
+
rake (13.0.6)
|
49
|
+
raketeer (0.2.13)
|
48
50
|
rake
|
49
|
-
rdoc (6.2
|
50
|
-
redcarpet (3.5.
|
51
|
-
rubyzip (2.3.
|
52
|
-
strings-ansi (0.
|
51
|
+
rdoc (6.3.2)
|
52
|
+
redcarpet (3.5.1)
|
53
|
+
rubyzip (2.3.2)
|
54
|
+
strings-ansi (0.2.0)
|
53
55
|
tiny_segmenter (0.0.6)
|
54
56
|
tty-cursor (0.7.1)
|
55
|
-
tty-progressbar (0.
|
56
|
-
strings-ansi (~> 0.
|
57
|
+
tty-progressbar (0.18.2)
|
58
|
+
strings-ansi (~> 0.2)
|
57
59
|
tty-cursor (~> 0.7)
|
58
|
-
tty-screen (~> 0.
|
59
|
-
unicode-display_width (
|
60
|
+
tty-screen (~> 0.8)
|
61
|
+
unicode-display_width (>= 1.6, < 3.0)
|
60
62
|
tty-screen (0.8.1)
|
61
63
|
tty-spinner (0.9.3)
|
62
64
|
tty-cursor (~> 0.7)
|
63
65
|
unf (0.1.4)
|
64
66
|
unf_ext
|
65
|
-
unf_ext (0.0.
|
66
|
-
unicode-display_width (1.
|
67
|
-
yard (0.9.
|
68
|
-
yard_ghurt (1.2.
|
67
|
+
unf_ext (0.0.8)
|
68
|
+
unicode-display_width (2.1.0)
|
69
|
+
yard (0.9.26)
|
70
|
+
yard_ghurt (1.2.1)
|
69
71
|
rake
|
72
|
+
yard
|
70
73
|
|
71
74
|
PLATFORMS
|
72
75
|
ruby
|
73
76
|
|
74
77
|
DEPENDENCIES
|
75
|
-
bundler (~> 2.
|
78
|
+
bundler (~> 2.2)
|
76
79
|
minitest (~> 5.14)
|
77
80
|
nhkore!
|
78
81
|
rake (~> 13.0)
|
79
82
|
raketeer (~> 0.2)
|
80
|
-
rdoc (~> 6.
|
83
|
+
rdoc (~> 6.3)
|
81
84
|
redcarpet (~> 3.5)
|
82
85
|
yard (~> 0.9)
|
83
86
|
yard_ghurt (~> 1.2)
|
84
87
|
|
85
88
|
BUNDLED WITH
|
86
|
-
2.
|
89
|
+
2.2.29
|
data/README.md
CHANGED
@@ -435,18 +435,18 @@ require 'nhkore/scraper'
|
|
435
435
|
s = NHKore::Scraper.new('https://www3.nhk.or.jp/news/easy/',
|
436
436
|
open_timeout: 300, # Open timeout in seconds (default: nil)
|
437
437
|
read_timeout: 300, # Read timeout in seconds (default: nil)
|
438
|
-
|
438
|
+
|
439
439
|
# Maximum number of times to retry the URL
|
440
440
|
# - default: 3
|
441
441
|
# - Open/connect will fail a couple of times on a bad/slow internet connection.
|
442
442
|
max_retries: 10,
|
443
|
-
|
443
|
+
|
444
444
|
# Maximum number of redirects allowed.
|
445
445
|
# - default: 3
|
446
446
|
# - You can set this to nil or -1, but I recommend using a number
|
447
447
|
# for safety (infinite-loop attack).
|
448
448
|
max_redirects: 1,
|
449
|
-
|
449
|
+
|
450
450
|
# How to check redirect URLs for safety.
|
451
451
|
# - default: :strict
|
452
452
|
# - nil => do not check
|
@@ -455,7 +455,7 @@ s = NHKore::Scraper.new('https://www3.nhk.or.jp/news/easy/',
|
|
455
455
|
# - :strict => check the scheme and domain
|
456
456
|
# (i.e., if https://bing.com, redirect URL must be https://bing.com)
|
457
457
|
redirect_rule: :lenient,
|
458
|
-
|
458
|
+
|
459
459
|
# Set the HTTP header field 'cookie' from the 'set-cookie' response.
|
460
460
|
# - default: false
|
461
461
|
# - Currently uses the 'http-cookie' Gem.
|
@@ -463,7 +463,7 @@ s = NHKore::Scraper.new('https://www3.nhk.or.jp/news/easy/',
|
|
463
463
|
# - Necessary for Search Engines or other sites that require cookies
|
464
464
|
# in order to block bots.
|
465
465
|
eat_cookie: true,
|
466
|
-
|
466
|
+
|
467
467
|
# Set HTTP header fields.
|
468
468
|
# - default: nil
|
469
469
|
# - Necessary for Search Engines or other sites that try to block bots.
|
@@ -526,9 +526,9 @@ doc = ss.html_doc()
|
|
526
526
|
|
527
527
|
doc.css('a').each() do |anchor|
|
528
528
|
link = anchor['href']
|
529
|
-
|
529
|
+
|
530
530
|
next if ss.ignore_link?(link,cleaned: false)
|
531
|
-
|
531
|
+
|
532
532
|
if link.include?('https://www3.nhk')
|
533
533
|
puts link
|
534
534
|
end
|
@@ -549,9 +549,9 @@ page_num = 1
|
|
549
549
|
|
550
550
|
while !next_page.empty?()
|
551
551
|
puts "Page #{page_num += 1}: #{next_page.count}"
|
552
|
-
|
552
|
+
|
553
553
|
bs = NHKore::BingScraper.new(:yasashii,url: next_page.url)
|
554
|
-
|
554
|
+
|
555
555
|
next_page = bs.scrape(slinks,next_page)
|
556
556
|
end
|
557
557
|
|
@@ -570,24 +570,24 @@ require 'time'
|
|
570
570
|
|
571
571
|
as = NHKore::ArticleScraper.new(
|
572
572
|
'https://www3.nhk.or.jp/news/easy/k10011862381000/k10011862381000.html',
|
573
|
-
|
573
|
+
|
574
574
|
# If false, scrape the article leniently (for older articles which
|
575
575
|
# may not have certain tags, etc.).
|
576
576
|
# - default: true
|
577
577
|
strict: false,
|
578
|
-
|
578
|
+
|
579
579
|
# {Dict} to use as the dictionary for words (Easy articles).
|
580
580
|
# - default: :scrape
|
581
581
|
# - nil => don't scrape/use it (necessary for Regular articles)
|
582
582
|
# - :scrape => auto-scrape it using {DictScraper}
|
583
583
|
# - {Dict} => your own {Dict}
|
584
584
|
dict: nil,
|
585
|
-
|
585
|
+
|
586
586
|
# Date time to use as a fallback if the article doesn't have one
|
587
587
|
# (for older articles).
|
588
588
|
# - default: nil
|
589
589
|
datetime: Time.new(2020,2,2),
|
590
|
-
|
590
|
+
|
591
591
|
# Year to use as a fallback if the article doesn't have one
|
592
592
|
# (for older articles).
|
593
593
|
# - default: nil
|
@@ -624,7 +624,7 @@ require 'nhkore/dict_scraper'
|
|
624
624
|
url = 'https://www3.nhk.or.jp/news/easy/k10011862381000/k10011862381000.html'
|
625
625
|
ds = NHKore::DictScraper.new(
|
626
626
|
url,
|
627
|
-
|
627
|
+
|
628
628
|
# Change the URL appropriately to the dictionary URL.
|
629
629
|
# - default: true
|
630
630
|
parse_url: true,
|
@@ -637,13 +637,13 @@ dict = ds.scrape()
|
|
637
637
|
|
638
638
|
dict.entries.each() do |key,entry|
|
639
639
|
entry.id
|
640
|
-
|
640
|
+
|
641
641
|
entry.defns.each() do |defn|
|
642
642
|
defn.hyoukis.each() {|hyouki| }
|
643
643
|
defn.text
|
644
644
|
defn.words.each() {|word| }
|
645
645
|
end
|
646
|
-
|
646
|
+
|
647
647
|
puts entry.build_hyouki()
|
648
648
|
puts entry.build_defn()
|
649
649
|
puts '---'
|
@@ -789,13 +789,13 @@ JPN = ['桜','ぶ','ブ']
|
|
789
789
|
|
790
790
|
def fmt_jpn()
|
791
791
|
fmt = []
|
792
|
-
|
792
|
+
|
793
793
|
JPN.each() do |x|
|
794
794
|
x = yield(x)
|
795
795
|
x = x ? "\u2B55" : Util::JPN_SPACE unless x.is_a?(String)
|
796
796
|
fmt << x
|
797
797
|
end
|
798
|
-
|
798
|
+
|
799
799
|
return "[ #{fmt.join(' | ')} ]"
|
800
800
|
end
|
801
801
|
|
@@ -858,17 +858,23 @@ This will update *core/* for you:
|
|
858
858
|
|
859
859
|
### Releasing [^](#contents)
|
860
860
|
|
861
|
-
1. Update *CHANGELOG.md*, *version.rb*, & *Gemfile.lock
|
862
|
-
- *Raketary*:
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
861
|
+
1. Update *CHANGELOG.md*, *version.rb*, & *Gemfile.lock*:
|
862
|
+
- With *Raketary*:
|
863
|
+
- `$ raketary bump -v`
|
864
|
+
- `$ raketary bump -p`
|
865
|
+
- `$ bundle update`
|
866
|
+
- `$ bundle outdated`
|
867
|
+
2. Update *core* package:
|
868
|
+
- `$ bundle exec rake update_core`
|
869
|
+
- `$ bundle exec rake clobber pkg_core`
|
870
|
+
3. Create a new tag & release:
|
871
|
+
- Note: make sure to add *pkg/nhkore-core.zip*
|
872
|
+
- `$ gh release create v0 pkg/*.gem pkg/*.zip`
|
873
|
+
- `$ git pull`
|
874
|
+
4. Release to *GitHub Packages*:
|
875
|
+
- With *Raketary*: `$ raketary github_pkg`
|
876
|
+
5. Release to *RubyGems*:
|
877
|
+
- `$ bundle exec rake release`
|
872
878
|
|
873
879
|
Releasing new HTML file for website:
|
874
880
|
|
@@ -879,7 +885,7 @@ Releasing new HTML file for website:
|
|
879
885
|
[GNU LGPL v3+](LICENSE.txt)
|
880
886
|
|
881
887
|
> NHKore (<https://github.com/esotericpig/nhkore>)
|
882
|
-
> Copyright (c) 2020 Jonathan Bradley Whited
|
888
|
+
> Copyright (c) 2020-2021 Jonathan Bradley Whited
|
883
889
|
>
|
884
890
|
> NHKore is free software: you can redistribute it and/or modify
|
885
891
|
> it under the terms of the GNU Lesser General Public License as published by
|
data/Rakefile
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of NHKore.
|
6
|
-
# Copyright (c) 2020 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# NHKore is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# NHKore is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with NHKore. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
4
|
|
23
5
|
require 'bundler/gem_tasks'
|
24
6
|
|
@@ -42,20 +24,20 @@ CLOBBER.include('doc/',File.join(PKG_DIR,''))
|
|
42
24
|
task default: [:test]
|
43
25
|
|
44
26
|
desc 'Generate documentation (YARDoc)'
|
45
|
-
task :
|
27
|
+
task doc: %i[yard yard_gfm_fix] do |task|
|
46
28
|
end
|
47
29
|
|
48
30
|
desc "Package '#{File.join(NHKore::Util::CORE_DIR,'')}' data as a Zip file into '#{File.join(PKG_DIR,'')}'"
|
49
31
|
task :pkg_core do |task|
|
50
32
|
mkdir_p PKG_DIR
|
51
|
-
|
33
|
+
|
52
34
|
pattern = File.join(NHKore::Util::CORE_DIR,'*.{csv,html,json,yml}')
|
53
35
|
zip_file = File.join(PKG_DIR,'nhkore-core.zip')
|
54
|
-
|
55
|
-
sh 'zip','-9rv',zip_file,*Dir.glob(pattern).sort
|
36
|
+
|
37
|
+
sh 'zip','-9rv',zip_file,*Dir.glob(pattern).sort
|
56
38
|
end
|
57
39
|
|
58
|
-
Rake::TestTask.new
|
40
|
+
Rake::TestTask.new do |task|
|
59
41
|
task.libs = ['lib','test']
|
60
42
|
task.pattern = File.join('test','**','*_test.rb')
|
61
43
|
task.description += ": '#{task.pattern}'"
|
@@ -68,73 +50,77 @@ end
|
|
68
50
|
desc "Update '#{File.join(NHKore::Util::CORE_DIR,'')}' files for release"
|
69
51
|
task :update_core do |task|
|
70
52
|
require 'highline'
|
71
|
-
|
72
|
-
|
73
|
-
|
53
|
+
|
54
|
+
continue_msg = "\nContinue (y/n)? "
|
55
|
+
|
74
56
|
cmd = ['ruby','-w','./lib/nhkore.rb','-t','300','-m','10']
|
75
|
-
hl = HighLine.new
|
76
|
-
|
57
|
+
hl = HighLine.new
|
58
|
+
|
77
59
|
next unless sh(*cmd,'se','ez','bing')
|
78
|
-
next unless hl.agree(
|
60
|
+
next unless hl.agree(continue_msg)
|
79
61
|
puts
|
80
|
-
|
81
|
-
next unless sh(*cmd,'news','-s','
|
82
|
-
next unless hl.agree(
|
62
|
+
|
63
|
+
next unless sh(*cmd,'news','-s','500','ez')
|
64
|
+
next unless hl.agree(continue_msg)
|
83
65
|
puts
|
84
|
-
|
66
|
+
|
85
67
|
next unless sh(*cmd,'sift','-e','csv' ,'ez')
|
68
|
+
puts
|
86
69
|
next unless sh(*cmd,'sift','-e','html','ez')
|
70
|
+
puts
|
87
71
|
next unless sh(*cmd,'sift','-e','json','ez')
|
72
|
+
puts
|
88
73
|
next unless sh(*cmd,'sift','-e','yml' ,'ez')
|
74
|
+
puts
|
89
75
|
end
|
90
76
|
|
91
77
|
# @since 0.3.6
|
92
78
|
desc 'Update showcase file for release'
|
93
79
|
task :update_showcase do |task|
|
94
80
|
require 'highline'
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
hl = HighLine.new
|
99
|
-
|
81
|
+
|
82
|
+
showcase_file = File.join('.','nhkore-ez.html')
|
83
|
+
|
84
|
+
hl = HighLine.new
|
85
|
+
|
100
86
|
next unless sh('ruby','-w','./lib/nhkore.rb',
|
101
87
|
'sift','ez','--no-eng',
|
102
|
-
'--out',
|
88
|
+
'--out',showcase_file,
|
103
89
|
)
|
104
|
-
|
90
|
+
|
105
91
|
next unless hl.agree("\nMove the file (y/n)? ")
|
106
92
|
puts
|
107
|
-
next unless sh('mv','-iv',
|
93
|
+
next unless sh('mv','-iv',showcase_file,
|
108
94
|
File.join('..','esotericpig.github.io','showcase',''),
|
109
95
|
)
|
110
96
|
end
|
111
97
|
|
112
|
-
YARD::Rake::YardocTask.new
|
98
|
+
YARD::Rake::YardocTask.new do |task|
|
113
99
|
task.options += ['--template-path',File.join('yard','templates')]
|
114
100
|
task.options += ['--title',"NHKore v#{NHKore::VERSION} Doc"]
|
115
101
|
end
|
116
102
|
|
117
103
|
# Execute "rake yard_gfm_fix" for production.
|
118
104
|
# Execute "rake yard_gfm_fix[true]" for testing locally.
|
119
|
-
YardGhurt::GFMFixTask.new
|
105
|
+
YardGhurt::GFMFixTask.new do |task|
|
120
106
|
task.arg_names = [:dev]
|
121
107
|
task.dry_run = false
|
122
108
|
task.fix_code_langs = true
|
123
109
|
task.md_files = ['index.html']
|
124
|
-
|
125
|
-
task.before =
|
110
|
+
|
111
|
+
task.before = proc do |t,args|
|
126
112
|
# Delete this file as it's never used (index.html is an exact copy).
|
127
|
-
YardGhurt::Util.rm_exist(File.join(
|
128
|
-
|
113
|
+
YardGhurt::Util.rm_exist(File.join(t.doc_dir,'file.README.html'))
|
114
|
+
|
129
115
|
# Root dir of my GitHub Page for CSS/JS.
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
116
|
+
ghp_root = YardGhurt::Util.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
|
117
|
+
|
118
|
+
t.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{ghp_root}/css/prism.css" />)
|
119
|
+
t.js_scripts << %Q(<script src="#{ghp_root}/js/prism.js"></script>)
|
134
120
|
end
|
135
121
|
end
|
136
122
|
|
137
123
|
# Probably not useful for others.
|
138
|
-
YardGhurt::GHPSyncTask.new
|
124
|
+
YardGhurt::GHPSyncTask.new do |task|
|
139
125
|
task.ghp_dir = '../esotericpig.github.io/docs/nhkore/yardoc'
|
140
126
|
end
|
data/bin/nhkore
CHANGED
@@ -4,24 +4,13 @@
|
|
4
4
|
|
5
5
|
#--
|
6
6
|
# This file is part of NHKore.
|
7
|
-
# Copyright (c) 2020 Jonathan Bradley Whited
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# NHKore is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU Lesser General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU Lesser General Public License
|
20
|
-
# along with NHKore. If not, see <https://www.gnu.org/licenses/>.
|
7
|
+
# Copyright (c) 2020-2021 Jonathan Bradley Whited
|
8
|
+
#
|
9
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
21
10
|
#++
|
22
11
|
|
23
12
|
|
24
13
|
require 'nhkore'
|
25
14
|
|
26
15
|
|
27
|
-
NHKore.run
|
16
|
+
NHKore.run
|