Support both Homebrew and caskroom for now.
This commit is contained in:
parent
c4c00e4ede
commit
b4de801a01
@ -59,7 +59,8 @@ module Hbc
|
|||||||
return if @cask.sourcefile_path.nil?
|
return if @cask.sourcefile_path.nil?
|
||||||
|
|
||||||
tap = @cask.tap
|
tap = @cask.tap
|
||||||
return if tap.nil? || tap.user != "caskroom"
|
return if tap.nil?
|
||||||
|
return unless ["Homebrew", "caskroom"].include?(tap.user)
|
||||||
|
|
||||||
return unless cask.artifacts.any? { |k| k.is_a?(Hbc::Artifact::Pkg) && k.stanza_options.key?(:allow_untrusted) }
|
return unless cask.artifacts.any? { |k| k.is_a?(Hbc::Artifact::Pkg) && k.stanza_options.key?(:allow_untrusted) }
|
||||||
add_warning "allow_untrusted is not permitted in official Homebrew-Cask taps"
|
add_warning "allow_untrusted is not permitted in official Homebrew-Cask taps"
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Hbc
|
|||||||
def self.search_remote(query)
|
def self.search_remote(query)
|
||||||
matches = begin
|
matches = begin
|
||||||
GitHub.search_code(
|
GitHub.search_code(
|
||||||
user: "caskroom",
|
user: ["Homebrew", "caskroom"],
|
||||||
path: "Casks",
|
path: "Casks",
|
||||||
filename: query,
|
filename: query,
|
||||||
extension: "rb",
|
extension: "rb",
|
||||||
|
|||||||
@ -3,7 +3,7 @@ module Hbc
|
|||||||
@full_version ||= begin
|
@full_version ||= begin
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Homebrew-Cask #{HOMEBREW_VERSION}
|
Homebrew-Cask #{HOMEBREW_VERSION}
|
||||||
caskroom/homebrew-cask #{Hbc.default_tap.version_string}
|
#{Hbc.default_tap.full_name} #{Hbc.default_tap.version_string}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -470,7 +470,7 @@ class Reporter
|
|||||||
next unless tabs.first.tap == tap # skip if installed formula is not from this tap.
|
next unless tabs.first.tap == tap # skip if installed formula is not from this tap.
|
||||||
new_tap = Tap.fetch(new_tap_name)
|
new_tap = Tap.fetch(new_tap_name)
|
||||||
# For formulae migrated to cask: Auto-install cask or provide install instructions.
|
# For formulae migrated to cask: Auto-install cask or provide install instructions.
|
||||||
if new_tap_name == "caskroom/cask"
|
if ["homebrew/cask", "caskroom/cask"].include?(new_tap_name)
|
||||||
if new_tap.installed? && (HOMEBREW_PREFIX/"Caskroom").directory?
|
if new_tap.installed? && (HOMEBREW_PREFIX/"Caskroom").directory?
|
||||||
ohai "#{name} has been moved to Homebrew-Cask."
|
ohai "#{name} has been moved to Homebrew-Cask."
|
||||||
ohai "brew unlink #{name}"
|
ohai "brew unlink #{name}"
|
||||||
|
|||||||
@ -101,7 +101,7 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
break if new_tap_name == CoreTap.instance.name
|
break if new_tap_name == CoreTap.instance.name
|
||||||
|
|
||||||
install_cmd = if new_tap_user == "caskroom"
|
install_cmd = if new_tap_user == "caskroom" || (new_tap_user == "homebrew" && new_tap_repo.start_with?("cask"))
|
||||||
"cask install"
|
"cask install"
|
||||||
else
|
else
|
||||||
"install"
|
"install"
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
local-caffeine: 1.2.3
|
local-caffeine: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-caffeine.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/local-caffeine.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
@ -26,7 +26,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
local-caffeine: 1.2.3
|
local-caffeine: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-caffeine.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/local-caffeine.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
@ -34,7 +34,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
local-transmission: 2.61
|
local-transmission: 2.61
|
||||||
http://example.com/local-transmission
|
http://example.com/local-transmission
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-transmission.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/local-transmission.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
@ -56,7 +56,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
with-caveats: 1.2.3
|
with-caveats: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-caveats.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/with-caveats.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
@ -82,7 +82,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
with-conditional-caveats: 1.2.3
|
with-conditional-caveats: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-conditional-caveats.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/with-conditional-caveats.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
@ -97,7 +97,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
with-languages: 1.2.3
|
with-languages: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-languages.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/with-languages.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Languages
|
==> Languages
|
||||||
@ -114,7 +114,7 @@ describe Hbc::CLI::Info, :cask do
|
|||||||
without-languages: 1.2.3
|
without-languages: 1.2.3
|
||||||
http://example.com/local-caffeine
|
http://example.com/local-caffeine
|
||||||
Not installed
|
Not installed
|
||||||
From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/without-languages.rb
|
From: https://github.com/Homebrew/homebrew-cask-spec/blob/master/Casks/without-languages.rb
|
||||||
==> Name
|
==> Name
|
||||||
None
|
None
|
||||||
==> Artifacts
|
==> Artifacts
|
||||||
|
|||||||
@ -89,7 +89,7 @@ describe Hbc::CLI::Style, :cask do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_exactly(a_path_ending_with("/caskroom/homebrew-spec/Casks"), a_path_ending_with("/third-party/homebrew-tap/Casks")) }
|
it { is_expected.to contain_exactly(a_path_ending_with("/homebrew/homebrew-cask-spec/Casks"), a_path_ending_with("/third-party/homebrew-tap/Casks")) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when at least one cask token is a path that exists" do
|
context "when at least one cask token is a path that exists" do
|
||||||
|
|||||||
@ -27,7 +27,7 @@ RSpec.shared_context "Homebrew-Cask" do
|
|||||||
|
|
||||||
[Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache].each(&:mkpath)
|
[Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache].each(&:mkpath)
|
||||||
|
|
||||||
Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap|
|
Hbc.default_tap = Tap.fetch("Homebrew", "cask-spec").tap do |tap|
|
||||||
FileUtils.mkdir_p tap.path.dirname
|
FileUtils.mkdir_p tap.path.dirname
|
||||||
FileUtils.ln_sf TEST_FIXTURE_DIR.join("cask"), tap.path
|
FileUtils.ln_sf TEST_FIXTURE_DIR.join("cask"), tap.path
|
||||||
end
|
end
|
||||||
@ -42,7 +42,6 @@ RSpec.shared_context "Homebrew-Cask" do
|
|||||||
FileUtils.rm_rf HOMEBREW_CASK_DIRS.values
|
FileUtils.rm_rf HOMEBREW_CASK_DIRS.values
|
||||||
FileUtils.rm_rf [Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache]
|
FileUtils.rm_rf [Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache]
|
||||||
Hbc.default_tap.path.unlink
|
Hbc.default_tap.path.unlink
|
||||||
FileUtils.rm_rf Hbc.default_tap.path.parent
|
|
||||||
third_party_tap.path.unlink
|
third_party_tap.path.unlink
|
||||||
FileUtils.rm_rf third_party_tap.path.parent
|
FileUtils.rm_rf third_party_tap.path.parent
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user