From fe71f73484e0c00a22433ca510a9d93a04ba3f85 Mon Sep 17 00:00:00 2001 From: Henry Catalini Smith Date: Wed, 7 Aug 2024 21:50:31 +0200 Subject: [PATCH 1/4] Update CI build to Ruby 3.2.0 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eca72fe..ef2bd5e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0.0 + ruby-version: 3.2.0 - uses: jwlawson/actions-setup-cmake@v1.8 with: From 08fe54d714c245523694113c63ca2432fdfbc9b6 Mon Sep 17 00:00:00 2001 From: Henry Catalini Smith Date: Wed, 7 Aug 2024 21:52:33 +0200 Subject: [PATCH 2/4] Upgrade rugged to 1.7.2 for Ruby 3.2.0 compatibility --- ppl.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppl.gemspec b/ppl.gemspec index 1a47754a..f3a04975 100644 --- a/ppl.gemspec +++ b/ppl.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.add_dependency("inifile", "3.0.0") spec.add_dependency("mail", "2.7.1") spec.add_dependency("morphine", "0.1.1") - spec.add_dependency("rugged", "1.1.0") + spec.add_dependency("rugged", "1.7.2") spec.add_dependency("vpim", "13.11.11") spec.add_development_dependency("cucumber") From ae9d3ccad2da6fcf1ce4744e5cb631a4d9b3deb3 Mon Sep 17 00:00:00 2001 From: Henry Catalini Smith Date: Thu, 8 Aug 2024 09:18:24 +0200 Subject: [PATCH 3/4] Add net-imap, net-pop and net-smtp gems to fix error when loading mail gem --- ppl.gemspec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ppl.gemspec b/ppl.gemspec index f3a04975..4900faaf 100644 --- a/ppl.gemspec +++ b/ppl.gemspec @@ -17,6 +17,9 @@ Gem::Specification.new do |spec| spec.add_dependency("colored", "1.2") spec.add_dependency("inifile", "3.0.0") spec.add_dependency("mail", "2.7.1") + spec.add_dependency("net-imap", "0.4.14") + spec.add_dependency("net-pop", "0.1.2") + spec.add_dependency("net-smtp", "0.5.0") spec.add_dependency("morphine", "0.1.1") spec.add_dependency("rugged", "1.7.2") spec.add_dependency("vpim", "13.11.11") From 16d89a6006a80f89202bacb0b8e578f3bd0f3d31 Mon Sep 17 00:00:00 2001 From: Henry Catalini Smith Date: Thu, 8 Aug 2024 09:31:08 +0200 Subject: [PATCH 4/4] Replace exists? with exist? --- .ruby-version | 1 + Rakefile | 4 ++-- lib/ppl/adapter/storage/disk.rb | 4 ++-- lib/ppl/adapter/storage/factory.rb | 2 +- lib/ppl/application/configuration.rb | 4 ++-- lib/ppl/command/completion.rb | 2 +- spec/ppl/adapter/storage/disk_spec.rb | 4 ++-- spec/ppl/command/completion_spec.rb | 4 ++-- 8 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..be94e6f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.2 diff --git a/Rakefile b/Rakefile index 0b58aeab..80be5b4d 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,7 @@ end task :disable_config do pplconfig = File.expand_path("~/.pplconfig") bkpconfig = File.expand_path("~/.pplconfig.bkp") - if File.exists? pplconfig + if File.exist? pplconfig FileUtils.mv pplconfig, bkpconfig end at_exit { Rake::Task["enable_config"].invoke } @@ -18,7 +18,7 @@ end task :enable_config do pplconfig = File.expand_path("~/.pplconfig") bkpconfig = File.expand_path("~/.pplconfig.bkp") - if File.exists? bkpconfig + if File.exist? bkpconfig FileUtils.mv bkpconfig, pplconfig end end diff --git a/lib/ppl/adapter/storage/disk.rb b/lib/ppl/adapter/storage/disk.rb index dc4e2d5e..5a26fd3b 100644 --- a/lib/ppl/adapter/storage/disk.rb +++ b/lib/ppl/adapter/storage/disk.rb @@ -6,7 +6,7 @@ class Ppl::Adapter::Storage::Disk < Ppl::Adapter::Storage attr_accessor :vcard_adapter def self.create_address_book(path) - if !Dir.exists? path + if !Dir.exist? path FileUtils.mkdir_p(path) end storage = self.new(Dir.new(path)) @@ -41,7 +41,7 @@ def load_address_book def load_contact(id) filename = filename_for_contact_id(id) contact = nil - if File.exists?(filename) + if File.exist?(filename) vcard = File.read filename contact = @vcard_adapter.decode(vcard) if !contact.nil? && contact.is_a?(Ppl::Entity::Contact) diff --git a/lib/ppl/adapter/storage/factory.rb b/lib/ppl/adapter/storage/factory.rb index 353ba6f4..3d9c88a6 100644 --- a/lib/ppl/adapter/storage/factory.rb +++ b/lib/ppl/adapter/storage/factory.rb @@ -12,7 +12,7 @@ def load_adapter(directory) adapter = disk_adapter - if File.exists?(git_dir) + if File.exist?(git_dir) git_adapter = Ppl::Adapter::Storage::Git.new(disk_adapter) git_adapter.vcard_adapter = @vcard_adapter adapter = git_adapter diff --git a/lib/ppl/application/configuration.rb b/lib/ppl/application/configuration.rb index 0a22af41..2b307100 100644 --- a/lib/ppl/application/configuration.rb +++ b/lib/ppl/application/configuration.rb @@ -64,9 +64,9 @@ def user_configuration end filename = File.expand_path(USER_CONFIG) @user_config = {} - if File.exists?(filename) + if File.exist?(filename) @user_config = IniFile::load(filename).to_h - elsif File.exists?(xdg_path) + elsif File.exist?(xdg_path) @user_config = IniFile::load(xdg_path).to_h end return @user_config diff --git a/lib/ppl/command/completion.rb b/lib/ppl/command/completion.rb index 23035568..e560e89a 100644 --- a/lib/ppl/command/completion.rb +++ b/lib/ppl/command/completion.rb @@ -26,7 +26,7 @@ def require_shell_name(input) def require_completion_existence(shell_name) path = File.join(@completions_directory.path, shell_name) - if !File.exists? path + if !File.exist? path raise Ppl::Error::CompletionNotFound, shell_name end path diff --git a/spec/ppl/adapter/storage/disk_spec.rb b/spec/ppl/adapter/storage/disk_spec.rb index 3025e3ee..0a9c418c 100644 --- a/spec/ppl/adapter/storage/disk_spec.rb +++ b/spec/ppl/adapter/storage/disk_spec.rb @@ -11,7 +11,7 @@ describe "#create_address_book" do it "should create the directory if it doesn't exist yet" do Ppl::Adapter::Storage::Disk.create_address_book("/contacts") - expect(Dir.exists?("/contacts")).to eq true + expect(Dir.exist?("/contacts")).to eq true FileUtils.rm_rf("/contacts") end it "should return a Ppl::Adapter::Storage::Disk" do @@ -130,7 +130,7 @@ FileUtils.touch "/contacts/test.vcf" @contact.id = "test" @storage.delete_contact(@contact) - expect(File.exists?("/contacts/test.vcf")).to eq false + expect(File.exist?("/contacts/test.vcf")).to eq false end end diff --git a/spec/ppl/command/completion_spec.rb b/spec/ppl/command/completion_spec.rb index 05bc2212..7bcf42c6 100644 --- a/spec/ppl/command/completion_spec.rb +++ b/spec/ppl/command/completion_spec.rb @@ -18,7 +18,7 @@ before(:each) do allow(@directory).to receive(:path).and_return("") - allow(File).to receive(:exists?).and_return(true) + allow(File).to receive(:exist?).and_return(true) allow(File).to receive(:read) end @@ -29,7 +29,7 @@ it "should raise an error if the shell is not recognised" do @input.arguments = ["invalidshell"] - expect(File).to receive(:exists?).with("/invalidshell").and_return(false) + expect(File).to receive(:exist?).with("/invalidshell").and_return(false) expect{@command.execute(@input, @output)}.to raise_error(Ppl::Error::CompletionNotFound) end