Skip to content

Commit

Permalink
Ruby 2.7 EOL and Dependency Chores
Browse files Browse the repository at this point in the history
  • Loading branch information
Dakurei committed Jul 5, 2023
1 parent d0e3f61 commit a684f96
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
sudo apt update
sudo apt install -y git openssh-client
- name: Setup Ruby 2.7
- name: Setup Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.0'
bundler-cache: true

- name: Checkout repository for Github Pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
versions: [ '2.7', '3.0', '3.1', '3.2' ]
versions: [ '3.0', '3.1', '3.2' ]

steps:
- name: Checkout repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Ruby 2.7
- name: Setup Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.0'
bundler-cache: true

- name: Run bundle install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Ruby 2.7
- name: Setup Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.0'
bundler-cache: true

- name: Run bundle install
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inherit_mode:

AllCops:
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

# Disable line length checks
Layout/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you enjoy using the library, consider getting involved with the community to

## Dependencies

* Ruby >= 2.7 supported
* Ruby >= 3.0 supported
* An installed build system for native extensions (on Windows, make sure you download the "Ruby+Devkit" version of [RubyInstaller](https://rubyinstaller.org/downloads/))

### Voice dependencies
Expand Down
2 changes: 1 addition & 1 deletion discordrb-webhooks.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'rest-client', '>= 2.0.0'

spec.required_ruby_version = '>= 2.7'
spec.required_ruby_version = '>= 3.0'
spec.metadata = {
'rubygems_mfa_required' => 'true'
}
Expand Down
8 changes: 4 additions & 4 deletions discordrb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ Gem::Specification.new do |spec|

spec.add_dependency 'discordrb-webhooks', '~> 3.5.0'

spec.required_ruby_version = '>= 2.7'
spec.required_ruby_version = '>= 3.0'

spec.add_development_dependency 'bundler', '>= 1.10', '< 3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'redcarpet', '~> 3.6.0' # YARD markdown formatting
spec.add_development_dependency 'rspec', '~> 3.12.0'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.5.1'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.6.0'
spec.add_development_dependency 'rspec-prof', '~> 0.0.7'
spec.add_development_dependency 'rubocop', '~> 1.36.0'
spec.add_development_dependency 'rubocop', '~> 1.48.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.0'
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
spec.add_development_dependency 'simplecov', '~> 0.21.0'
spec.add_development_dependency 'simplecov', '~> 0.22.0'
spec.add_development_dependency 'yard', '~> 0.9.9'
end
2 changes: 1 addition & 1 deletion lib/discordrb/commands/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def execute_bare(event)
escaped = false
hacky_delim, hacky_space, hacky_prev, hacky_newline = [0xe001, 0xe002, 0xe003, 0xe004].pack('U*').chars

@chain.each_char.each_with_index do |char, index|
@chain.each_char.with_index do |char, index|
# Escape character
if char == '\\' && !escaped
escaped = true
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/data/embed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def initialize(data, message)
@provider = data['provider'].nil? ? nil : EmbedProvider.new(data['provider'], self)
@thumbnail = data['thumbnail'].nil? ? nil : EmbedThumbnail.new(data['thumbnail'], self)
@author = data['author'].nil? ? nil : EmbedAuthor.new(data['author'], self)
@fields = data['fields'].nil? ? nil : data['fields'].map { |field| EmbedField.new(field, self) }
@fields = data['fields']&.map { |field| EmbedField.new(field, self) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/data/emoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize(data, bot, server = nil)

@name = data['name']
@server = server
@id = data['id'].nil? ? nil : data['id'].to_i
@id = data['id']&.to_i
@animated = data['animated']

process_roles(data['roles']) if server
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/data/reaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Reaction
def initialize(data)
@count = data['count']
@me = data['me']
@id = data['emoji']['id'].nil? ? nil : data['emoji']['id'].to_i
@id = data['emoji']['id']&.to_i
@name = data['emoji']['name']
end

Expand Down
6 changes: 3 additions & 3 deletions lib/discordrb/data/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,11 @@ def update_data(new_data = nil)
@afk_timeout = new_data[:afk_timeout] || new_data['afk_timeout'] || @afk_timeout

afk_channel_id = new_data[:afk_channel_id] || new_data['afk_channel_id'] || @afk_channel
@afk_channel_id = afk_channel_id.nil? ? nil : afk_channel_id.resolve_id
@afk_channel_id = afk_channel_id&.resolve_id
widget_channel_id = new_data[:widget_channel_id] || new_data['widget_channel_id'] || @widget_channel
@widget_channel_id = widget_channel_id.nil? ? nil : widget_channel_id.resolve_id
@widget_channel_id = widget_channel_id&.resolve_id
system_channel_id = new_data[:system_channel_id] || new_data['system_channel_id'] || @system_channel
@system_channel_id = system_channel_id.nil? ? nil : system_channel_id.resolve_id
@system_channel_id = system_channel_id&.resolve_id

@widget_enabled = new_data[:widget_enabled] || new_data['widget_enabled']
@splash = new_data[:splash_id] || new_data['splash_id'] || @splash_id
Expand Down
2 changes: 1 addition & 1 deletion lib/discordrb/voice/encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def adjust_volume(buf, mult)
sample *= mult

# clamp to s16 range
[32_767, [-32_768, sample].max].min
sample.clamp(-32_768, 32_767)
end

# After modification, make it s16le again
Expand Down

0 comments on commit a684f96

Please sign in to comment.