You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
672 B

module Cask::Scopes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def all
all_titles.map { |c| self.load c }
end
def all_titles
cask_titles = Dir[tapspath.join("*", "Casks", "*.rb")]
cask_titles.map { |c|
# => "/usr/local/Library/Taps/example-tap/Casks/example.rb"
c.sub! /\.rb$/, ''
# => ".../example"
c = c.split("/").last 3
# => ["example-tap", "Casks", "example"]
c.delete_at 1
# => ["example-tap", "example"]
c = c.join "/"
}
end
def installed
all_titles.select { |c| Cask.load(c).installed? }
end
end
end