Align end
with beginning of line where if/unless
is.
This commit is contained in:
parent
8e9eae695a
commit
ae7b944238
@ -61,10 +61,10 @@ module Hbc
|
|||||||
"#{printable_target} -> #{target.readlink} (#{target.readlink.abv})"
|
"#{printable_target} -> #{target.readlink} (#{target.readlink.abv})"
|
||||||
else
|
else
|
||||||
string = if self.class.islink?(target)
|
string = if self.class.islink?(target)
|
||||||
"#{printable_target} -> #{target.readlink}"
|
"#{printable_target} -> #{target.readlink}"
|
||||||
else
|
else
|
||||||
printable_target
|
printable_target
|
||||||
end
|
end
|
||||||
|
|
||||||
Formatter.error(string, label: "Broken Link")
|
Formatter.error(string, label: "Broken Link")
|
||||||
end
|
end
|
||||||
|
@ -38,12 +38,12 @@ module Hbc
|
|||||||
raise CaskError, "Cannot create metadata path when timestamp is :latest"
|
raise CaskError, "Cannot create metadata path when timestamp is :latest"
|
||||||
end
|
end
|
||||||
path = if timestamp == :latest
|
path = if timestamp == :latest
|
||||||
Pathname.glob(metadata_versioned_container_path.join("*")).sort.last
|
Pathname.glob(metadata_versioned_container_path.join("*")).sort.last
|
||||||
elsif timestamp == :now
|
elsif timestamp == :now
|
||||||
Utils.nowstamp_metadata_path(metadata_versioned_container_path)
|
Utils.nowstamp_metadata_path(metadata_versioned_container_path)
|
||||||
else
|
else
|
||||||
metadata_versioned_container_path.join(timestamp)
|
metadata_versioned_container_path.join(timestamp)
|
||||||
end
|
end
|
||||||
if create
|
if create
|
||||||
odebug "Creating metadata directory #{path}"
|
odebug "Creating metadata directory #{path}"
|
||||||
FileUtils.mkdir_p path
|
FileUtils.mkdir_p path
|
||||||
|
@ -72,14 +72,14 @@ module Hbc
|
|||||||
ohai message
|
ohai message
|
||||||
|
|
||||||
deletable_cache_files = if tokens.empty?
|
deletable_cache_files = if tokens.empty?
|
||||||
cache_files
|
cache_files
|
||||||
else
|
else
|
||||||
start_withs = tokens.map { |token| "#{token}--" }
|
start_withs = tokens.map { |token| "#{token}--" }
|
||||||
|
|
||||||
cache_files.select { |path|
|
cache_files.select { |path|
|
||||||
path.basename.to_s.start_with?(*start_withs)
|
path.basename.to_s.start_with?(*start_withs)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
delete_paths(deletable_cache_files)
|
delete_paths(deletable_cache_files)
|
||||||
end
|
end
|
||||||
|
@ -78,8 +78,8 @@ module Hbc
|
|||||||
|
|
||||||
def self.homebrew_taps
|
def self.homebrew_taps
|
||||||
@homebrew_taps ||= if homebrew_repository.respond_to?(:join)
|
@homebrew_taps ||= if homebrew_repository.respond_to?(:join)
|
||||||
homebrew_repository.join("Library", "Taps")
|
homebrew_repository.join("Library", "Taps")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.homebrew_constants(name)
|
def self.homebrew_constants(name)
|
||||||
|
@ -37,12 +37,12 @@ module Hbc
|
|||||||
|
|
||||||
def cask_paths
|
def cask_paths
|
||||||
@cask_paths ||= if cask_tokens.empty?
|
@cask_paths ||= if cask_tokens.empty?
|
||||||
Hbc.all_tapped_cask_dirs
|
Hbc.all_tapped_cask_dirs
|
||||||
elsif cask_tokens.any? { |file| File.exist?(file) }
|
elsif cask_tokens.any? { |file| File.exist?(file) }
|
||||||
cask_tokens
|
cask_tokens
|
||||||
else
|
else
|
||||||
cask_tokens.map { |token| Hbc.path(token) }
|
cask_tokens.map { |token| Hbc.path(token) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cask_tokens
|
def cask_tokens
|
||||||
|
@ -23,13 +23,13 @@ module Hbc
|
|||||||
|
|
||||||
def downloader
|
def downloader
|
||||||
@downloader ||= case cask.url.using
|
@downloader ||= case cask.url.using
|
||||||
when :svn
|
when :svn
|
||||||
SubversionDownloadStrategy.new(cask)
|
SubversionDownloadStrategy.new(cask)
|
||||||
when :post
|
when :post
|
||||||
CurlPostDownloadStrategy.new(cask)
|
CurlPostDownloadStrategy.new(cask)
|
||||||
else
|
else
|
||||||
CurlDownloadStrategy.new(cask)
|
CurlDownloadStrategy.new(cask)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_cache
|
def clear_cache
|
||||||
|
@ -87,16 +87,16 @@ module Hbc
|
|||||||
def macos=(*arg)
|
def macos=(*arg)
|
||||||
@macos ||= []
|
@macos ||= []
|
||||||
macos = if arg.count == 1 && arg.first =~ /^\s*(<|>|[=<>]=)\s*(\S+)\s*$/
|
macos = if arg.count == 1 && arg.first =~ /^\s*(<|>|[=<>]=)\s*(\S+)\s*$/
|
||||||
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
|
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
|
||||||
operator = Regexp.last_match[1].to_sym
|
operator = Regexp.last_match[1].to_sym
|
||||||
release = self.class.coerce_os_release(Regexp.last_match[2])
|
release = self.class.coerce_os_release(Regexp.last_match[2])
|
||||||
[[operator, release]]
|
[[operator, release]]
|
||||||
else
|
else
|
||||||
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
|
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
|
||||||
Array(*arg).map { |elt|
|
Array(*arg).map { |elt|
|
||||||
self.class.coerce_os_release(elt)
|
self.class.coerce_os_release(elt)
|
||||||
}.sort
|
}.sort
|
||||||
end
|
end
|
||||||
@macos.concat(macos)
|
@macos.concat(macos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -84,10 +84,10 @@ module Hbc
|
|||||||
|
|
||||||
def summary
|
def summary
|
||||||
s = if MacOS.version >= :lion && !ENV["HOMEBREW_NO_EMOJI"]
|
s = if MacOS.version >= :lion && !ENV["HOMEBREW_NO_EMOJI"]
|
||||||
(ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba") + " "
|
(ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba") + " "
|
||||||
else
|
else
|
||||||
Formatter.headline("Success! ", color: :blue)
|
Formatter.headline("Success! ", color: :blue)
|
||||||
end
|
end
|
||||||
s << "#{@cask} was successfully installed!"
|
s << "#{@cask} was successfully installed!"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,10 +113,10 @@ module Hbc
|
|||||||
odebug "Extracting primary container"
|
odebug "Extracting primary container"
|
||||||
FileUtils.mkdir_p @cask.staged_path
|
FileUtils.mkdir_p @cask.staged_path
|
||||||
container = if @cask.container && @cask.container.type
|
container = if @cask.container && @cask.container.type
|
||||||
Container.from_type(@cask.container.type)
|
Container.from_type(@cask.container.type)
|
||||||
else
|
else
|
||||||
Container.for_path(@downloaded_path, @command)
|
Container.for_path(@downloaded_path, @command)
|
||||||
end
|
end
|
||||||
unless container
|
unless container
|
||||||
raise CaskError, "Uh oh, could not figure out how to unpack '#{@downloaded_path}'"
|
raise CaskError, "Uh oh, could not figure out how to unpack '#{@downloaded_path}'"
|
||||||
end
|
end
|
||||||
|
@ -139,12 +139,12 @@ module Hbc
|
|||||||
query_without_extension = query.sub(/\.rb$/i, "")
|
query_without_extension = query.sub(/\.rb$/i, "")
|
||||||
|
|
||||||
token_with_tap = if query =~ %r{\A[^/]+/[^/]+/[^/]+\Z}
|
token_with_tap = if query =~ %r{\A[^/]+/[^/]+/[^/]+\Z}
|
||||||
query_without_extension
|
query_without_extension
|
||||||
else
|
else
|
||||||
all_tokens.detect { |tap_and_token|
|
all_tokens.detect { |tap_and_token|
|
||||||
tap_and_token.split("/")[2] == query_without_extension
|
tap_and_token.split("/")[2] == query_without_extension
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if token_with_tap
|
if token_with_tap
|
||||||
user, repo, token = token_with_tap.split("/")
|
user, repo, token = token_with_tap.split("/")
|
||||||
|
@ -40,10 +40,10 @@ module Hbc
|
|||||||
|
|
||||||
def import_key
|
def import_key
|
||||||
args = if cask.gpg.key_id
|
args = if cask.gpg.key_id
|
||||||
["--recv-keys", cask.gpg.key_id]
|
["--recv-keys", cask.gpg.key_id]
|
||||||
elsif cask.gpg.key_url
|
elsif cask.gpg.key_url
|
||||||
["--fetch-key", cask.gpg.key_url.to_s]
|
["--fetch-key", cask.gpg.key_url.to_s]
|
||||||
end
|
end
|
||||||
|
|
||||||
@command.run!("gpg", args: args)
|
@command.run!("gpg", args: args)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user