diff --git a/Library/Homebrew/cask/staged.rb b/Library/Homebrew/cask/staged.rb index 51a2f92ce4..e2aacc351a 100644 --- a/Library/Homebrew/cask/staged.rb +++ b/Library/Homebrew/cask/staged.rb @@ -2,29 +2,6 @@ require "utils/user" module Cask module Staged - def info_plist_file(index = 0) - index = 0 if index == :first - index = 1 if index == :second - index = -1 if index == :last - @cask.artifacts.select { |a| a.is_a?(Artifact::App) }.at(index).target.join("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) - plist_exec("Set #{key} #{value}") - rescue => e - raise CaskError, "#{@cask.token}: 'plist_set' failed with: #{e}" - end - - def bundle_identifier - plist_exec("Print CFBundleIdentifier").stdout.chomp - rescue => e - raise CaskError, "#{@cask.token}: 'bundle_identifier' failed with: #{e}" - end - def set_permissions(paths, permissions_str) full_paths = remove_nonexistent(paths) return if full_paths.empty? diff --git a/Library/Homebrew/test/cask/staged_spec.rb b/Library/Homebrew/test/cask/staged_spec.rb deleted file mode 100644 index 6f1322dd26..0000000000 --- a/Library/Homebrew/test/cask/staged_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# TODO: this test should be named after the corresponding class, once -# that class is abstracted from installer.rb. It makes little sense -# to be invoking bundle_identifier off of the installer instance. -describe "Operations on staged Casks", :cask do - describe "bundle ID" do - let(:cask) { Cask::CaskLoader.load(cask_path("local-transmission")) } - let(:installer) { Cask::Installer.new(cask) } - - it "fetches the bundle ID from a staged cask" do - installer.install - expect(installer.bundle_identifier).to eq("org.m0k.transmission") - end - end -end diff --git a/Library/Homebrew/test/support/helper/spec/shared_examples/cask_staged.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/cask_staged.rb index 888e76ea63..78e6ae5997 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_examples/cask_staged.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_examples/cask_staged.rb @@ -21,30 +21,6 @@ shared_examples Cask::Staged do staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) end - it "can get the Info.plist file for the primary app" do - expect(staged.info_plist_file).to eq Cask::Config.global.appdir.join("TestCask.app/Contents/Info.plist") - end - - it "can execute commands on the Info.plist file" do - allow(staged).to receive(:bundle_identifier).and_return("com.example.BasicCask") - - FakeSystemCommand.expects_command( - ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file], - ) - - staged.plist_exec("Print CFBundleIdentifier") - end - - it "can set a key in the Info.plist file" do - allow(staged).to receive(:bundle_identifier).and_return("com.example.BasicCask") - - FakeSystemCommand.expects_command( - ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file], - ) - - staged.plist_set(":JVMOptions:JVMVersion", "1.6+") - end - it "can set the permissions of a file" do fake_pathname = existing_path allow(staged).to receive(:Pathname).and_return(fake_pathname)