mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cask audit: check for devmate and hockeyapp appcasts
This commit is contained in:
parent
0d33aba0b7
commit
b12498159b
@ -201,21 +201,20 @@ module Hbc
|
||||
|
||||
def check_hosting_with_appcast
|
||||
return if cask.appcast
|
||||
check_github_releases_appcast
|
||||
check_sourceforge_appcast
|
||||
end
|
||||
|
||||
def check_github_releases_appcast
|
||||
return unless cask.url.to_s =~ %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)}
|
||||
add_appcast = "please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md"
|
||||
|
||||
add_warning "Download uses GitHub releases, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md"
|
||||
end
|
||||
|
||||
def check_sourceforge_appcast
|
||||
return if cask.version.latest?
|
||||
return unless cask.url.to_s =~ %r{sourceforge.net/(\S+)}
|
||||
|
||||
add_warning "Download is hosted on SourceForge, please add an appcast. See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/appcast.md"
|
||||
case cask.url.to_s
|
||||
when %r{github.com/([^/]+)/([^/]+)/releases/download/(\S+)}
|
||||
add_warning "Download uses GitHub releases, #{add_appcast}"
|
||||
when %r{sourceforge.net/(\S+)}
|
||||
return if cask.version.latest?
|
||||
add_warning "Download is hosted on SourceForge, #{add_appcast}"
|
||||
when %r{dl.devmate.com/(\S+)}
|
||||
add_warning "Download is hosted on DevMate, #{add_appcast}"
|
||||
when %r{rink.hockeyapp.net/(\S+)}
|
||||
add_warning "Download is hosted on HockeyApp, #{add_appcast}"
|
||||
end
|
||||
end
|
||||
|
||||
def check_url
|
||||
|
@ -333,10 +333,10 @@ describe Hbc::Audit, :cask do
|
||||
end
|
||||
end
|
||||
|
||||
describe "GitHub releases appcast check" do
|
||||
let(:appcast_warning) { /Download uses GitHub releases/ }
|
||||
describe "hosting with appcast checks" do
|
||||
let(:appcast_warning) { /please add an appcast/ }
|
||||
|
||||
context "when the download does not use GitHub releases" do
|
||||
context "when the download does not use hosting with an appcast" do
|
||||
let(:cask_token) { "basic-cask" }
|
||||
|
||||
it { is_expected.not_to warn_with(appcast_warning) }
|
||||
@ -353,16 +353,6 @@ describe Hbc::Audit, :cask do
|
||||
|
||||
it { is_expected.to warn_with(appcast_warning) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "SourceForge appcast check" do
|
||||
let(:appcast_warning) { /Download is hosted on SourceForge/ }
|
||||
|
||||
context "when the download is not hosted on SourceForge" do
|
||||
let(:cask_token) { "basic-cask" }
|
||||
|
||||
it { is_expected.not_to warn_with(appcast_warning) }
|
||||
end
|
||||
|
||||
context "when the download is hosted on SourceForge and has an appcast" do
|
||||
let(:cask_token) { "sourceforge-with-appcast" }
|
||||
@ -375,6 +365,30 @@ describe Hbc::Audit, :cask do
|
||||
|
||||
it { is_expected.to warn_with(appcast_warning) }
|
||||
end
|
||||
|
||||
context "when the download is hosted on DevMate and has an appcast" do
|
||||
let(:cask_token) { "devmate-with-appcast" }
|
||||
|
||||
it { is_expected.not_to warn_with(appcast_warning) }
|
||||
end
|
||||
|
||||
context "when the download is hosted on DevMate and does not have an appcast" do
|
||||
let(:cask_token) { "devmate-without-appcast" }
|
||||
|
||||
it { is_expected.to warn_with(appcast_warning) }
|
||||
end
|
||||
|
||||
context "when the download is hosted on HockeyApp and has an appcast" do
|
||||
let(:cask_token) { "hockeyapp-with-appcast" }
|
||||
|
||||
it { is_expected.not_to warn_with(appcast_warning) }
|
||||
end
|
||||
|
||||
context "when the download is hosted on HockeyApp and does not have an appcast" do
|
||||
let(:cask_token) { "hockeyapp-without-appcast" }
|
||||
|
||||
it { is_expected.to warn_with(appcast_warning) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "latest with appcast checks" do
|
||||
|
@ -0,0 +1,12 @@
|
||||
cask 'devmate-with-appcast' do
|
||||
version '1.0'
|
||||
sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9'
|
||||
|
||||
# dl.devmate.com/com.my.fancyapp was verified as official when first introduced to the cask
|
||||
url "https://dl.devmate.com/com.my.fancyapp/app_#{version}.zip"
|
||||
appcast 'https://updates.devmate.com/com.my.fancyapp.app.xml'
|
||||
name 'DevMate'
|
||||
homepage 'http://www.example.com/'
|
||||
|
||||
app 'DevMate.app'
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
cask 'devmate-without-appcast' do
|
||||
version '1.0'
|
||||
sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9'
|
||||
|
||||
# dl.devmate.com/com.my.fancyapp was verified as official when first introduced to the cask
|
||||
url "https://dl.devmate.com/com.my.fancyapp/app_#{version}.zip"
|
||||
name 'DevMate'
|
||||
homepage 'http://www.example.com/'
|
||||
|
||||
app 'DevMate.app'
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
cask 'hockeyapp-with-appcast' do
|
||||
version '1.0,123'
|
||||
sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9'
|
||||
|
||||
# rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1 was verified as official when first introduced to the cask
|
||||
url "https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1/app_versions/#{version.after_comma}?format=zip"
|
||||
appcast 'https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1'
|
||||
name 'HockeyApp'
|
||||
homepage 'http://www.example.com/'
|
||||
|
||||
app 'HockeyApp.app'
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
cask 'hockeyapp-without-appcast' do
|
||||
version '1.0,123'
|
||||
sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9'
|
||||
|
||||
# rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1 was verified as official when first introduced to the cask
|
||||
url "https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1/app_versions/#{version.after_comma}?format=zip"
|
||||
name 'HockeyApp'
|
||||
homepage 'http://www.example.com/'
|
||||
|
||||
app 'HockeyApp.app'
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user