Add helper method for Cask fixture paths and refactor CaskLoader.
This commit is contained in:
parent
113e5da55e
commit
97333df4cb
@ -71,7 +71,7 @@ module Hbc
|
||||
return if previous_cask_contents.empty?
|
||||
|
||||
begin
|
||||
previous_cask = CaskLoader.load_from_string(previous_cask_contents)
|
||||
previous_cask = CaskLoader.load(previous_cask_contents)
|
||||
|
||||
return unless previous_cask.version == cask.version
|
||||
return if previous_cask.sha256 == cask.sha256
|
||||
|
||||
@ -43,7 +43,7 @@ module Hbc
|
||||
def audit_languages(languages)
|
||||
ohai "Auditing language: #{languages.map { |lang| "'#{lang}'" }.join(", ")}"
|
||||
MacOS.instance_variable_set(:@languages, languages)
|
||||
audit_cask_instance(CaskLoader.load_from_file(cask.sourcefile_path))
|
||||
audit_cask_instance(CaskLoader.load(cask.sourcefile_path))
|
||||
ensure
|
||||
CLI::Cleanup.run(cask.token) if audit_download?
|
||||
end
|
||||
|
||||
@ -147,14 +147,6 @@ module Hbc
|
||||
end
|
||||
end
|
||||
|
||||
def self.load_from_file(path)
|
||||
FromPathLoader.new(path).load
|
||||
end
|
||||
|
||||
def self.load_from_string(content)
|
||||
FromContentLoader.new(content).load
|
||||
end
|
||||
|
||||
def self.path(ref)
|
||||
self.for(ref).path
|
||||
end
|
||||
@ -164,6 +156,13 @@ module Hbc
|
||||
end
|
||||
|
||||
def self.for(ref)
|
||||
if ref.respond_to?(:to_str)
|
||||
content = ref.to_str
|
||||
if content.match?(/\A\s*cask\s+(?:"[^"]*"|'[^']*')\s+do(?:\s+.*\s+|;?\s+)end\s*\Z/)
|
||||
return FromContentLoader.new(content)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
FromInstanceLoader,
|
||||
FromURILoader,
|
||||
|
||||
@ -23,7 +23,7 @@ module Hbc
|
||||
elsif versions?
|
||||
puts self.class.format_versioned(cask)
|
||||
else
|
||||
cask = CaskLoader.load_from_file(cask.installed_caskfile)
|
||||
cask = CaskLoader.load(cask.installed_caskfile)
|
||||
self.class.list_artifacts(cask)
|
||||
end
|
||||
end
|
||||
|
||||
@ -16,7 +16,7 @@ module Hbc
|
||||
|
||||
if cask.installed? && !cask.installed_caskfile.nil?
|
||||
# use the same cask file that was used for installation, if possible
|
||||
cask = CaskLoader.load_from_file(cask.installed_caskfile) if cask.installed_caskfile.exist?
|
||||
cask = CaskLoader.load(cask.installed_caskfile) if cask.installed_caskfile.exist?
|
||||
end
|
||||
|
||||
Installer.new(cask, binaries: binaries?, verbose: verbose?, force: force?).uninstall
|
||||
|
||||
@ -126,7 +126,7 @@ module Hbc
|
||||
|
||||
# use the same cask file that was used for installation, if possible
|
||||
installed_caskfile = @cask.installed_caskfile
|
||||
installed_cask = installed_caskfile.exist? ? CaskLoader.load_from_file(installed_caskfile) : @cask
|
||||
installed_cask = installed_caskfile.exist? ? CaskLoader.load(installed_caskfile) : @cask
|
||||
|
||||
# Always force uninstallation, ignore method parameter
|
||||
Installer.new(installed_cask, binaries: binaries?, verbose: verbose?, force: true).uninstall
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# TODO: this test should be named after the corresponding class, once
|
||||
# that class is abstracted from installer.rb.
|
||||
describe "Accessibility Access", :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-accessibility-access.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-accessibility-access")) }
|
||||
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
|
||||
let(:installer) { Hbc::Installer.new(cask, command: fake_system_command) }
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
describe Hbc::Artifact::App, :cask do
|
||||
describe "activate to alternate target" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-alt-target.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-alt-target")) }
|
||||
|
||||
let(:install_phase) {
|
||||
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::Artifact::App, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("local-caffeine")) }
|
||||
let(:command) { Hbc::SystemCommand }
|
||||
let(:force) { false }
|
||||
let(:app) { described_class.for_cask(cask).first }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
describe Hbc::Artifact::Binary, :cask do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb").tap do |cask|
|
||||
Hbc::CaskLoader.load(cask_path("with-binary")).tap do |cask|
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
@ -16,7 +16,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
|
||||
context "when --no-binaries is specified" do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb")
|
||||
Hbc::CaskLoader.load(cask_path("with-binary"))
|
||||
}
|
||||
|
||||
it "doesn't link the binary when --no-binaries is specified" do
|
||||
@ -35,7 +35,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
|
||||
context "when the binary is not executable" do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-non-executable-binary.rb").tap do |cask|
|
||||
Hbc::CaskLoader.load(cask_path("with-non-executable-binary")).tap do |cask|
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
@ -85,7 +85,7 @@ describe Hbc::Artifact::Binary, :cask do
|
||||
|
||||
context "binary is inside an app package" do
|
||||
let(:cask) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-embedded-binary.rb").tap do |cask|
|
||||
Hbc::CaskLoader.load(cask_path("with-embedded-binary")).tap do |cask|
|
||||
InstallHelper.install_without_artifacts(cask)
|
||||
end
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::Artifact::Artifact, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-generic-artifact")) }
|
||||
|
||||
let(:install_phase) {
|
||||
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
|
||||
@ -15,7 +15,7 @@ describe Hbc::Artifact::Artifact, :cask do
|
||||
context "without target" do
|
||||
it "fails to load" do
|
||||
expect {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact-no-target.rb")
|
||||
Hbc::CaskLoader.load(cask_path("with-generic-artifact-no-target"))
|
||||
}.to raise_error(Hbc::CaskInvalidError, /target required for Generic Artifact/)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
describe Hbc::Artifact::NestedContainer, :cask do
|
||||
describe "install" do
|
||||
it "extracts the specified paths as containers" do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb").tap do |c|
|
||||
cask = Hbc::CaskLoader.load(cask_path("nested-app")).tap do |c|
|
||||
InstallHelper.install_without_artifacts(c)
|
||||
end
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::Artifact::Pkg, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-installable")) }
|
||||
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
|
||||
|
||||
before(:each) do
|
||||
@ -22,7 +22,7 @@ describe Hbc::Artifact::Pkg, :cask do
|
||||
end
|
||||
|
||||
describe "choices" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-choices.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-choices")) }
|
||||
|
||||
it "passes the choice changes xml to the system installer" do
|
||||
pkg = described_class.for_cask(cask).first
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::Artifact::Suite, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-suite.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-suite")) }
|
||||
|
||||
let(:install_phase) {
|
||||
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
describe Hbc::Artifact::App, :cask do
|
||||
describe "multiple apps" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-correct.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-two-apps-correct")) }
|
||||
|
||||
let(:install_phase) {
|
||||
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
|
||||
@ -27,7 +27,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
end
|
||||
|
||||
describe "when apps are in a subdirectory" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-subdir.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-two-apps-subdir")) }
|
||||
|
||||
it "installs both apps using the proper target directory" do
|
||||
install_phase.call
|
||||
|
||||
@ -2,7 +2,7 @@ describe Hbc::Artifact::App, :cask do
|
||||
# FIXME: Doesn't actually raise because the `app` stanza is not evaluated on load.
|
||||
# it "must raise" do
|
||||
# lambda {
|
||||
# Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-incorrect.rb")
|
||||
# Hbc::CaskLoader.load(cask_path("with-two-apps-incorrect"))
|
||||
# }.must_raise
|
||||
# # TODO: later give the user a nice exception for this case and check for it here
|
||||
# end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::Artifact::Zap, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-installable")) }
|
||||
|
||||
let(:zap_artifact) {
|
||||
described_class.for_cask(cask).first
|
||||
|
||||
@ -6,7 +6,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
subject { artifact.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) }
|
||||
|
||||
context "using :launchctl" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-launchctl.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-launchctl")) }
|
||||
let(:launchctl_list_cmd) { %w[/bin/launchctl list my.fancy.package.service] }
|
||||
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
|
||||
let(:unknown_response) { "launchctl list returned unknown response\n" }
|
||||
@ -61,7 +61,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
context "using :pkgutil" do
|
||||
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
|
||||
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-pkgutil.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-pkgutil")) }
|
||||
|
||||
let(:main_pkg_id) { "my.fancy.package.main" }
|
||||
let(:agent_pkg_id) { "my.fancy.package.agent" }
|
||||
@ -85,7 +85,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
end
|
||||
|
||||
context "using :kext" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-kext.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-kext")) }
|
||||
let(:kext_id) { "my.fancy.package.kernelextension" }
|
||||
|
||||
it "is supported" do
|
||||
@ -110,7 +110,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
end
|
||||
|
||||
context "using :quit" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-quit.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-quit")) }
|
||||
let(:bundle_id) { "my.fancy.package.app" }
|
||||
let(:quit_application_script) do
|
||||
%Q(tell application id "#{bundle_id}" to quit)
|
||||
@ -130,7 +130,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
end
|
||||
|
||||
context "using :signal" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-signal.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-signal")) }
|
||||
let(:bundle_id) { "my.fancy.package.app" }
|
||||
let(:signals) { %w[TERM KILL] }
|
||||
let(:unix_pids) { [12_345, 67_890] }
|
||||
@ -172,7 +172,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
end
|
||||
|
||||
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-#{directive}.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) }
|
||||
|
||||
before(:each) do
|
||||
allow_any_instance_of(Hbc::Artifact::AbstractUninstall).to receive(:trash_paths)
|
||||
@ -198,7 +198,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
|
||||
context "using :rmdir" do
|
||||
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-rmdir.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-rmdir")) }
|
||||
let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") }
|
||||
let(:ds_store) { empty_directory.join(".DS_Store") }
|
||||
|
||||
@ -226,7 +226,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
context "using #{script_type.inspect}" do
|
||||
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
|
||||
let(:token) { "with-#{artifact_dsl_key}-#{script_type}".tr("_", "-") }
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path(token.to_s)) }
|
||||
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
||||
|
||||
it "is supported" do
|
||||
@ -252,7 +252,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
||||
end
|
||||
|
||||
context "using :login_item" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-login-item.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-login-item")) }
|
||||
|
||||
it "is supported" do
|
||||
Hbc::FakeSystemCommand.expects_command(
|
||||
|
||||
@ -3,11 +3,11 @@ require_relative "shared_examples/invalid_option"
|
||||
|
||||
describe Hbc::CLI::Fetch, :cask do
|
||||
let(:local_transmission) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
}
|
||||
|
||||
let(:local_caffeine) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
}
|
||||
|
||||
it_behaves_like "a command that requires a Cask token"
|
||||
|
||||
@ -22,16 +22,16 @@ describe Hbc::CLI::Install, :cask do
|
||||
it "allows staging and activation of multiple Casks at once" do
|
||||
described_class.run("local-transmission", "local-caffeine")
|
||||
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
|
||||
expect(Hbc.appdir.join("Transmission.app")).to be_a_directory
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-caffeine"))).to be_installed
|
||||
expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory
|
||||
end
|
||||
|
||||
it "skips double install (without nuking existing installation)" do
|
||||
described_class.run("local-transmission")
|
||||
described_class.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
|
||||
end
|
||||
|
||||
it "prints a warning message on double install" do
|
||||
@ -54,9 +54,9 @@ describe Hbc::CLI::Install, :cask do
|
||||
|
||||
it "skips dependencies with --skip-cask-deps" do
|
||||
described_class.run("with-depends-on-cask-multiple", "--skip-cask-deps")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).not_to be_installed
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("with-depends-on-cask-multiple"))).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-caffeine"))).not_to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed
|
||||
end
|
||||
|
||||
it "properly handles Casks that are not present" do
|
||||
|
||||
@ -65,8 +65,8 @@ describe Hbc::CLI::List, :cask do
|
||||
end
|
||||
|
||||
describe "given a set of installed Casks" do
|
||||
let(:caffeine) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
|
||||
let(:transmission) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") }
|
||||
let(:caffeine) { Hbc::CaskLoader.load(cask_path("local-caffeine")) }
|
||||
let(:transmission) { Hbc::CaskLoader.load(cask_path("local-transmission")) }
|
||||
let(:casks) { [caffeine, transmission] }
|
||||
|
||||
it "lists the installed files for those Casks" do
|
||||
|
||||
@ -3,11 +3,11 @@ require_relative "shared_examples/invalid_option"
|
||||
describe Hbc::CLI::Outdated, :cask do
|
||||
let(:installed) do
|
||||
[
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb"),
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/local-caffeine.rb"),
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/local-transmission.rb"),
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/version-latest-string.rb"),
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/outdated/auto-updates.rb"),
|
||||
Hbc::CaskLoader.load(cask_path("basic-cask")),
|
||||
Hbc::CaskLoader.load(cask_path("outdated/local-caffeine")),
|
||||
Hbc::CaskLoader.load(cask_path("outdated/local-transmission")),
|
||||
Hbc::CaskLoader.load(cask_path("version-latest-string")),
|
||||
Hbc::CaskLoader.load(cask_path("outdated/auto-updates")),
|
||||
]
|
||||
end
|
||||
|
||||
@ -74,7 +74,7 @@ describe Hbc::CLI::Outdated, :cask do
|
||||
end
|
||||
|
||||
it 'does not include the Casks with "auto_updates true" when the version did not change' do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
|
||||
cask = Hbc::CaskLoader.load(cask_path("auto-updates"))
|
||||
InstallHelper.install_with_caskfile(cask)
|
||||
|
||||
expect {
|
||||
|
||||
@ -4,7 +4,7 @@ describe Hbc::CLI::Reinstall, :cask do
|
||||
it_behaves_like "a command that handles invalid options"
|
||||
|
||||
it "displays the reinstallation progress" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -27,16 +27,16 @@ describe Hbc::CLI::Reinstall, :cask do
|
||||
it "allows reinstalling a Cask" do
|
||||
Hbc::CLI::Install.run("local-transmission")
|
||||
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
|
||||
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
|
||||
end
|
||||
|
||||
it "allows reinstalling a non installed Cask" do
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed
|
||||
|
||||
Hbc::CLI::Reinstall.run("local-transmission")
|
||||
expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
|
||||
expect(Hbc::CaskLoader.load(cask_path("local-transmission"))).to be_installed
|
||||
end
|
||||
end
|
||||
|
||||
@ -6,7 +6,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
it_behaves_like "a command that handles invalid options"
|
||||
|
||||
it "displays the uninstallation progress" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -37,8 +37,8 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
end
|
||||
|
||||
it "can uninstall and unlink multiple Casks at once" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
@ -55,7 +55,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
end
|
||||
|
||||
it "calls `uninstall` before removing artifacts" do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb")
|
||||
cask = Hbc::CaskLoader.load(cask_path("with-uninstall-script-app"))
|
||||
|
||||
Hbc::Installer.new(cask).install
|
||||
|
||||
@ -71,7 +71,7 @@ describe Hbc::CLI::Uninstall, :cask do
|
||||
end
|
||||
|
||||
it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do
|
||||
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb")
|
||||
cask = Hbc::CaskLoader.load(cask_path("with-uninstall-script-app"))
|
||||
|
||||
Hbc::Installer.new(cask).install
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ describe Hbc::CLI::Zap, :cask do
|
||||
end
|
||||
|
||||
it "can zap and unlink multiple Casks at once" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
Hbc::Installer.new(transmission).install
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
describe "conflicts_with", :cask do
|
||||
describe "conflicts_with cask" do
|
||||
let(:local_caffeine) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
}
|
||||
|
||||
let(:with_conflicts_with) {
|
||||
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-conflicts-with.rb")
|
||||
Hbc::CaskLoader.load(cask_path("with-conflicts-with"))
|
||||
}
|
||||
|
||||
it "installs the dependency of a Cask and the Cask itself" do
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
describe Hbc::Container::Dmg, :cask do
|
||||
describe "#mount!" do
|
||||
it "does not store nil mounts for dmgs with extra data" do
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
|
||||
dmg = Hbc::Container::Dmg.new(
|
||||
transmission,
|
||||
|
||||
@ -9,7 +9,7 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
||||
|
||||
describe "depends_on cask" do
|
||||
context "when depends_on cask is cyclic" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-cyclic.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-cask-cyclic")) }
|
||||
it {
|
||||
is_expected.to raise_error(Hbc::CaskCyclicDependencyError,
|
||||
"Cask 'with-depends-on-cask-cyclic' includes cyclic dependencies on other Casks: with-depends-on-cask-cyclic-helper")
|
||||
@ -17,7 +17,7 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
||||
end
|
||||
|
||||
context do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-cask")) }
|
||||
let(:dependency) { Hbc::CaskLoader.load(cask.depends_on.cask.first) }
|
||||
|
||||
it "installs the dependency of a Cask and the Cask itself" do
|
||||
@ -30,34 +30,34 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
||||
|
||||
describe "depends_on macos" do
|
||||
context "given an array" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-array.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-macos-array")) }
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
|
||||
context "given a comparison" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-comparison.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-macos-comparison")) }
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
|
||||
context "given a string" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-macos-string")) }
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
|
||||
context "given a symbol" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-symbol.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-macos-symbol")) }
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
|
||||
context "when not satisfied" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-failure.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-macos-failure")) }
|
||||
it { is_expected.to raise_error(Hbc::CaskError) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "depends_on arch" do
|
||||
context "when satisfied" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-arch")) }
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
end
|
||||
@ -68,21 +68,21 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
||||
end
|
||||
|
||||
context "when satisfied" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-x11")) }
|
||||
let(:x11_installed) { true }
|
||||
|
||||
it { is_expected.not_to raise_error }
|
||||
end
|
||||
|
||||
context "when not satisfied" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-x11")) }
|
||||
let(:x11_installed) { false }
|
||||
|
||||
it { is_expected.to raise_error(Hbc::CaskX11DependencyError) }
|
||||
end
|
||||
|
||||
context "when depends_on x11: false" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11-false.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("with-depends-on-x11-false")) }
|
||||
let(:x11_installed) { false }
|
||||
|
||||
it { is_expected.not_to raise_error }
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
|
||||
|
||||
describe Hbc::DSL::Caveats, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("basic-cask")) }
|
||||
let(:dsl) { Hbc::DSL::Caveats.new(cask) }
|
||||
|
||||
it_behaves_like Hbc::DSL::Base
|
||||
|
||||
@ -2,7 +2,7 @@ require "test/support/helper/spec/shared_examples/hbc_dsl_base"
|
||||
require "test/support/helper/spec/shared_examples/hbc_staged"
|
||||
|
||||
describe Hbc::DSL::Postflight, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("basic-cask")) }
|
||||
let(:dsl) { Hbc::DSL::Postflight.new(cask, Hbc::FakeSystemCommand) }
|
||||
|
||||
it_behaves_like Hbc::DSL::Base
|
||||
|
||||
@ -2,7 +2,7 @@ require "test/support/helper/spec/shared_examples/hbc_dsl_base"
|
||||
require "test/support/helper/spec/shared_examples/hbc_staged"
|
||||
|
||||
describe Hbc::DSL::Preflight, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("basic-cask")) }
|
||||
let(:dsl) { Hbc::DSL::Preflight.new(cask, Hbc::FakeSystemCommand) }
|
||||
|
||||
it_behaves_like Hbc::DSL::Base
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
require "test/support/helper/spec/shared_examples/hbc_dsl_base"
|
||||
|
||||
describe Hbc::DSL::UninstallPostflight, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("basic-cask")) }
|
||||
let(:dsl) { Hbc::DSL::UninstallPostflight.new(cask, Hbc::FakeSystemCommand) }
|
||||
|
||||
it_behaves_like Hbc::DSL::Base
|
||||
|
||||
@ -2,7 +2,7 @@ require "test/support/helper/spec/shared_examples/hbc_dsl_base"
|
||||
require "test/support/helper/spec/shared_examples/hbc_staged"
|
||||
|
||||
describe Hbc::DSL::UninstallPreflight, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("basic-cask")) }
|
||||
let(:dsl) { Hbc::DSL::UninstallPreflight.new(cask, Hbc::FakeSystemCommand) }
|
||||
|
||||
it_behaves_like Hbc::DSL::Base
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
describe Hbc::DSL, :cask do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path(token.to_s)) }
|
||||
let(:token) { "basic-cask" }
|
||||
|
||||
context "stanzas" do
|
||||
|
||||
@ -5,7 +5,7 @@ describe Hbc::Installer, :cask do
|
||||
}
|
||||
|
||||
it "downloads and installs a nice fresh Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -14,7 +14,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works with dmg-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-dmg.rb")
|
||||
asset = Hbc::CaskLoader.load(cask_path("container-dmg"))
|
||||
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
@ -23,7 +23,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works with tar-gz-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-tar-gz.rb")
|
||||
asset = Hbc::CaskLoader.load(cask_path("container-tar-gz"))
|
||||
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
@ -32,7 +32,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works with xar-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb")
|
||||
asset = Hbc::CaskLoader.load(cask_path("container-xar"))
|
||||
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
@ -41,7 +41,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works with pure bzip2-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb")
|
||||
asset = Hbc::CaskLoader.load(cask_path("container-bzip2"))
|
||||
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
@ -50,7 +50,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works with pure gzip-based Casks" do
|
||||
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gzip.rb")
|
||||
asset = Hbc::CaskLoader.load(cask_path("container-gzip"))
|
||||
|
||||
Hbc::Installer.new(asset).install
|
||||
|
||||
@ -59,21 +59,21 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "blows up on a bad checksum" do
|
||||
bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb")
|
||||
bad_checksum = Hbc::CaskLoader.load(cask_path("bad-checksum"))
|
||||
expect {
|
||||
Hbc::Installer.new(bad_checksum).install
|
||||
}.to raise_error(Hbc::CaskSha256MismatchError)
|
||||
end
|
||||
|
||||
it "blows up on a missing checksum" do
|
||||
missing_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/missing-checksum.rb")
|
||||
missing_checksum = Hbc::CaskLoader.load(cask_path("missing-checksum"))
|
||||
expect {
|
||||
Hbc::Installer.new(missing_checksum).install
|
||||
}.to raise_error(Hbc::CaskSha256MissingError)
|
||||
end
|
||||
|
||||
it "installs fine if sha256 :no_check is used" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
no_checksum = Hbc::CaskLoader.load(cask_path("no-checksum"))
|
||||
|
||||
Hbc::Installer.new(no_checksum).install
|
||||
|
||||
@ -81,14 +81,14 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "fails to install if sha256 :no_check is used with --require-sha" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
no_checksum = Hbc::CaskLoader.load(cask_path("no-checksum"))
|
||||
expect {
|
||||
Hbc::Installer.new(no_checksum, require_sha: true).install
|
||||
}.to raise_error(Hbc::CaskNoShasumError)
|
||||
end
|
||||
|
||||
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
|
||||
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||
no_checksum = Hbc::CaskLoader.load(cask_path("no-checksum"))
|
||||
|
||||
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
|
||||
|
||||
@ -96,7 +96,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "prints caveats if they're present" do
|
||||
with_caveats = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-caveats.rb")
|
||||
with_caveats = Hbc::CaskLoader.load(cask_path("with-caveats"))
|
||||
|
||||
expect {
|
||||
Hbc::Installer.new(with_caveats).install
|
||||
@ -106,7 +106,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "prints installer :manual instructions when present" do
|
||||
with_installer_manual = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
|
||||
with_installer_manual = Hbc::CaskLoader.load(cask_path("with-installer-manual"))
|
||||
|
||||
expect {
|
||||
Hbc::Installer.new(with_installer_manual).install
|
||||
@ -116,7 +116,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "does not extract __MACOSX directories from zips" do
|
||||
with_macosx_dir = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-macosx-dir.rb")
|
||||
with_macosx_dir = Hbc::CaskLoader.load(cask_path("with-macosx-dir"))
|
||||
|
||||
Hbc::Installer.new(with_macosx_dir).install
|
||||
|
||||
@ -124,7 +124,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "allows already-installed Casks which auto-update to be installed if force is provided" do
|
||||
with_auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
|
||||
with_auto_updates = Hbc::CaskLoader.load(cask_path("auto-updates"))
|
||||
|
||||
expect(with_auto_updates).not_to be_installed
|
||||
|
||||
@ -137,7 +137,7 @@ describe Hbc::Installer, :cask do
|
||||
|
||||
# unlike the CLI, the internal interface throws exception on double-install
|
||||
it "installer method raises an exception when already-installed Casks are attempted" do
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
|
||||
expect(transmission).not_to be_installed
|
||||
|
||||
@ -151,7 +151,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "allows already-installed Casks to be installed if force is provided" do
|
||||
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
|
||||
|
||||
expect(transmission).not_to be_installed
|
||||
|
||||
@ -163,7 +163,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works naked-pkg-based Casks" do
|
||||
naked_pkg = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-pkg.rb")
|
||||
naked_pkg = Hbc::CaskLoader.load(cask_path("container-pkg"))
|
||||
|
||||
Hbc::Installer.new(naked_pkg).install
|
||||
|
||||
@ -171,7 +171,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works properly with an overridden container :type" do
|
||||
naked_executable = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/naked-executable.rb")
|
||||
naked_executable = Hbc::CaskLoader.load(cask_path("naked-executable"))
|
||||
|
||||
Hbc::Installer.new(naked_executable).install
|
||||
|
||||
@ -179,7 +179,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "works fine with a nested container" do
|
||||
nested_app = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb")
|
||||
nested_app = Hbc::CaskLoader.load(cask_path("nested-app"))
|
||||
|
||||
Hbc::Installer.new(nested_app).install
|
||||
|
||||
@ -187,7 +187,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "generates and finds a timestamped metadata directory for an installed Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -196,7 +196,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "generates and finds a metadata subdirectory for an installed Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -208,7 +208,7 @@ describe Hbc::Installer, :cask do
|
||||
|
||||
describe "uninstall" do
|
||||
it "fully uninstalls a Cask" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
installer = Hbc::Installer.new(caffeine)
|
||||
|
||||
installer.install
|
||||
@ -220,7 +220,7 @@ describe Hbc::Installer, :cask do
|
||||
end
|
||||
|
||||
it "uninstalls all versions if force is set" do
|
||||
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
|
||||
mutated_version = caffeine.version + ".1"
|
||||
|
||||
Hbc::Installer.new(caffeine).install
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# to be invoking bundle_identifier off of the installer instance.
|
||||
describe "Operations on staged Casks", :cask do
|
||||
describe "bundle ID" do
|
||||
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") }
|
||||
let(:cask) { Hbc::CaskLoader.load(cask_path("local-transmission")) }
|
||||
let(:installer) { Hbc::Installer.new(cask) }
|
||||
it "fetches the bundle ID from a staged cask" do
|
||||
installer.install
|
||||
|
||||
@ -8,6 +8,10 @@ module Test
|
||||
def bundle_path(name)
|
||||
Pathname.new("#{TEST_FIXTURE_DIR}/mach/#{name}.bundle")
|
||||
end
|
||||
|
||||
def cask_path(name)
|
||||
Pathname.new("#{TEST_FIXTURE_DIR}/cask/Casks/#{name}.rb")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user