whiteleaf7 / narou

Narou.rb - 小説家になろうのダウンローダ&縦書き整形&管理アプリ。Kindle(などの電子書籍端末)でなろうを読む場合に超便利です!
Other
496 stars 55 forks source link

Ruby 2.7 に対応する #341

Closed whiteleaf7 closed 4 years ago

whiteleaf7 commented 4 years ago
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]

$ narou d https://ncode.syosetu.com/n1069fy/
/Users/whiteleaf/github/narou/lib/helper.rb:496: warning: Using the last argument as keyword parameters is deprecated
/Users/whiteleaf/github/narou/lib/helper.rb:496: warning: Using the last argument as keyword parameters is deprecated
/Users/whiteleaf/github/narou/lib/downloader.rb:728: warning: Splitting the last argument into positional and keyword parameters is deprecated
/Users/whiteleaf/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/2.7.0/open-uri.rb:13: warning: The called method `open' is defined here
calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
{:uplevel=>1}
/Users/whiteleaf/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/2.7.0/open-uri.rb:153:in `open_uri': extra arguments (ArgumentError)
  from /Users/whiteleaf/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/open_uri_redirections-0.2.1/lib/open-uri/redirections_patch.rb:55:in `open_uri'
  from /Users/whiteleaf/.anyenv/envs/rbenv/versions/2.7.0/lib/ruby/2.7.0/open-uri.rb:744:in `open'

  エラーが発生したため終了しました。
  詳細なエラーログは narou trace で表示出来ます。もしくは --backtrace オプションを付けて再度実行して下さい。
whiteleaf7 commented 4 years ago

なお ruby 2.7.0preview1 では動く

topstone commented 4 years ago

可能であれば、現在 GitHub に置いてある spec や rubocop が all green だった際の「Ruby 〇.〇.〇」「narou.rb 〇.〇.〇」「RSpec 〇.〇.〇」「rubocop 〇.〇.〇」を教えていただけると幸いです。

私の環境では、どちらも all green にならなかったもので…。

whiteleaf7 commented 4 years ago

https://github.com/whiteleaf7/narou/blob/develop/Gemfile.lock

topstone commented 4 years ago

narou 3.4.8 rspec 3.8.0

ですね。rubocop は不明ですが、activesupport が 5.2.3 であることから推測すると、0.66.0~0.74.0 あたりかと思います。

Ruby も 2.5 か 2.6 か分かりませんが、とりあえず時間に余裕があったら spec 通るかどうかやってみます。(あまり期待しないでお待ちください。)

whiteleaf7 commented 4 years ago

https://github.com/whiteleaf7/narou/blob/develop/.circleci/config.yml CircleCI は 2.5 です rubocop は Sider で実行してるので、常に最新版です

topstone commented 4 years ago

すみません、CircleCI や Sider は自分で使ったことはないので、いつも手動で spec や rubocop を回しています。今回も Windows 10 環境です。

ruby 2.5.7p206

ruby 2.6.5p114

ruby 2.6.5p114 (Gemfile.lock 削除後)

ruby 2.7.0p0 (Gemfile.lock 削除後)

(おまけ : yard)

私は yard 派なので、 yard doc ./lib/*/.rb させてもらったところ、39.93% documented でした。実装までちゃんと読む時間がなかなか取れないので、パッと見て分かるところだけ Pull Requests 出させていただきたいと思います。

whiteleaf7 commented 4 years ago

Sider はPRの diff 部分に対してだけ rubocop してくれます つまり既存部分のは無視です rubocop 導入前に書いた部分が多すぎるので、全体に対して rubocop して直すのはつらいのでしていません

CircleCI も PR 時に自動でテストしてくれるだけで、その環境の ruby が 2.5 というだけです ruby 2.5 でテストが通れば PR のステータスは green になります (ユーザーの環境を考慮しています。全員が 2.6 以上を使っているわけではないですので)

テストに関しては 2.5〜2.7 全部で通るに越したことはありませんが

topstone commented 4 years ago

PR#352 を取り込んでもらいましたので、Ruby 2.7 では以下を除いて RSpec の結果が green になりました。

私の環境では Ruby 2.7 でも動くようになったので急ぎませんが、narou 3.4.9 をお待ちしています。PRs の merge、ありがとうございました。

whiteleaf7 commented 4 years ago
$ b rspec
......................................................................................................................................................./Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
/Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
/Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
./Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
/Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
..../Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
/Users/whiteleaf/github/narou/lib/commandbase.rb:92: warning: deprecated Object#=~ is called on Integer; it always returns nil
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

これですね、私も出ました 少し考えます

whiteleaf7 commented 4 years ago

とりあえず to_s すればいいっぽいかな…

おそらくテスト中のみ発生する現象だった模様 (内部のAPIを直接呼び出しているため、通常時とは違う挙動になっていた)

whiteleaf7 commented 4 years ago

発生したりしなかったりする「Narou::WebWorker already running canceling」「Narou::WebWorker already running when pushing blocks should call blocks」

これはスレッドが関わってきてどうしても安定しないテストなので、そのために rspec-retry を使ってます