homebrew-cask-versions/lib/hbc/staged.rb
Roland Walker 202d6019f8 Move all code under an Hbc:: namespace
* convert existing Cask:: namespace to Hbc::
* move Homebrew-fork code under Hbc::
* move freestanding classes such as Tty and TopologicalHash under Hbc::
* recast HOMEBREW_CASK_ constants as HBC_
* modify our Homebrew Formula for backward compatibility
* devscripts and dev docs
2015-01-02 07:27:03 -05:00

28 lines
802 B
Ruby

module Hbc::Staged
def info_plist_file(index = 0)
index = 0 if index == :first
index = 1 if index == :second
index = -1 if index == :last
@cask.staged_path.join(@cask.artifacts[:app].to_a.at(index).first, 'Contents', 'Info.plist')
end
def plist_exec(cmd)
@command.run!('/usr/libexec/PlistBuddy', :args => ['-c', cmd, info_plist_file])
end
def plist_set(key, value)
begin
plist_exec("Set #{key} #{value}")
rescue StandardError => e
raise Hbc::CaskError.new("#{@cask.token}: 'plist_set' failed with: #{e}")
end
end
def bundle_identifier
begin
plist_exec('Print CFBundleIdentifier').stdout.chomp
rescue StandardError => e
raise Hbc::CaskError.new("#{@cask.token}: 'bundle_identifier' failed with: #{e}")
end
end
end