nhkore 0.3.6 → 0.3.10

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: 445adf6e8abd4da9fd6dd25e9632d5f477b467f6ce8c3dcecae87e3f61305d98
4
- data.tar.gz: ca812639ff1edd8da835f5bbb2cde403c9cb63e17568fb3ec367eec00605ec17
3
+ metadata.gz: 8fd13f6cd3ad8e69daa44f5318515d5efe104c13a90a755c617cfd53302c4b50
4
+ data.tar.gz: 9ec8ea4b9a9f4f9862fb81611cf99b3bafdb20a6a35038fcc3d14cc934cbcdfc
5
5
  SHA512:
6
- metadata.gz: 392607205c53aa2a5dfcde244e5fa6137483d216dc27becf06c76798209d2dcf328f17abee2026d795207d4e783a23fd108e615525445f52ca6442560600cd42
7
- data.tar.gz: 7a1219623b6645bbc633ba9c94e767dcf86be8852a7228c1d5ddd3936f61b884897f680369d4c9d9db5aba8ab4561048d59aed15cecf7ba05695c1957f31b0ea
6
+ metadata.gz: 72b94a39a10e9e6dcfd74e032f45c679fee961f1f6c6f09a229720db07896566400983e83dd5a9a496f13ea3554c8be3ee2a80da6883ee44109c4bca917e14d4
7
+ data.tar.gz: 7a6a23790df9c138de0a1944d2f6146cba697303dc30a57eccba2f6b71342254afa67296cdfa70dae88e2aa78ccba5a401d2b8996b7b64b3a28460811b0283f7
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --files 'CHANGELOG.md,LICENSE.txt'
2
+ --protected
3
+ --readme 'README.md'
data/CHANGELOG.md CHANGED
@@ -1,8 +1,59 @@
1
1
  # Changelog | NHKore
2
2
 
3
- Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
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.10...HEAD)
9
+ -
10
+
11
+
12
+ ## [v0.3.10] - 2021-07-13
13
+
14
+ ### Fixed
15
+ - Updated `public_suffix` gem, which has a dependency on `addressable` gem vulnerability found by *Dependabot*.
16
+
17
+
18
+ ## [v0.3.9] - 2021-06-26
19
+
20
+ ### Fixed
21
+ - 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).
22
+
23
+
24
+ ## [v0.3.8] - 2021-06-26
25
+
26
+ ### Fixed
27
+ - Fixed `App#refresh_cmd()` to also copy Cri's `default_proc` to the new Hash for the command options.
28
+ - Fixed to check for non-strings for JSON & URI.
29
+ - For JSON, convert `StringIO` to string in `DictScraper.scrape()`.
30
+ - For URL, convert URL using `URI()` because `URI.parse()` will crash with a non-string (URI object) in `Scraper.open_url()`.
31
+ - Fixed to scrape multiple HTML Ruby tag words (instead of just 1).
32
+ - 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:
33
+ - https://www3.nhk.or.jp/news/easy/k10012759201000/k10012759201000.html
34
+ - 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.
35
+
36
+ ### Changed
37
+ - Formatted/Linted all code using RuboCop.
38
+ - Updated Gems.
39
+
40
+
41
+ ## [v0.3.7] - 2020-11-07
42
+
43
+ ### Changed
44
+ - Updated Gem `attr_bool` to v0.2
45
+ - Changed upper-case *'-V'* flag for *version* to be a lower-case *'-v'*
46
+ - Seems like a lot of apps/people expect this
47
+ - Refactored/Formatted some code
48
+ - *nhkore.gemspec* especially
49
+ - Added *samples/*, *Gemfile.lock*, and *.yardopts* to the files in *nhkore.gemspec*
50
+
51
+ ### Fixed
52
+ - ArticleScraper
53
+ - Fixed to accept text nodes that have Kanji, due to bad article:
54
+ - https://www3.nhk.or.jp/news/easy/k10012639271000/k10012639271000.html
55
+ - `第3のビール` should have HTML ruby tags around *第*
4
56
 
5
- ## [[Unreleased]](https://github.com/esotericpig/nhkore/compare/v0.3.6...master)
6
57
 
7
58
  ## [v0.3.6] - 2020-08-18
8
59
 
@@ -19,6 +70,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
19
70
  - Ignored `/cgi2.*enqform/` URLs from SearchScraper (Bing)
20
71
  - Added more detail to dictionary error in ArticleScraper
21
72
 
73
+
22
74
  ## [v0.3.5] - 2020-05-04
23
75
 
24
76
  ### Added
@@ -29,6 +81,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
29
81
  - Fixed URLs stored in YAML data to always be of type String (not URI)
30
82
  - This initially caused a problem in DictScraper.parse_url() from ArticleScraper, but fixed it for all data
31
83
 
84
+
32
85
  ## [v0.3.4] - 2020-04-25
33
86
 
34
87
  ### Added
@@ -50,12 +103,14 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
50
103
  - `-d '3-3'`
51
104
  - `-d '3'`
52
105
 
106
+
53
107
  ## [v0.3.3] - 2020-04-23
54
108
 
55
109
  ### Added
56
110
  - Added JSON support to Sifter & SiftCmd.
57
111
  - Added use of `attr_bool` Gem for `attr_accessor?` & `attr_reader?`.
58
112
 
113
+
59
114
  ## [v0.3.2] - 2020-04-22
60
115
 
61
116
  ### Added
@@ -79,6 +134,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
79
134
  - ArticleScraper
80
135
  - Renamed `mode` param to `strict`. `mode` was overshadowing File.open()'s in Scraper.
81
136
 
137
+
82
138
  ## [v0.3.1] - 2020-04-20
83
139
 
84
140
  ### Changed
@@ -96,6 +152,7 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
96
152
  - BingScraper
97
153
  - Fixed possible RSS infinite loop.
98
154
 
155
+
99
156
  ## [v0.3.0] - 2020-04-12
100
157
 
101
158
  ### Added
@@ -130,7 +187,9 @@ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
130
187
  - ignore empty filenames in the Zip for safety.
131
188
  - ask to overwrite files instead of erroring.
132
189
 
190
+
133
191
  ## [v0.2.0] - 2020-04-01
192
+
134
193
  First working version.
135
194
 
136
195
  ### Added
@@ -166,7 +225,9 @@ First working version.
166
225
  - test/nhkore_tester.rb
167
226
  - Renamed to `test/nhkore/test_helper.rb`
168
227
 
228
+
169
229
  ## [v0.1.0] - 2020-02-24
230
+
170
231
  ### Added
171
232
  - .gitignore
172
233
  - 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 ADDED
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nhkore (0.3.10)
5
+ attr_bool (~> 0.2)
6
+ bimyou_segmenter (~> 1.2)
7
+ cri (~> 2.15)
8
+ down (~> 5.2)
9
+ highline (~> 2.0)
10
+ http-cookie (~> 1.0)
11
+ japanese_deinflector (~> 0.0)
12
+ nokogiri (~> 1.11)
13
+ psychgus (~> 1.3)
14
+ public_suffix (~> 4.0)
15
+ rainbow (~> 3.0)
16
+ rubyzip (~> 2.3)
17
+ tiny_segmenter (~> 0.0)
18
+ tty-progressbar (~> 0.18)
19
+ tty-spinner (~> 0.9)
20
+
21
+ GEM
22
+ remote: https://rubygems.org/
23
+ specs:
24
+ addressable (2.8.0)
25
+ public_suffix (>= 2.0.2, < 5.0)
26
+ attr_bool (0.2.2)
27
+ bimyou_segmenter (1.2.0)
28
+ cri (2.15.11)
29
+ domain_name (0.5.20190701)
30
+ unf (>= 0.0.5, < 1.0.0)
31
+ down (5.2.2)
32
+ addressable (~> 2.5)
33
+ highline (2.0.3)
34
+ http-cookie (1.0.4)
35
+ domain_name (~> 0.5)
36
+ japanese_deinflector (0.0.2)
37
+ mini_portile2 (2.5.3)
38
+ minitest (5.14.4)
39
+ nokogiri (1.11.7)
40
+ mini_portile2 (~> 2.5.0)
41
+ racc (~> 1.4)
42
+ psych (4.0.1)
43
+ psychgus (1.3.4)
44
+ psych (>= 3.0)
45
+ public_suffix (4.0.6)
46
+ racc (1.5.2)
47
+ rainbow (3.0.0)
48
+ rake (13.0.6)
49
+ raketeer (0.2.13)
50
+ rake
51
+ rdoc (6.3.2)
52
+ redcarpet (3.5.1)
53
+ rubyzip (2.3.2)
54
+ strings-ansi (0.2.0)
55
+ tiny_segmenter (0.0.6)
56
+ tty-cursor (0.7.1)
57
+ tty-progressbar (0.18.2)
58
+ strings-ansi (~> 0.2)
59
+ tty-cursor (~> 0.7)
60
+ tty-screen (~> 0.8)
61
+ unicode-display_width (>= 1.6, < 3.0)
62
+ tty-screen (0.8.1)
63
+ tty-spinner (0.9.3)
64
+ tty-cursor (~> 0.7)
65
+ unf (0.1.4)
66
+ unf_ext
67
+ unf_ext (0.0.7.7)
68
+ unicode-display_width (2.0.0)
69
+ yard (0.9.26)
70
+ yard_ghurt (1.2.1)
71
+ rake
72
+ yard
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ bundler (~> 2.2)
79
+ minitest (~> 5.14)
80
+ nhkore!
81
+ rake (~> 13.0)
82
+ raketeer (~> 0.2)
83
+ rdoc (~> 6.3)
84
+ redcarpet (~> 3.5)
85
+ yard (~> 0.9)
86
+ yard_ghurt (~> 1.2)
87
+
88
+ BUNDLED WITH
89
+ 2.2.20
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*: `$ raketary bump -v`
863
- - Run: `$ bundle update`
864
- 2. Run: `$ bundle exec rake update_core`
865
- 3. Run: `$ bundle exec rake clobber pkg_core`
866
- 4. Create a new release & tag
867
- - Add `pkg/nhkore-core.zip`
868
- 5. Run: `$ git pull`
869
- 6. Upload GitHub package
870
- - *Raketary*: `$ raketary github_pkg`
871
- 7. Run: `$ bundle exec rake release`
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 (@esotericpig)
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 :doc => [:yard,:yard_gfm_fix] do |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() do |task|
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
- CONTINUE_MSG = "\nContinue (y/n)? "
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(CONTINUE_MSG)
60
+ next unless hl.agree(continue_msg)
79
61
  puts
80
-
81
- next unless sh(*cmd,'news','-s','100','ez')
82
- next unless hl.agree(CONTINUE_MSG)
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
- SHOWCASE_FILE = File.join('.','nhkore-ez.html')
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',SHOWCASE_FILE,
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',SHOWCASE_FILE,
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() do |task|
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() do |task|
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 = Proc.new() do |task,args|
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(task.doc_dir,'file.README.html'))
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
- GHP_ROOT = YardGhurt::Util.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
131
-
132
- task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT}/css/prism.css" />)
133
- task.js_scripts << %Q(<script src="#{GHP_ROOT}/js/prism.js"></script>)
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() do |task|
124
+ YardGhurt::GHPSyncTask.new do |task|
139
125
  task.ghp_dir = '../esotericpig.github.io/docs/nhkore/yardoc'
140
126
  end