brew/Library/Homebrew/cask/lib/hbc/qualified_token.rb
Josh Hagins 44f1354d63 hbc/qualified_token: simplify token parsing
- Stop supporting archaic "user-repo/token" syntax
- Move regex for parsing tapped Cask token to tap_constants
2016-10-23 21:48:11 -04:00

14 lines
445 B
Ruby

module Hbc
module QualifiedToken
def self.parse(arg)
return nil unless arg.is_a?(String)
return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX
# eg caskroom/cask/google-chrome
# per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
user, repo, token = arg.downcase.split("/")
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
[user, repo, token]
end
end
end