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

add explicit_s method from Cask#Config of homebrew/brew #1476

Merged
merged 2 commits into from
Oct 27, 2024
Merged
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
13 changes: 12 additions & 1 deletion lib/bundle/cask_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def cask_versions
def dump(describe: false)
casks.map do |cask|
description = "# #{cask.desc}\n" if describe && cask.desc.present?
config = ", args: { #{cask.config.explicit_s} }" if cask.config.present? && cask.config.explicit.present?
config = ", args: { #{explicit_s(cask.config)} }" if cask.config.present? && cask.config.explicit.present?
"#{description}cask \"#{cask}\"#{config}"
end.join("\n")
end
Expand All @@ -64,5 +64,16 @@ def casks
@casks ||= Cask::Caskroom.casks
end
private_class_method :casks

def explicit_s(cask_config)
cask_config.explicit.map do |key, value|
# inverse of #env - converts :languages config key back to --language flag
if key == :languages
key = "language"
value = cask_config.explicit.fetch(:languages, []).join(",")
end
"#{key}: \"#{value.to_s.sub(/^#{Dir.home}/, "~")}\""
end.join(", ")
end
end
end