aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask
diff options
context:
space:
mode:
authorDavid Broder-Rodgers2017-01-30 18:31:52 +0000
committerDavid Broder-Rodgers2017-01-30 18:31:52 +0000
commit13a3a57fa86678e3a3cb9272fe04285cb538c55b (patch)
treec345802d70ff32e2f787986b2f5392ac76f367fb /Library/Homebrew/cask
parent3c566399cf8dab3aff8c54381e7b83b0e6ef3995 (diff)
parent35045b2934d94eabe302693a05b12fb530827454 (diff)
downloadbrew-13a3a57fa86678e3a3cb9272fe04285cb538c55b.tar.bz2
Merge remote-tracking branch 'origin/master' into insecure_audit
Diffstat (limited to 'Library/Homebrew/cask')
-rw-r--r--Library/Homebrew/cask/LICENSE23
-rw-r--r--Library/Homebrew/cask/lib/hbc.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/base.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/audit.rb27
-rw-r--r--Library/Homebrew/cask/lib/hbc/cache.rb21
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli.rb3
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb61
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_help.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb14
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/update.rb20
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl/appcast.rb16
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb26
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/system_command.rb4
-rw-r--r--Library/Homebrew/cask/spec/cask/audit_spec.rb2
-rw-r--r--Library/Homebrew/cask/spec/cask/cli_spec.rb16
-rw-r--r--Library/Homebrew/cask/spec/spec_helper.rb2
-rw-r--r--Library/Homebrew/cask/test/cask/artifact/suite_test.rb2
-rw-r--r--Library/Homebrew/cask/test/cask/depends_on_test.rb9
-rw-r--r--Library/Homebrew/cask/test/cask/dsl_test.rb6
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb2
-rw-r--r--Library/Homebrew/cask/test/test_helper.rb2
25 files changed, 132 insertions, 148 deletions
diff --git a/Library/Homebrew/cask/LICENSE b/Library/Homebrew/cask/LICENSE
deleted file mode 100644
index 62542ae57..000000000
--- a/Library/Homebrew/cask/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright © 2013-2016, Paul Hinze & Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this
- list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Library/Homebrew/cask/lib/hbc.rb b/Library/Homebrew/cask/lib/hbc.rb
index 69b6e8f21..775b9229f 100644
--- a/Library/Homebrew/cask/lib/hbc.rb
+++ b/Library/Homebrew/cask/lib/hbc.rb
@@ -46,7 +46,7 @@ module Hbc
def self.init
Cache.ensure_cache_exists
- Cache.migrate_legacy_cache
+ Cache.delete_legacy_cache
Caskroom.migrate_caskroom_from_repo_to_prefix
Caskroom.ensure_caskroom_exists
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/base.rb b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
index 05dbedd8f..b53c13f08 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
@@ -46,7 +46,7 @@ module Hbc
arguments = { executable: arguments } if arguments.is_a?(String)
# key sanity
- permitted_keys = [:args, :input, :executable, :must_succeed, :sudo, :bsexec, :print_stdout, :print_stderr]
+ permitted_keys = [:args, :input, :executable, :must_succeed, :sudo, :print_stdout, :print_stderr]
unknown_keys = arguments.keys - permitted_keys
unless unknown_keys.empty?
opoo %Q{Unknown arguments to #{description} -- #{unknown_keys.inspect} (ignored). Running "brew update; brew cleanup; brew cask cleanup" will likely fix it.}
diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb
index ab2f1bce5..12cefb939 100644
--- a/Library/Homebrew/cask/lib/hbc/audit.rb
+++ b/Library/Homebrew/cask/lib/hbc/audit.rb
@@ -60,6 +60,7 @@ module Hbc
def check_version
return unless cask.version
check_no_string_version_latest
+ check_no_file_separator_in_version
end
def check_no_string_version_latest
@@ -68,6 +69,13 @@ module Hbc
add_error "you should use version :latest instead of version 'latest'"
end
+ def check_no_file_separator_in_version
+ odebug "Verifying version does not contain '#{File::SEPARATOR}'"
+ return unless cask.version.raw_version.is_a?(String)
+ return unless cask.version.raw_version.include?(File::SEPARATOR)
+ add_error "version should not contain '#{File::SEPARATOR}'"
+ end
+
def check_sha256
return unless cask.sha256
check_sha256_no_check_if_latest
@@ -125,20 +133,19 @@ module Hbc
def check_appcast_checkpoint_accuracy
odebug "Verifying appcast checkpoint is accurate"
- result = @command.run("/usr/bin/curl", args: ["--compressed", "--location", "--user-agent", URL::FAKE_USER_AGENT, cask.appcast], print_stderr: false)
- if result.success?
- processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}, "")
- # This step is necessary to replicate running `sed` from the command line
- processed_appcast_text << "\n" unless processed_appcast_text.end_with?("\n")
+ result = cask.appcast.calculate_checkpoint
+
+ actual_checkpoint = result[:checkpoint]
+
+ if actual_checkpoint.nil?
+ add_warning "error retrieving appcast: #{result[:command_result].stderr}"
+ else
expected = cask.appcast.checkpoint
- actual = Digest::SHA2.hexdigest(processed_appcast_text)
- add_warning <<-EOS.undent unless expected == actual
+ add_warning <<-EOS.undent unless expected == actual_checkpoint
appcast checkpoint mismatch
Expected: #{expected}
- Actual: #{actual}
+ Actual: #{actual_checkpoint}
EOS
- else
- add_warning "error retrieving appcast: #{result.stderr}"
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cache.rb b/Library/Homebrew/cask/lib/hbc/cache.rb
index e343da3fa..7b586528e 100644
--- a/Library/Homebrew/cask/lib/hbc/cache.rb
+++ b/Library/Homebrew/cask/lib/hbc/cache.rb
@@ -9,27 +9,10 @@ module Hbc
Hbc.cache.mkpath
end
- def migrate_legacy_cache
+ def delete_legacy_cache
return unless Hbc.legacy_cache.exist?
- ohai "Migrating cached files to #{Hbc.cache}..."
- Hbc.legacy_cache.children.select(&:symlink?).each do |symlink|
- file = symlink.readlink
-
- new_name = file.basename
- .sub(/\-((?:(\d|#{DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$/x,
- '--\1')
-
- renamed_file = Hbc.cache.join(new_name)
-
- if file.exist?
- puts "#{file} -> #{renamed_file}"
- FileUtils.mv(file, renamed_file)
- end
-
- FileUtils.rm(symlink)
- end
-
+ ohai "Deleting legacy cache at #{Hbc.legacy_cache}..."
FileUtils.remove_entry_secure(Hbc.legacy_cache)
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb
index c9625c7e2..36fae3034 100644
--- a/Library/Homebrew/cask/lib/hbc/cli.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli.rb
@@ -19,11 +19,11 @@ require "hbc/cli/reinstall"
require "hbc/cli/search"
require "hbc/cli/style"
require "hbc/cli/uninstall"
-require "hbc/cli/update"
require "hbc/cli/zap"
require "hbc/cli/internal_use_base"
require "hbc/cli/internal_audit_modified_casks"
+require "hbc/cli/internal_appcast_checkpoint"
require "hbc/cli/internal_checkurl"
require "hbc/cli/internal_dump"
require "hbc/cli/internal_help"
@@ -77,6 +77,7 @@ module Hbc
def self.command_classes
@command_classes ||= constants.map(&method(:const_get))
.select { |sym| sym.respond_to?(:run) }
+ .sort_by(&:command_name)
end
def self.commands
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
new file mode 100644
index 000000000..790e917b2
--- /dev/null
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
@@ -0,0 +1,61 @@
+module Hbc
+ class CLI
+ class InternalAppcastCheckpoint < InternalUseBase
+ def self.run(*args)
+ calculate = args.include? "--calculate"
+ cask_tokens = cask_tokens_from(args)
+ raise CaskUnspecifiedError if cask_tokens.empty?
+
+ if cask_tokens.all? { |t| t =~ %r{^https?://} && t !~ /\.rb$/ }
+ appcask_checkpoint_for_url(cask_tokens)
+ else
+ appcask_checkpoint(cask_tokens, calculate)
+ end
+ end
+
+ def self.appcask_checkpoint_for_url(urls)
+ urls.each do |url|
+ appcast = DSL::Appcast.new(url)
+ puts appcast.calculate_checkpoint[:checkpoint]
+ end
+ end
+
+ def self.appcask_checkpoint(cask_tokens, calculate)
+ count = 0
+
+ cask_tokens.each do |cask_token|
+ cask = Hbc.load(cask_token)
+
+ if cask.appcast.nil?
+ opoo "Cask '#{cask}' is missing an `appcast` stanza."
+ else
+ if calculate
+ result = cask.appcast.calculate_checkpoint
+
+ checkpoint = result[:checkpoint]
+ else
+ checkpoint = cask.appcast.checkpoint
+ end
+
+ if checkpoint.nil?
+ onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}"
+ else
+ puts cask_tokens.count > 1 ? "#{checkpoint} #{cask}": checkpoint
+ count += 1
+ end
+ end
+ end
+
+ count == cask_tokens.count
+ end
+
+ def self.help
+ "prints or calculates a given Cask's or URL's appcast checkpoint"
+ end
+
+ def self.needs_init?
+ true
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
index af1494e5f..ac1b20493 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
@@ -27,7 +27,7 @@ module Hbc
end
def self.help
- "Dump the given Cask in YAML format"
+ "dump the given Cask in YAML format"
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
index 6c646cfd7..0908ee05e 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
@@ -16,7 +16,7 @@ module Hbc
end
def self.help
- "Print help strings for unstable internal-use commands"
+ "print help strings for unstable internal-use commands"
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
index e5c04ee51..105e946d7 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -50,12 +50,12 @@ module Hbc
:uninstall_postflight,
]
- def self.run(*arguments)
- table = arguments.include? "--table"
- quiet = arguments.include? "--quiet"
- format = :to_yaml if arguments.include? "--yaml"
- format = :inspect if arguments.include? "--inspect"
- cask_tokens = arguments.reject { |arg| arg.chars.first == "-" }
+ def self.run(*args)
+ table = args.include? "--table"
+ quiet = args.include? "--quiet"
+ format = :to_yaml if args.include? "--yaml"
+ format = :inspect if args.include? "--inspect"
+ cask_tokens = cask_tokens_from(args)
stanza = cask_tokens.shift.to_sym
cask_tokens = Hbc.all_tokens if cask_tokens.empty?
@@ -125,7 +125,7 @@ module Hbc
end
def self.help
- "Extract and render a specific stanza for the given Casks"
+ "extract and render a specific stanza for the given Casks"
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/update.rb b/Library/Homebrew/cask/lib/hbc/cli/update.rb
deleted file mode 100644
index 86d02bb55..000000000
--- a/Library/Homebrew/cask/lib/hbc/cli/update.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module Hbc
- class CLI
- class Update < Base
- def self.run(*_ignored)
- result = SystemCommand.run(HOMEBREW_BREW_FILE,
- args: ["update"])
- # TODO: separating stderr/stdout is undesirable here.
- # Hbc::SystemCommand should have an option for plain
- # unbuffered output.
- print result.stdout
- $stderr.print result.stderr
- exit result.exit_status
- end
-
- def self.help
- "a synonym for 'brew update'"
- end
- end
- end
-end
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb b/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb
index 2f1245d3d..e27870622 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl/appcast.rb
@@ -1,3 +1,5 @@
+require "hbc/system_command"
+
module Hbc
class DSL
class Appcast
@@ -9,6 +11,20 @@ module Hbc
@checkpoint = @parameters[:checkpoint]
end
+ def calculate_checkpoint
+ result = SystemCommand.run("/usr/bin/curl", args: ["--compressed", "--location", "--user-agent", URL::FAKE_USER_AGENT, @uri], print_stderr: false)
+
+ checkpoint = if result.success?
+ processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}m, "")
+ Digest::SHA2.hexdigest(processed_appcast_text)
+ end
+
+ {
+ checkpoint: checkpoint,
+ command_result: result,
+ }
+ end
+
def to_yaml
[@uri, @parameters].to_yaml
end
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
index 2168b7090..a8c1a1b73 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
@@ -13,30 +13,9 @@ module Hbc
].freeze
VALID_ARCHES = {
- intel: { type: :intel, bits: [32, 64] },
- ppc: { type: :ppc, bits: [32, 64] },
+ intel: { type: :intel, bits: 64 },
# specific
- i386: { type: :intel, bits: 32 },
x86_64: { type: :intel, bits: 64 },
- ppc_7400: { type: :ppc, bits: 32 },
- ppc_64: { type: :ppc, bits: 64 },
- }.freeze
-
- # Intentionally undocumented: catch variant spellings.
- ARCH_SYNONYMS = {
- x86_32: :i386,
- x8632: :i386,
- x8664: :x86_64,
- intel_32: :i386,
- intel32: :i386,
- intel_64: :x86_64,
- intel64: :x86_64,
- amd_64: :x86_64,
- amd64: :x86_64,
- ppc7400: :ppc_7400,
- ppc_32: :ppc_7400,
- ppc32: :ppc_7400,
- ppc64: :ppc_64,
}.freeze
attr_accessor :java
@@ -100,8 +79,7 @@ module Hbc
def arch=(*args)
@arch ||= []
arches = args.map do |elt|
- elt = elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
- ARCH_SYNONYMS.key?(elt) ? ARCH_SYNONYMS[elt] : elt
+ elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
end
invalid_arches = arches - VALID_ARCHES.keys
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 3875e1c8f..465011735 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -141,8 +141,8 @@ module Hbc
artifacts.each do |artifact|
odebug "Installing artifact of class #{artifact}"
- already_installed_artifacts.unshift(artifact)
artifact.new(@cask, options).install_phase
+ already_installed_artifacts.unshift(artifact)
end
rescue StandardError => e
begin
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index f28e84b2e..292b45d0c 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -1,3 +1,5 @@
+require "tap"
+
module Hbc
module Locations
def self.included(base)
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb
index 638069386..06ce276df 100644
--- a/Library/Homebrew/cask/lib/hbc/system_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -48,13 +48,11 @@ module Hbc
def process_options!
options.extend(HashValidator)
- .assert_valid_keys :input, :print_stdout, :print_stderr, :args, :must_succeed, :sudo, :bsexec
+ .assert_valid_keys :input, :print_stdout, :print_stderr, :args, :must_succeed, :sudo
sudo_prefix = %w[/usr/bin/sudo -E --]
sudo_prefix = sudo_prefix.insert(1, "-A") unless ENV["SUDO_ASKPASS"].nil?
- bsexec_prefix = ["/bin/launchctl", "bsexec", options[:bsexec] == :startup ? "/" : options[:bsexec]]
@command = [executable]
options[:print_stderr] = true unless options.key?(:print_stderr)
- @command.unshift(*bsexec_prefix) if options[:bsexec]
@command.unshift(*sudo_prefix) if options[:sudo]
@command.concat(options[:args]) if options.key?(:args) && !options[:args].empty?
@command[0] = Shellwords.shellescape(@command[0]) if @command.size == 1
diff --git a/Library/Homebrew/cask/spec/cask/audit_spec.rb b/Library/Homebrew/cask/spec/cask/audit_spec.rb
index c12063a1d..193b58fd6 100644
--- a/Library/Homebrew/cask/spec/cask/audit_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/audit_spec.rb
@@ -162,7 +162,7 @@ describe Hbc::Audit do
before do
allow(audit).to receive(:check_appcast_http_code)
- allow(fake_system_command).to receive(:run).and_return(fake_curl_result)
+ allow(Hbc::SystemCommand).to receive(:run).and_return(fake_curl_result)
allow(fake_curl_result).to receive(:success?).and_return(success)
end
diff --git a/Library/Homebrew/cask/spec/cask/cli_spec.rb b/Library/Homebrew/cask/spec/cask/cli_spec.rb
index 9964275f1..6b2313a41 100644
--- a/Library/Homebrew/cask/spec/cask/cli_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/cli_spec.rb
@@ -39,17 +39,17 @@ describe Hbc::CLI do
end
it "respects the env variable when choosing what appdir to create" do
- with_environment "HOMEBREW_CASK_OPTS" => "--appdir=/custom/appdir" do
- expect(Hbc).to receive(:appdir=).with(Pathname("/custom/appdir"))
- described_class.process("noop")
- end
+ allow(ENV).to receive(:[])
+ allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--appdir=/custom/appdir")
+ expect(Hbc).to receive(:appdir=).with(Pathname.new("/custom/appdir"))
+ described_class.process("noop")
end
it "respects the env variable when choosing a non-default Caskroom location" do
- with_environment "HOMEBREW_CASK_OPTS" => "--caskroom=/custom/caskdir" do
- expect(Hbc).to receive(:caskroom=).with(Pathname("/custom/caskdir"))
- described_class.process("noop")
- end
+ allow(ENV).to receive(:[])
+ allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--caskroom=/custom/caskdir")
+ expect(Hbc).to receive(:caskroom=).with(Pathname.new("/custom/caskdir"))
+ described_class.process("noop")
end
it "exits with a status of 1 when something goes wrong" do
diff --git a/Library/Homebrew/cask/spec/spec_helper.rb b/Library/Homebrew/cask/spec/spec_helper.rb
index 458fe00f4..162cb3b8f 100644
--- a/Library/Homebrew/cask/spec/spec_helper.rb
+++ b/Library/Homebrew/cask/spec/spec_helper.rb
@@ -15,7 +15,6 @@ require "global"
# add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
-require "test/support/helper/env"
require "test/support/helper/shutup"
Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "*.rb")).each(&method(:require))
@@ -38,6 +37,5 @@ end
RSpec.configure do |config|
config.order = :random
- config.include(Test::Helper::Env)
config.include(Test::Helper::Shutup)
end
diff --git a/Library/Homebrew/cask/test/cask/artifact/suite_test.rb b/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
index b2949950e..ed151e45c 100644
--- a/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
+++ b/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
@@ -13,6 +13,8 @@ describe Hbc::Artifact::Suite do
end
it "moves the suite to the proper directory" do
+ skip("flaky test")
+
shutup do
install_phase.call
end
diff --git a/Library/Homebrew/cask/test/cask/depends_on_test.rb b/Library/Homebrew/cask/test/cask/depends_on_test.rb
index ce2e54178..4516dad37 100644
--- a/Library/Homebrew/cask/test/cask/depends_on_test.rb
+++ b/Library/Homebrew/cask/test/cask/depends_on_test.rb
@@ -79,15 +79,6 @@ describe "Satisfy Dependencies and Requirements" do
Hbc::Installer.new(arch_cask).install
end
end
-
- it "raises an exception when depends_on arch is not satisfied" do
- arch_cask = Hbc.load("with-depends-on-arch-failure")
- lambda {
- shutup do
- Hbc::Installer.new(arch_cask).install
- end
- }.must_raise(Hbc::CaskError)
- end
end
describe "depends_on x11" do
diff --git a/Library/Homebrew/cask/test/cask/dsl_test.rb b/Library/Homebrew/cask/test/cask/dsl_test.rb
index 96d24a1a1..0ea928f40 100644
--- a/Library/Homebrew/cask/test/cask/dsl_test.rb
+++ b/Library/Homebrew/cask/test/cask/dsl_test.rb
@@ -69,7 +69,11 @@ describe Hbc::DSL do
end
it "may use deprecated DSL version hash syntax" do
- with_environment "HOMEBREW_DEVELOPER" => nil do
+ stub = proc do |arg|
+ arg == "HOMEBREW_DEVELOPER" ? nil : ENV[arg]
+ end
+
+ ENV.stub :[], stub do
shutup do
test_cask = Hbc.load("with-dsl-version")
test_cask.token.must_equal "with-dsl-version"
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb
deleted file mode 100644
index 14c916573..000000000
--- a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-test_cask 'with-depends-on-arch-failure' do
- version '1.2.3'
- sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
-
- url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
- homepage 'http://example.com/with-depends-on-arch-failure'
-
- # guarantee mismatched hardware
- depends_on arch: Hardware::CPU.intel? ? :ppc : :intel
-
- app 'Caffeine.app'
-end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb
index fe5e4ba03..e0c4e3fa7 100644
--- a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb
@@ -6,7 +6,7 @@ test_cask 'with-depends-on-arch' do
homepage 'http://example.com/with-depends-on-arch'
# covers all known hardware; always succeeds
- depends_on arch: [:ppc, :intel]
+ depends_on arch: :intel
app 'Caffeine.app'
end
diff --git a/Library/Homebrew/cask/test/test_helper.rb b/Library/Homebrew/cask/test/test_helper.rb
index 275ede304..7315839f5 100644
--- a/Library/Homebrew/cask/test/test_helper.rb
+++ b/Library/Homebrew/cask/test/test_helper.rb
@@ -13,9 +13,7 @@ require "global"
# add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
-require "test/support/helper/env"
require "test/support/helper/shutup"
-include Test::Helper::Env
include Test::Helper::Shutup
def sudo(*args)