Remove unused methods in Staged module.

This commit is contained in:
Markus Reiter 2018-10-07 22:00:07 +02:00
parent 59e3a532ff
commit b7cf925da8
3 changed files with 0 additions and 61 deletions

View File

@ -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?

View File

@ -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

View File

@ -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)