Align end with beginning of line where if/unless is.

This commit is contained in:
Markus Reiter 2016-10-14 20:11:33 +02:00
parent 8e9eae695a
commit ae7b944238
10 changed files with 60 additions and 60 deletions

View File

@ -61,10 +61,10 @@ module Hbc
"#{printable_target} -> #{target.readlink} (#{target.readlink.abv})"
else
string = if self.class.islink?(target)
"#{printable_target} -> #{target.readlink}"
else
printable_target
end
"#{printable_target} -> #{target.readlink}"
else
printable_target
end
Formatter.error(string, label: "Broken Link")
end

View File

@ -38,12 +38,12 @@ module Hbc
raise CaskError, "Cannot create metadata path when timestamp is :latest"
end
path = if timestamp == :latest
Pathname.glob(metadata_versioned_container_path.join("*")).sort.last
elsif timestamp == :now
Utils.nowstamp_metadata_path(metadata_versioned_container_path)
else
metadata_versioned_container_path.join(timestamp)
end
Pathname.glob(metadata_versioned_container_path.join("*")).sort.last
elsif timestamp == :now
Utils.nowstamp_metadata_path(metadata_versioned_container_path)
else
metadata_versioned_container_path.join(timestamp)
end
if create
odebug "Creating metadata directory #{path}"
FileUtils.mkdir_p path

View File

@ -72,14 +72,14 @@ module Hbc
ohai message
deletable_cache_files = if tokens.empty?
cache_files
else
start_withs = tokens.map { |token| "#{token}--" }
cache_files
else
start_withs = tokens.map { |token| "#{token}--" }
cache_files.select { |path|
path.basename.to_s.start_with?(*start_withs)
}
end
cache_files.select { |path|
path.basename.to_s.start_with?(*start_withs)
}
end
delete_paths(deletable_cache_files)
end

View File

@ -78,8 +78,8 @@ module Hbc
def self.homebrew_taps
@homebrew_taps ||= if homebrew_repository.respond_to?(:join)
homebrew_repository.join("Library", "Taps")
end
homebrew_repository.join("Library", "Taps")
end
end
def self.homebrew_constants(name)

View File

@ -37,12 +37,12 @@ module Hbc
def cask_paths
@cask_paths ||= if cask_tokens.empty?
Hbc.all_tapped_cask_dirs
elsif cask_tokens.any? { |file| File.exist?(file) }
cask_tokens
else
cask_tokens.map { |token| Hbc.path(token) }
end
Hbc.all_tapped_cask_dirs
elsif cask_tokens.any? { |file| File.exist?(file) }
cask_tokens
else
cask_tokens.map { |token| Hbc.path(token) }
end
end
def cask_tokens

View File

@ -23,13 +23,13 @@ module Hbc
def downloader
@downloader ||= case cask.url.using
when :svn
SubversionDownloadStrategy.new(cask)
when :post
CurlPostDownloadStrategy.new(cask)
else
CurlDownloadStrategy.new(cask)
end
when :svn
SubversionDownloadStrategy.new(cask)
when :post
CurlPostDownloadStrategy.new(cask)
else
CurlDownloadStrategy.new(cask)
end
end
def clear_cache

View File

@ -87,16 +87,16 @@ module Hbc
def macos=(*arg)
@macos ||= []
macos = if arg.count == 1 && arg.first =~ /^\s*(<|>|[=<>]=)\s*(\S+)\s*$/
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
operator = Regexp.last_match[1].to_sym
release = self.class.coerce_os_release(Regexp.last_match[2])
[[operator, release]]
else
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
Array(*arg).map { |elt|
self.class.coerce_os_release(elt)
}.sort
end
raise "'depends_on macos' comparison expressions cannot be combined" unless @macos.empty?
operator = Regexp.last_match[1].to_sym
release = self.class.coerce_os_release(Regexp.last_match[2])
[[operator, release]]
else
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
Array(*arg).map { |elt|
self.class.coerce_os_release(elt)
}.sort
end
@macos.concat(macos)
end

View File

@ -84,10 +84,10 @@ module Hbc
def summary
s = if MacOS.version >= :lion && !ENV["HOMEBREW_NO_EMOJI"]
(ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba") + " "
else
Formatter.headline("Success! ", color: :blue)
end
(ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba") + " "
else
Formatter.headline("Success! ", color: :blue)
end
s << "#{@cask} was successfully installed!"
end
@ -113,10 +113,10 @@ module Hbc
odebug "Extracting primary container"
FileUtils.mkdir_p @cask.staged_path
container = if @cask.container && @cask.container.type
Container.from_type(@cask.container.type)
else
Container.for_path(@downloaded_path, @command)
end
Container.from_type(@cask.container.type)
else
Container.for_path(@downloaded_path, @command)
end
unless container
raise CaskError, "Uh oh, could not figure out how to unpack '#{@downloaded_path}'"
end

View File

@ -139,12 +139,12 @@ module Hbc
query_without_extension = query.sub(/\.rb$/i, "")
token_with_tap = if query =~ %r{\A[^/]+/[^/]+/[^/]+\Z}
query_without_extension
else
all_tokens.detect { |tap_and_token|
tap_and_token.split("/")[2] == query_without_extension
}
end
query_without_extension
else
all_tokens.detect { |tap_and_token|
tap_and_token.split("/")[2] == query_without_extension
}
end
if token_with_tap
user, repo, token = token_with_tap.split("/")

View File

@ -40,10 +40,10 @@ module Hbc
def import_key
args = if cask.gpg.key_id
["--recv-keys", cask.gpg.key_id]
elsif cask.gpg.key_url
["--fetch-key", cask.gpg.key_url.to_s]
end
["--recv-keys", cask.gpg.key_id]
elsif cask.gpg.key_url
["--fetch-key", cask.gpg.key_url.to_s]
end
@command.run!("gpg", args: args)
end