Skip to content

Commit

Permalink
maint: Drop runtime dependency on base64
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd authored Feb 13, 2024
2 parents 8ee2054 + ab04b70 commit a787bf4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ group :test do
install_if -> { RUBY_VERSION >= '2.8' } do
gem 'rexml', '>= 3.2.4'
end
gem 'base64'
gem 'json', '>= 2.3.0'
gem 'jwt', '~> 2.2', '>= 2.2.1'
gem 'mime-types', '~> 3.3', '>= 3.3.1'
Expand Down
3 changes: 1 addition & 2 deletions lib/octokit/client/code_scanning.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'base64'
require 'tempfile'
require 'zlib'

Expand Down Expand Up @@ -45,7 +44,7 @@ def compress_sarif_data(file)
Zlib::GzipWriter.open(tempfile) do |gz_file|
gz_file.write File.binread(file)
end
Base64.strict_encode64(tempfile.read)
[tempfile.read].pack('m0') # Base64.strict_encode64
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions lib/octokit/client/contents.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'base64'

module Octokit
class Client
# Methods for the Repo Contents API
Expand Down Expand Up @@ -80,7 +78,7 @@ def create_contents(*args)
end
raise ArgumentError, 'content or :file option required' if content.nil?

options[:content] = Base64.strict_encode64(content)
options[:content] = [content].pack('m0') # Base64.strict_encode64
options[:message] = message
url = "#{Repository.path repo}/contents/#{path}"
put url, options
Expand Down
1 change: 0 additions & 1 deletion octokit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'octokit/version'

Gem::Specification.new do |spec|
spec.add_dependency 'base64'
spec.add_dependency 'faraday', '>= 1', '< 3'
spec.add_dependency 'sawyer', '~> 0.9'
spec.authors = ['Wynn Netherland', 'Erik Michaels-Ober', 'Clint Shryock']
Expand Down
2 changes: 2 additions & 0 deletions spec/octokit/client/licenses_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'base64'

describe Octokit::Client::Licenses do
describe '.licenses', :vcr do
it 'returns all licenses' do
Expand Down

0 comments on commit a787bf4

Please sign in to comment.