Skip to content

Commit 684ef92

Browse files
committed
feat: replace Base64 usage with String#pack
The change here replaces the singular use of `Base64.strict_encode64` with that method’s body, `["…"].pack("m0")`, pulled straight from the Base64 gem’s source (linked below). See-also: https://github.com/ruby/base64/blob/v0.3.0/lib/base64.rb#L282-L284
1 parent 3ad9d44 commit 684ef92

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

.toys/release.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ def build_docs
4040
end
4141

4242
def pull_gh_pages
43-
require "base64"
4443
Dir.chdir gh_pages_dir do
4544
exec ["git", "init"]
4645
exec ["git", "config", "--local", "user.name", "Google APIs"]
4746
exec ["git", "config", "--local", "user.email", "[email protected]"]
4847
if github_token && !github_token.empty? && github_remote.start_with?("https://")
49-
encoded_token = Base64.strict_encode64("x-access-token:#{github_token}")
48+
encoded_token = ["x-access-token:#{github_token}"].pack("m0")
5049
log_cmd = '["git", "config", "--local", "http.https://github.com/.extraheader", "****"]'
5150
exec ["git", "config", "--local", "http.https://github.com/.extraheader",
5251
"Authorization: Basic #{encoded_token}"],

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ source "https://rubygems.org"
1616

1717
gemspec
1818

19-
gem "base64"
2019
gem "google-style", "~> 1.31.0"
2120
gem "minitest", "~> 5.16"
2221
gem "minitest-focus", "~> 1.2"

0 commit comments

Comments
 (0)