Browse Source

add audits into the build process

this way travis will be able to cover incoming pull requests of new
casks by running the audit on them. cool!

also:

- add checksums to audit
- fix missing checksums
phinze 12 years ago
parent
commit
3b416ce7b5
  1. 1
      Casks/ireadfast.rb
  2. 1
      Casks/makemkv.rb
  3. 1
      Casks/mu-commander.rb
  4. 5
      Casks/scrup.rb
  5. 1
      Casks/zooom.rb
  6. 6
      lib/cask/audit.rb
  7. 14
      test/Casks/compliance_test.rb
  8. 2
      test/cask/dsl_test.rb
  9. 2
      test/support/Casks/bad-checksum.rb
  10. 2
      test/support/Casks/basic-cask.rb
  11. 2
      test/support/Casks/local-caffeine.rb
  12. 2
      test/support/Casks/local-transmission.rb
  13. 2
      test/support/Casks/missing-checksum.rb
  14. 2
      test/support/Casks/no-checksum.rb
  15. 5
      test/test_helper.rb

1
Casks/ireadfast.rb

@ -2,4 +2,5 @@ class Ireadfast < Cask
url 'http://s5.histats.com/stats/r.php?130163&100&1&urlr=&gengis.110mb.com/downloads/iReadFast%202.0.dmg'
homepage 'http://gengis.110mb.com/en/index.php'
version '2.0'
sha1 '57a5963ae3c6bd02aaf29b60987df2f1b76c956c'
end

1
Casks/makemkv.rb

@ -2,4 +2,5 @@ class Makemkv < Cask
url 'http://www.makemkv.com/download/makemkv_v1.7.8_osx.dmg'
homepage 'http://www.makemkv.com/'
version '1.7.8'
sha1 '33b486d4ae7a6e93dd75fa25411d365bb46b9387'
end

1
Casks/mu-commander.rb

@ -2,4 +2,5 @@ class MuCommander < Cask
url 'http://www.mucommander.com/download/mucommander-0_9_0.dmg'
version '0.9.0'
homepage 'http://www.mucommander.com/index.php'
sha1 'f733f5a4dc380836def21ca76656c2053153c960'
end

5
Casks/scrup.rb

@ -1,5 +1,6 @@
class Scrup < Cask
url 'http://hunch.se/scrup/dist/scrup-1.3.2.zip'
url 'http://data.hunch.se/scrup/Scrup-1.3.3-bd23160.zip'
homepage 'https://github.com/rsms/scrup'
version '1.3.2'
version '1.3.3'
sha1 '51ea66d5049fb231d28d285be8ccd5f75b467b97'
end

1
Casks/zooom.rb

@ -2,4 +2,5 @@ class Zooom < Cask
url 'http://software.coderage-software.com/zooom/Zooom_2.5.0.dmg'
homepage 'http://http://coderage-software.com/zooom'
version '2.5.0'
sha1 '1fa66ef73e7005b368bc4c21e37ae676ed7bc1f5'
end

6
lib/cask/audit.rb

@ -11,6 +11,7 @@ class Cask::Audit
def run!
_check_required_fields
_check_checksums
return if errors?
end
@ -23,4 +24,9 @@ class Cask::Audit
add_error "version is required" unless cask.version
add_error "homepage is required" unless cask.homepage
end
def _check_checksums
return if cask.sums == 0
add_error "could not find checksum or no_checksum" unless cask.sums.is_a?(Array) && cask.sums.length > 0
end
end

14
test/Casks/compliance_test.rb

@ -0,0 +1,14 @@
require 'test_helper'
describe "Casks" do
Cask.all.reject {|c| c.is_a?(TestCask) }.each do |cask|
describe "#{cask}" do
it "passes audit" do
audit = Cask::Audit.new(cask)
audit.run!
audit.errors.must_equal [], "[#{cask}] Cask audit must be error free"
audit.warnings.must_equal [], "[#{cask}] Cask audit must be warning free"
end
end
end
end

2
test/cask/dsl_test.rb

@ -2,7 +2,7 @@ require 'test_helper'
describe Cask::DSL do
it "lets you set url, homepage, and version" do
test_cask = Cask.load('test-cask')
test_cask = Cask.load('basic-cask')
test_cask.url.must_equal URI('http://example.com/TestCask.dmg')
test_cask.homepage.must_equal 'http://example.com/'
test_cask.version.must_equal '1.2.3'

2
test/support/Casks/bad-checksum.rb

@ -1,4 +1,4 @@
class BadChecksum < Cask
class BadChecksum < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/local-caffeine'
version '1.2.3'

2
test/support/Casks/test-cask.rb → test/support/Casks/basic-cask.rb

@ -1,4 +1,4 @@
class TestCask < Cask
class BasicCask < TestCask
url 'http://example.com/TestCask.dmg'
homepage 'http://example.com/'
version '1.2.3'

2
test/support/Casks/local-caffeine.rb

@ -1,4 +1,4 @@
class LocalCaffeine < Cask
class LocalCaffeine < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/local-caffeine'
version '1.2.3'

2
test/support/Casks/local-transmission.rb

@ -1,4 +1,4 @@
class LocalTransmission < Cask
class LocalTransmission < TestCask
url TestHelper.local_binary('transmission-2.61.dmg')
homepage 'http://example.com/local-transmission'
version '2.61'

2
test/support/Casks/missing-checksum.rb

@ -1,4 +1,4 @@
class MissingChecksum < Cask
class MissingChecksum < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/local-caffeine'
version '1.2.3'

2
test/support/Casks/no-checksum.rb

@ -1,4 +1,4 @@
class NoChecksum < Cask
class NoChecksum < TestCask
url TestHelper.local_binary('caffeine.zip')
homepage 'http://example.com/local-caffeine'
version '1.2.3'

5
test/test_helper.rb

@ -36,7 +36,7 @@ class TestHelper
end
def self.test_cask
Cask.load('test-cask')
Cask.load('basic-cask')
end
def self.fake_fetcher
@ -67,5 +67,8 @@ taps_dest.mkdir
FileUtils.ln_s project_root, taps_dest/"phinze-cask"
# Common superclass for tests casks for when we need to filter them out
class TestCask < Cask; end
# also jack in some test casks
FileUtils.ln_s project_root/'test'/'support', taps_dest/"phinze-testcasks"

Loading…
Cancel
Save