diff options
| author | Markus Reiter | 2017-03-12 19:18:41 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-16 12:10:19 +0100 |
| commit | d1995dad4bf76b447d9c97f1c2db99c6b3854b51 (patch) | |
| tree | 8cecf7abf6193d6429a43c8daeb6d71f009119b9 /Library/Homebrew/cask/lib/hbc/source | |
| parent | c4d8b1696c90fa54f0e2f4bce3c734f7a657662b (diff) | |
| download | brew-d1995dad4bf76b447d9c97f1c2db99c6b3854b51.tar.bz2 | |
Use a `Formulary`-like approach to load Casks.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/source')
8 files changed, 0 insertions, 167 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/source/gone.rb b/Library/Homebrew/cask/lib/hbc/source/gone.rb deleted file mode 100644 index 1c744d0db..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/gone.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Hbc - module Source - class Gone - def self.me?(query) - WithoutSource.new(query).installed? - end - - attr_reader :query - - def initialize(query) - @query = query - end - - def load - WithoutSource.new(query) - end - - def to_s - "" - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/path_base.rb b/Library/Homebrew/cask/lib/hbc/source/path_base.rb deleted file mode 100644 index 4e4bdcf15..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/path_base.rb +++ /dev/null @@ -1,29 +0,0 @@ -require "rubygems" -require "hbc/cask_loader" - -module Hbc - module Source - class PathBase - # derived classes must define method self.me? - - def self.path_for_query(query) - Pathname.new(query).sub(/(\.rb)?$/, ".rb") - end - - attr_reader :path - - def initialize(path) - @path = Pathname.new(path).expand_path - end - - def load - CaskLoader.load_from_file(@path) - end - - def to_s - # stringify to fully-resolved location - @path.to_s - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/path_slash_optional.rb b/Library/Homebrew/cask/lib/hbc/source/path_slash_optional.rb deleted file mode 100644 index d96a41130..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/path_slash_optional.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "hbc/source/path_base" - -module Hbc - module Source - class PathSlashOptional < PathBase - def self.me?(query) - path = path_for_query(query) - path.exist? - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/path_slash_required.rb b/Library/Homebrew/cask/lib/hbc/source/path_slash_required.rb deleted file mode 100644 index 2753b1710..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/path_slash_required.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "hbc/source/path_base" - -module Hbc - module Source - class PathSlashRequired < PathBase - def self.me?(query) - path = path_for_query(query) - path.to_s.include?("/") && path.exist? - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/tapped.rb b/Library/Homebrew/cask/lib/hbc/source/tapped.rb deleted file mode 100644 index c1f5f95bc..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/tapped.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Hbc - module Source - class Tapped - def self.me?(query) - Hbc.path(query).exist? - end - - attr_reader :token - - def initialize(token) - @token = token - end - - def load - PathSlashOptional.new(Hbc.path(token)).load - end - - def to_s - # stringify to fully-resolved location - Hbc.path(token).expand_path.to_s - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb b/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb deleted file mode 100644 index 2db6ddbca..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "hbc/source/tapped" - -module Hbc - module Source - class TappedQualified < Tapped - def self.me?(query) - return if (tap = tap_for_query(query)).nil? - - tap.installed? && Hbc.path(query).exist? - end - - def self.tap_for_query(query) - qualified_token = QualifiedToken.parse(query) - return if qualified_token.nil? - - user, repo = qualified_token[0..1] - Tap.fetch(user, repo) - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb b/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb deleted file mode 100644 index 698cc46ce..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/untapped_qualified.rb +++ /dev/null @@ -1,14 +0,0 @@ -require "hbc/source/tapped_qualified" - -module Hbc - module Source - class UntappedQualified < TappedQualified - def self.me?(query) - return if (tap = tap_for_query(query)).nil? - - tap.install - tap.installed? && Hbc.path(query).exist? - end - end - end -end diff --git a/Library/Homebrew/cask/lib/hbc/source/uri.rb b/Library/Homebrew/cask/lib/hbc/source/uri.rb deleted file mode 100644 index 09fab4bd0..000000000 --- a/Library/Homebrew/cask/lib/hbc/source/uri.rb +++ /dev/null @@ -1,32 +0,0 @@ -module Hbc - module Source - class URI - def self.me?(query) - !(query.to_s =~ ::URI.regexp).nil? - end - - attr_reader :uri - - def initialize(uri) - @uri = uri - end - - def load - Hbc.cache.mkpath - path = Hbc.cache.join(File.basename(uri)) - ohai "Downloading #{uri}" - odebug "Download target -> #{path}" - begin - curl(uri, "-o", path.to_s) - rescue ErrorDuringExecution - raise CaskUnavailableError, uri - end - PathSlashOptional.new(path).load - end - - def to_s - uri.to_s - end - end - end -end |
