Skip to content

Commit

Permalink
Merge pull request #51 from apainintheneck/fix-cask-token-error-in-ap…
Browse files Browse the repository at this point in the history
…i-readall-test

Fix cask token error in `brew api-readall-test`
  • Loading branch information
apainintheneck authored Oct 6, 2024
2 parents 7cb5682 + 0f5365e commit 117e8b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ end

namespace "test" do
task :"api-readall-test" do
cmd "brew", "api-readall-test"
cmd "brew", "api-readall-test", "--verbose"
end

task :"branch-compare" do
Expand Down
6 changes: 3 additions & 3 deletions lib/hd-utils/stub-api/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ module StubAPI
module Cask
abort "The core cask tap needs to be installed locally to mock the API!" unless CoreCaskTap.instance.installed?

NAMES = CoreCaskTap.instance.cask_tokens.freeze

print "Generating cask API ..."

# Generate json representation of all casks.
::Cask::Cask.generating_hash!
JSON = NAMES.to_h do |cask_name|
JSON = CoreCaskTap.instance.cask_tokens.to_h do |cask_name|
cask = ::Cask::CaskLoader.load(cask_name)
json = JSON.generate(cask.to_hash_with_variations)
hash = JSON.parse(json)
[hash["token"], hash.except("token")]
end.freeze
::Cask::Cask.generated_hash!

NAMES = JSON.keys.freeze

private_constant :NAMES, :JSON

def self.names
Expand Down

0 comments on commit 117e8b4

Please sign in to comment.