Skip to content

Commit ff32778

Browse files
committed
Merge branch 'main' of https://github.com/citation-file-format/ruby-cff into copilot/fix-apa-style-hyphenated-names
2 parents f5ab023 + 499f9bd commit ff32778

20 files changed

Lines changed: 106 additions & 73 deletions

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install and set up ruby
1616
uses: ruby/setup-ruby@v1
1717
with:
18-
ruby-version: 2.6
18+
ruby-version: '3.2'
1919
bundler-cache: true
2020

2121
- name: Run RDoc

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Install and set up ruby
1313
uses: ruby/setup-ruby@v1
1414
with:
15-
ruby-version: 2.6
15+
ruby-version: '3.2'
1616
bundler-cache: true
1717

1818
- name: Rubocop

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu]
11-
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', head, jruby, jruby-head, truffleruby, truffleruby-head]
11+
ruby: ['3.2', '3.3', '3.4', '4.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
1212
include:
1313
- os: macos
14-
ruby: '3.0'
14+
ruby: '3.2'
1515
- os: windows
16-
ruby: '3.0'
16+
ruby: '3.2'
1717
runs-on: ${{ matrix.os }}-latest
1818
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.os == 'windows' }}
1919
steps:
@@ -49,7 +49,7 @@ jobs:
4949
- name: Install and set up ruby
5050
uses: ruby/setup-ruby@v1
5151
with:
52-
ruby-version: '2.7'
52+
ruby-version: '3.4'
5353
bundler-cache: true
5454

5555
- name: Run isolated tests
@@ -60,7 +60,7 @@ jobs:
6060
fail-fast: false
6161
matrix:
6262
os: [ubuntu, macos]
63-
ruby: ['3.1', '3.2', head]
63+
ruby: ['3.2', '3.3', '3.4', '4.0', head]
6464
runs-on: ${{ matrix.os }}-latest
6565
continue-on-error: true
6666
steps:

.rubocop.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
require:
1+
plugins:
22
- rubocop-minitest
33
- rubocop-performance
44
- rubocop-rake
55

66
# Set our base version of ruby and enable all cops.
77
AllCops:
8-
TargetRubyVersion: 2.6
8+
TargetRubyVersion: 3.2
99
NewCops: enable
1010

1111
# Turn this off for certain files where we have extra documentation
1212
# towards the end of the file, after a block of private methods.
1313
Lint/UselessAccessModifier:
1414
Exclude:
1515
- 'lib/cff/index.rb'
16-
- 'lib/cff/model.rb'
1716
- 'lib/cff/reference.rb'
1817

1918
# I think 'has_key?' looks better than 'key?'.
@@ -70,3 +69,9 @@ Minitest/MultipleAssertions:
7069

7170
Style/DocumentDynamicEvalDefinition:
7271
Enabled: true
72+
73+
Gemspec/DevelopmentDependencies:
74+
EnforcedStyle: gemspec
75+
76+
Minitest/EmptyLineBeforeAssertionMethods:
77+
Enabled: false

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2022 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ RDoc::Task.new do |r|
3333
)
3434
r.options << '--markup=markdown'
3535
r.options << '--tab-width=2'
36-
r.options << "-t Ruby CFF Library (version #{::CFF::VERSION})"
36+
r.options << "-t Ruby CFF Library (version #{CFF::VERSION})"
3737
end
3838

3939
RuboCop::RakeTask.new

cff.gemspec

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2022 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -47,18 +47,18 @@ Gem::Specification.new do |spec|
4747
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
4848
spec.require_paths = ['lib']
4949

50-
spec.required_ruby_version = '>= 2.6'
50+
spec.required_ruby_version = '>= 3.2'
5151

52-
spec.add_runtime_dependency 'json_schema', '~> 0.20.4'
53-
spec.add_runtime_dependency 'language_list', '~> 1.2.1'
52+
spec.add_dependency 'json_schema', '~> 0.20.4'
53+
spec.add_dependency 'language_list', '~> 1.2.1'
5454

55-
spec.add_development_dependency 'minitest', '~> 5.16.0'
55+
spec.add_development_dependency 'minitest', '~> 5.27.0'
5656
spec.add_development_dependency 'rake', '~> 13.0'
5757
spec.add_development_dependency 'rdoc', '~> 6.4.0'
58-
spec.add_development_dependency 'rubocop', '~> 1.35.0'
59-
spec.add_development_dependency 'rubocop-minitest', '~> 0.21.0'
60-
spec.add_development_dependency 'rubocop-performance', '~> 1.14.0'
61-
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
58+
spec.add_development_dependency 'rubocop', '~> 1.85.0'
59+
spec.add_development_dependency 'rubocop-minitest', '~> 0.39.0'
60+
spec.add_development_dependency 'rubocop-performance', '~> 1.26.0'
61+
spec.add_development_dependency 'rubocop-rake', '~> 0.7.0'
6262
spec.add_development_dependency 'simplecov', '0.18.3'
6363
spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
6464
spec.add_development_dependency 'test_construct', '~> 2.0'

lib/cff/file.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2024 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -116,7 +116,7 @@ def self.open(file)
116116
# You can choose whether filename validation failure should cause overall
117117
# validation failure with the `fail_on_filename` parameter (default: true).
118118
def self.validate(file, fail_on_filename: true)
119-
File.read(file).validate(fail_on_filename: fail_on_filename)
119+
File.read(file).validate(fail_on_filename:)
120120
end
121121

122122
# :call-seq:
@@ -129,7 +129,7 @@ def self.validate(file, fail_on_filename: true)
129129
# You can choose whether filename validation failure should cause overall
130130
# validation failure with the `fail_on_filename` parameter (default: true).
131131
def self.validate!(file, fail_on_filename: true)
132-
File.read(file).validate!(fail_on_filename: fail_on_filename)
132+
File.read(file).validate!(fail_on_filename:)
133133
end
134134

135135
# :call-seq:
@@ -159,7 +159,7 @@ def self.write(file, cff, comment = '')
159159
# validation failure with the `fail_on_filename` parameter (default: true).
160160
def validate(fail_fast: false, fail_on_filename: true)
161161
valid_filename = (::File.basename(@filename) == CFF_VALID_FILENAME)
162-
result = (@index.validate(fail_fast: fail_fast) << valid_filename)
162+
result = (@index.validate(fail_fast:) << valid_filename)
163163
result[0] &&= valid_filename if fail_on_filename
164164

165165
result
@@ -176,7 +176,7 @@ def validate(fail_fast: false, fail_on_filename: true)
176176
# validation failure with the `fail_on_filename` parameter (default: true).
177177
def validate!(fail_fast: false, fail_on_filename: true)
178178
result = validate(
179-
fail_fast: fail_fast, fail_on_filename: fail_on_filename
179+
fail_fast:, fail_on_filename:
180180
)
181181
return if result[0]
182182

@@ -223,10 +223,10 @@ def to_yaml # :nodoc:
223223
@index.to_yaml
224224
end
225225

226-
def method_missing(name, *args) # :nodoc:
226+
def method_missing(name, *) # :nodoc:
227227
if @index.respond_to?(name)
228-
@dirty = true if name.to_s.end_with?('=') # Remove to_s when Ruby >2.6.
229-
@index.send(name, *args)
228+
@dirty = true if name.end_with?('=')
229+
@index.send(name, *)
230230
else
231231
super
232232
end

lib/cff/formatters/apalike.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2022 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ def self.publication_data_from_model(model) # rubocop:disable Metrics
7676
end
7777

7878
def self.type_and_school_from_model(model, type)
79-
type = model.thesis_type == '' ? type : model.thesis_type
79+
type = model.thesis_type unless model.thesis_type == ''
8080
school = model.institution.empty? ? model.authors.first.affiliation : model.institution.name
8181
"[#{type}, #{school}]"
8282
end

lib/cff/formatters/bibtex.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2024 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ class BibTeX < Formatter # :nodoc:
4747

4848
# We need to escape these characters in titles and names, as per
4949
# https://tex.stackexchange.com/questions/34580/escape-character-in-latex
50-
ESCAPE_CHARS = Regexp.new(/([&%$#_{}])/)
50+
ESCAPE_CHARS = /([&%$#_{}])/
5151

5252
def self.format(model:, preferred_citation: true) # rubocop:disable Metrics
5353
model = select_and_check_model(model, preferred_citation)
@@ -86,7 +86,7 @@ def self.publication_data_from_model(model, type, fields)
8686
fields[field] = l(model.send(field).to_s)
8787
else
8888
field = field.chomp('!')
89-
fields[field] = send("#{field}_from_model", model)
89+
fields[field] = send(:"#{field}_from_model", model)
9090
end
9191
end
9292
end

lib/cff/reference.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2018-2022 The Ruby Citation File Format Developers.
3+
# Copyright (c) 2018-2026 The Ruby Citation File Format Developers.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -164,7 +164,7 @@ def self.from_cff(model, type: 'software')
164164
repository_artifact repository_code url version
165165
].each do |field|
166166
value = model.send(field)
167-
ref.send("#{field}=", value.dup) unless value == ''
167+
ref.send(:"#{field}=", value.dup) unless value == ''
168168
end
169169
end
170170
end

0 commit comments

Comments
 (0)