mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
rubocop: fix brew style warnings.
This commit is contained in:
parent
8cd0d85afb
commit
1f48e17f1b
@ -165,11 +165,11 @@ class FormulaCreator
|
|||||||
path.write ERB.new(template, nil, ">").result(binding)
|
path.write ERB.new(template, nil, ">").result(binding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def template; <<~EOS
|
def template
|
||||||
|
<<~EOS
|
||||||
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
||||||
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
||||||
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
||||||
|
|
||||||
class #{Formulary.class_s(name)} < Formula
|
class #{Formulary.class_s(name)} < Formula
|
||||||
desc "#{desc}"
|
desc "#{desc}"
|
||||||
homepage "#{homepage}"
|
homepage "#{homepage}"
|
||||||
@ -182,7 +182,6 @@ class FormulaCreator
|
|||||||
<% end %>
|
<% end %>
|
||||||
sha256 "#{sha256}"
|
sha256 "#{sha256}"
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if mode == :cmake %>
|
<% if mode == :cmake %>
|
||||||
depends_on "cmake" => :build
|
depends_on "cmake" => :build
|
||||||
<% elsif mode == :meson %>
|
<% elsif mode == :meson %>
|
||||||
@ -191,10 +190,8 @@ class FormulaCreator
|
|||||||
<% elsif mode.nil? %>
|
<% elsif mode.nil? %>
|
||||||
# depends_on "cmake" => :build
|
# depends_on "cmake" => :build
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
def install
|
def install
|
||||||
# ENV.deparallelize # if your formula fails when building in parallel
|
# ENV.deparallelize # if your formula fails when building in parallel
|
||||||
|
|
||||||
<% if mode == :cmake %>
|
<% if mode == :cmake %>
|
||||||
system "cmake", ".", *std_cmake_args
|
system "cmake", ".", *std_cmake_args
|
||||||
<% elsif mode == :autotools %>
|
<% elsif mode == :autotools %>
|
||||||
@ -222,7 +219,6 @@ class FormulaCreator
|
|||||||
system "make", "install" # if this fails, try separate make/make install steps
|
system "make", "install" # if this fails, try separate make/make install steps
|
||||||
<% end %>
|
<% end %>
|
||||||
end
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
# `test do` will create, run in and delete a temporary directory.
|
# `test do` will create, run in and delete a temporary directory.
|
||||||
#
|
#
|
||||||
|
@ -54,7 +54,8 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
class DirectoryNotWritableError < LinkError
|
class DirectoryNotWritableError < LinkError
|
||||||
def to_s; <<~EOS
|
def to_s
|
||||||
|
<<~EOS
|
||||||
Could not symlink #{src}
|
Could not symlink #{src}
|
||||||
#{dst.dirname} is not writable.
|
#{dst.dirname} is not writable.
|
||||||
EOS
|
EOS
|
||||||
|
@ -232,7 +232,8 @@ describe Hbc::DSL, :cask do
|
|||||||
expect(cask.caveats).to be_empty
|
expect(cask.caveats).to be_empty
|
||||||
|
|
||||||
cask = Hbc::Cask.new("cask-with-caveats") do
|
cask = Hbc::Cask.new("cask-with-caveats") do
|
||||||
def caveats; <<~EOS
|
def caveats
|
||||||
|
<<~EOS
|
||||||
When you install this Cask, you probably want to know this.
|
When you install this Cask, you probably want to know this.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@ module Test
|
|||||||
return super(block) unless @tty
|
return super(block) unless @tty
|
||||||
|
|
||||||
colored_tty_block = lambda do
|
colored_tty_block = lambda do
|
||||||
instance_eval("$#{@output}").extend(Module.new do
|
instance_eval("$#{@output}", __FILE__, __LINE__).extend(Module.new do
|
||||||
def tty?
|
def tty?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
@ -32,7 +32,7 @@ module Test
|
|||||||
return super(colored_tty_block) if @colors
|
return super(colored_tty_block) if @colors
|
||||||
|
|
||||||
uncolored_tty_block = lambda do
|
uncolored_tty_block = lambda do
|
||||||
instance_eval <<-EOS
|
instance_eval <<-EOS, __FILE__, __LINE__ + 1
|
||||||
begin
|
begin
|
||||||
captured_stream = StringIO.new
|
captured_stream = StringIO.new
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ module GitHub
|
|||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"]
|
return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"]
|
||||||
|
|
||||||
args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}]
|
args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}] # rubocop:disable Lint/NestedPercentLiteral
|
||||||
args += curl_args
|
args += curl_args
|
||||||
|
|
||||||
token, username = api_credentials
|
token, username = api_credentials
|
||||||
|
Loading…
x
Reference in New Issue
Block a user