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

Ruby 3.2 compatibility #616

Merged
merged 5 commits into from
Jan 1, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
runs-on: ${{ matrix.os }}
env:
nixfile: "contrib/nix/ruby${{ matrix.ruby-version }}-shell.nix"
Expand Down
1 change: 1 addition & 0 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ contrib/nix/ruby2.6-shell.nix
contrib/nix/ruby2.7-shell.nix
contrib/nix/ruby3.0-shell.nix
contrib/nix/ruby3.1-shell.nix
contrib/nix/ruby3.2-shell.nix
devel/console.sh
devel/count-loc.sh
devel/load-index.rb
Expand Down
2 changes: 1 addition & 1 deletion contrib/nix/ruby2.7-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let
pkgs = import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs";
ref = "refs/heads/master";
rev = "f5ffd5787786dde3a8bf648c7a1b5f78c4e01abb";
rev = "402cc3633cc60dfc50378197305c984518b30773";
}) {};
gems = pkgs.bundlerEnv {
name = "ruby2.7-gems-for-sup";
Expand Down
2 changes: 1 addition & 1 deletion contrib/nix/ruby3.0-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let
pkgs = import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs";
ref = "refs/heads/master";
rev = "f5ffd5787786dde3a8bf648c7a1b5f78c4e01abb";
rev = "402cc3633cc60dfc50378197305c984518b30773";
}) {};
gems = pkgs.bundlerEnv {
name = "ruby3.0-gems-for-sup";
Expand Down
2 changes: 1 addition & 1 deletion contrib/nix/ruby3.1-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let
pkgs = import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs";
ref = "refs/heads/master";
rev = "f5ffd5787786dde3a8bf648c7a1b5f78c4e01abb";
rev = "402cc3633cc60dfc50378197305c984518b30773";
}) {};
gems = pkgs.bundlerEnv {
name = "ruby3.1-gems-for-sup";
Expand Down
14 changes: 14 additions & 0 deletions contrib/nix/ruby3.2-shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let
pkgs = import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs";
ref = "refs/heads/master";
rev = "402cc3633cc60dfc50378197305c984518b30773";
}) {};
gems = pkgs.bundlerEnv {
name = "ruby3.2-gems-for-sup";
ruby = pkgs.ruby_3_2;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
2 changes: 1 addition & 1 deletion lib/sup/crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def decrypt payload, armor=false # a RubyMail::Message object
def retrieve fingerprint
require 'net/http'
uri = URI($config[:keyserver_url] || KEYSERVER_URL)
unless uri.scheme == "http" and not uri.host.nil?
unless uri.scheme == "http" and not uri.host.nil? and not uri.host.empty?
return "Invalid url: #{uri}"
end

Expand Down
4 changes: 2 additions & 2 deletions lib/sup/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def unlock
end

def load failsafe=false
SourceManager.load_sources
SourceManager.load_sources File.join(@dir, "sources.yaml")
load_index failsafe
end

def save
debug "saving index and sources..."
FileUtils.mkdir_p @dir unless File.exist? @dir
SourceManager.save_sources
SourceManager.save_sources File.join(@dir, "sources.yaml")
save_index
end

Expand Down
2 changes: 1 addition & 1 deletion lib/sup/maildir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize uri, usual=true, archived=false, sync_back=true, id=nil, labels=[
end

raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" unless uri.host.nil? || uri.host.empty?
raise ArgumentError, "maildir URI must have a path component" unless uri.path

@sync_back = sync_back
Expand Down
2 changes: 1 addition & 1 deletion lib/sup/mbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initialize uri_or_fp, usual=true, archived=false, id=nil, labels=nil
end

raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" if uri.host
raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" unless uri.host.nil? || uri.host.empty?
raise ArgumentError, "mbox URI must have a path component" unless uri.path
@f = nil
else
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
3 changes: 3 additions & 0 deletions test/integration/test_maildir.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require "sup"
require "test_helper"

class TestMaildir < Minitest::Test

include Redwood

def setup
@path = Dir.mktmpdir

Expand Down
3 changes: 3 additions & 0 deletions test/integration/test_mbox.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require "sup"
require "test_helper"

class TestMbox < Minitest::Test

include Redwood

def setup
@path = Dir.mktmpdir

Expand Down
4 changes: 2 additions & 2 deletions test/test_header_parsing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
require 'sup'
require 'stringio'

include Redwood

class TestMBoxParsing < Minitest::Test

include Redwood

def setup
@path = Dir.mktmpdir
@mbox = File.join(@path, 'test_mbox')
Expand Down