Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Ruby 3.4.x #1935

Merged
merged 17 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ '3.3', '3.2', '3.1', '3.0' ]
ruby: [ '3.4', '3.3', '3.2', '3.1', '3.0' ]

steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: fix ImageMagick policy.xml on Linux
if: runner.os == 'Linux'
run: sudo sed -i 's/none/read|write/g' /etc/ImageMagick-6/policy.xml
- name: Build and test with Rake
run: |
gem install bundler --no-document
bundle install --retry 3
bundle exec rake test
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ Style/TernaryParentheses:
Enabled: false

Style/FrozenStringLiteralComment:
EnforcedStyle: never
Enabled: true
Exclude:
- 'samples/**/*'
Comment on lines -97 to +99
Copy link
Collaborator Author

@takahashim takahashim Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samples以下のマジコメはどうでもいいっしょ…ということで放置しています


Style/SafeNavigation:
Enabled: false
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in review.gemspec
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'bundler'
Bundler::GemHelper.install_tasks
Expand Down
2 changes: 2 additions & 0 deletions bin/review
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# review: Wrapper command to call subcommand
#
Expand Down
2 changes: 2 additions & 0 deletions bin/review-catalog-converter
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2014-2019 Masanori Kado, Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions bin/review-check
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2010-2019 Kenshi Muto, Minero Aoki
# 1999-2007 Minero Aoki
Expand Down
4 changes: 3 additions & 1 deletion bin/review-checkdep
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2007-2017 Minero Aoki, Kenshi Muto
# 1999-2007 Minero Aoki
Expand All @@ -11,7 +13,7 @@

$LOAD_PATH.unshift(File.realpath('../lib', __dir__))

PREDEF_FILE = 'PREDEF'.freeze
PREDEF_FILE = 'PREDEF'

def main
@provided = parse_predefined
Expand Down
4 changes: 3 additions & 1 deletion bin/review-compile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2008-2019 Kenshi Muto, Masayoshi Takahashi, KADO Masanori, Minero Aoki
# Copyright (c) 1999-2007 Minero Aoki
Expand All @@ -18,7 +20,7 @@ require 'yaml'

include ReVIEW::Loggable

DEFAULT_CONFIG_FILENAME = 'config.yml'.freeze
DEFAULT_CONFIG_FILENAME = 'config.yml'

def main
Signal.trap(:INT) { exit 1 }
Expand Down
2 changes: 2 additions & 0 deletions bin/review-epub2html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2018 Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions bin/review-epubmaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2010-2019 Kenshi Muto and Masayoshi Takahashi
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions bin/review-idgxmlmaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2019 Kenshi Muto
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions bin/review-index
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2008-2020 Minero Aoki, Kenshi Muto
# 1999-2007 Minero Aoki
Expand Down
2 changes: 2 additions & 0 deletions bin/review-init
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2013-2017 Masanori Kado, Masayoshi Takahashi, Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions bin/review-pdfmaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2010-2017 Kenshi Muto and Masayoshi Takahashi
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions bin/review-preproc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2010-2019 Minero Aoki, Kenshi Muto
# 1999-2007 Minero Aoki
Expand Down
2 changes: 2 additions & 0 deletions bin/review-textmaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2018 Kenshi Muto
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions bin/review-update
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2018 Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions bin/review-validate
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2010-2019 Kenshi Muto
#
# This program is free software
Expand Down
2 changes: 2 additions & 0 deletions bin/review-vol
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Copyright (c) 2014-2020 Minero Aoki, Kenshi Muto
# 2003-2014 Minero Aoki
Expand Down
2 changes: 2 additions & 0 deletions bin/review-webmaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This program is free software.
# You can distribute or modify this program under the terms of
Expand Down
2 changes: 2 additions & 0 deletions lib/review.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Dir["#{__dir__}/review/*.rb"].sort.each do |path|
require "review/#{File.basename(path, '.rb')}"
end
2 changes: 2 additions & 0 deletions lib/review/book.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2009-2017 Minero Aoki, Kenshi Muto
# 2002-2008 Minero Aoki
#
Expand Down
5 changes: 3 additions & 2 deletions lib/review/book/base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
# frozen_string_literal: true

# Copyright (c) 2009-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
# 2002-2008 Minero Aoki
#
Expand Down Expand Up @@ -395,7 +396,7 @@ def read_file(filename)
@logger.warn "!!! #{filename} is obsoleted. please use catalog.yml."
end
end
res = ''
res = +''
Comment on lines -398 to +399
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一部破壊的に文字列を使っているところでは、最初の初期化時に+をつけてmutableにしています

File.open(filename_join(@basedir, filename), 'rt:BOM|utf-8') do |f|
f.each_line do |line|
next if line.start_with?('#')
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/bib.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2009-2020 Minero Aoki, Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/book_unit.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2009-2021 Minero Aoki, Kenshi Muto
# 2002-2008 Minero Aoki
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/cache.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2014-2024 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/chapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2009-2019 Minero Aoki, Kenshi Muto
# 2002-2008 Minero Aoki
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/image_finder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2014-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/index.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto
# 2002-2007 Minero Aoki
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/index/item.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2008-2019 Minero Aoki, Kenshi Muto
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/page_metric.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2009-2020 Minero Aoki, Kenshi Muto
# 2002-2008 Minero Aoki
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/part.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2009-2020 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
# 2002-2008 Minero Aoki
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/book/volume.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2007-2020 Minero Aoki, Kenshi Muto
# 2002-2007 Minero Aoki
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/builder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2002-2024 Minero Aoki, Kenshi Muto
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions lib/review/call_hook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ReVIEW
module CallHook
def call_hook(hook_name, *params, base_dir: nil)
Expand Down
2 changes: 2 additions & 0 deletions lib/review/catalog.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'yaml'
require 'date'

Expand Down
4 changes: 3 additions & 1 deletion lib/review/compiler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2009-2024 Minero Aoki, Kenshi Muto
# Copyright (c) 2002-2007 Minero Aoki
#
Expand Down Expand Up @@ -672,7 +674,7 @@ def text(str, block_mode = false)
error "`@<xxx>' seen but is not valid inline op: #{w}", location: location
end
end
result = ''
result = +''
until words.empty?
result << if in_non_escaped_command? && block_mode
revert_replace_fence(words.shift)
Expand Down
2 changes: 2 additions & 0 deletions lib/review/configure.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2012-2022 Masanori Kado, Masayoshi Takahashi, Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/converter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epub2html.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (c) 2018-2019 Kenshi Muto
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubbuilder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# epubbuilder.rb
# just for compatibility
#
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubmaker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Copyright (c) 2010-2024 Kenshi Muto and Masayoshi Takahashi
#
# This program is free software.
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubmaker/content.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# = content.rb -- Content object for EPUBMaker.
#
# Copyright (c) 2010-2020 Kenshi Muto
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubmaker/epubcommon.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# = epubcommon.rb -- super class for EPUBv2 and EPUBv3
#
# Copyright (c) 2010-2024 Kenshi Muto and Masayoshi Takahashi
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubmaker/epubv2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# = epubv2.rb -- EPUB version 2 producer.
#
# Copyright (c) 2010-2022 Kenshi Muto and Masayoshi Takahashi
Expand Down
4 changes: 3 additions & 1 deletion lib/review/epubmaker/epubv3.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# = epubv3.rb -- EPUB version 3 producer.
#
# Copyright (c) 2010-2023 Kenshi Muto
Expand Down Expand Up @@ -41,7 +43,7 @@ def opf

if @opf_prefix && @opf_prefix.size > 0
prefixes_str = @opf_prefix.map { |k, v| %Q(#{k}: #{v}) }.join(' ')
@package_attrs << %Q( prefix="#{prefixes_str}")
@package_attrs = %Q( prefix="#{prefixes_str}")
Comment on lines -44 to +46
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再代入は問題ない(既存文字列を破壊するわけではないため)ので、初期化直後に破壊的追加を行っている箇所については再代入に変更しているところもあります

end

ReVIEW::Template.generate(path: './opf/epubv3.opf.erb', binding: binding)
Expand Down
2 changes: 2 additions & 0 deletions lib/review/epubmaker/producer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# = producer.rb -- EPUB producer.
#
# Copyright (c) 2010-2023 Kenshi Muto
Expand Down
Loading
Loading