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,77 +165,73 @@ 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
|
||||||
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
<<~EOS
|
||||||
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
# Documentation: https://docs.brew.sh/Formula-Cookbook.html
|
||||||
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
|
||||||
|
# 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}"
|
||||||
<% if head? %>
|
<% if head? %>
|
||||||
head "#{url}"
|
head "#{url}"
|
||||||
<% else %>
|
<% else %>
|
||||||
url "#{url}"
|
url "#{url}"
|
||||||
<% unless version.nil? or version.detected_from_url? %>
|
<% unless version.nil? or version.detected_from_url? %>
|
||||||
version "#{version}"
|
version "#{version}"
|
||||||
<% 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 %>
|
depends_on "meson" => :build
|
||||||
depends_on "meson" => :build
|
depends_on "ninja" => :build
|
||||||
depends_on "ninja" => :build
|
<% elsif mode.nil? %>
|
||||||
<% elsif mode.nil? %>
|
# depends_on "cmake" => :build
|
||||||
# depends_on "cmake" => :build
|
<% end %>
|
||||||
<% end %>
|
def install
|
||||||
|
# ENV.deparallelize # if your formula fails when building in parallel
|
||||||
def install
|
<% if mode == :cmake %>
|
||||||
# ENV.deparallelize # if your formula fails when building in parallel
|
system "cmake", ".", *std_cmake_args
|
||||||
|
<% elsif mode == :autotools %>
|
||||||
<% if mode == :cmake %>
|
# Remove unrecognized options if warned by configure
|
||||||
system "cmake", ".", *std_cmake_args
|
system "./configure", "--disable-debug",
|
||||||
<% elsif mode == :autotools %>
|
"--disable-dependency-tracking",
|
||||||
# Remove unrecognized options if warned by configure
|
"--disable-silent-rules",
|
||||||
system "./configure", "--disable-debug",
|
"--prefix=\#{prefix}"
|
||||||
"--disable-dependency-tracking",
|
<% elsif mode == :meson %>
|
||||||
"--disable-silent-rules",
|
mkdir "build" do
|
||||||
"--prefix=\#{prefix}"
|
system "meson", "--prefix=\#{prefix}", ".."
|
||||||
<% elsif mode == :meson %>
|
system "ninja"
|
||||||
mkdir "build" do
|
system "ninja", "test"
|
||||||
system "meson", "--prefix=\#{prefix}", ".."
|
system "ninja", "install"
|
||||||
system "ninja"
|
end
|
||||||
system "ninja", "test"
|
<% else %>
|
||||||
system "ninja", "install"
|
# Remove unrecognized options if warned by configure
|
||||||
|
system "./configure", "--disable-debug",
|
||||||
|
"--disable-dependency-tracking",
|
||||||
|
"--disable-silent-rules",
|
||||||
|
"--prefix=\#{prefix}"
|
||||||
|
# system "cmake", ".", *std_cmake_args
|
||||||
|
<% end %>
|
||||||
|
<% if mode != :meson %>
|
||||||
|
system "make", "install" # if this fails, try separate make/make install steps
|
||||||
|
<% end %>
|
||||||
|
end
|
||||||
|
test do
|
||||||
|
# `test do` will create, run in and delete a temporary directory.
|
||||||
|
#
|
||||||
|
# This test will fail and we won't accept that! For Homebrew/homebrew-core
|
||||||
|
# this will need to be a test that verifies the functionality of the
|
||||||
|
# software. Run the test with `brew test #{name}`. Options passed
|
||||||
|
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
|
||||||
|
#
|
||||||
|
# The installed folder is not in the path, so use the entire path to any
|
||||||
|
# executables being tested: `system "\#{bin}/program", "do", "something"`.
|
||||||
|
system "false"
|
||||||
end
|
end
|
||||||
<% else %>
|
|
||||||
# Remove unrecognized options if warned by configure
|
|
||||||
system "./configure", "--disable-debug",
|
|
||||||
"--disable-dependency-tracking",
|
|
||||||
"--disable-silent-rules",
|
|
||||||
"--prefix=\#{prefix}"
|
|
||||||
# system "cmake", ".", *std_cmake_args
|
|
||||||
<% end %>
|
|
||||||
<% if mode != :meson %>
|
|
||||||
system "make", "install" # if this fails, try separate make/make install steps
|
|
||||||
<% end %>
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test do
|
|
||||||
# `test do` will create, run in and delete a temporary directory.
|
|
||||||
#
|
|
||||||
# This test will fail and we won't accept that! For Homebrew/homebrew-core
|
|
||||||
# this will need to be a test that verifies the functionality of the
|
|
||||||
# software. Run the test with `brew test #{name}`. Options passed
|
|
||||||
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
|
|
||||||
#
|
|
||||||
# The installed folder is not in the path, so use the entire path to any
|
|
||||||
# executables being tested: `system "\#{bin}/program", "do", "something"`.
|
|
||||||
system "false"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -54,9 +54,10 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
class DirectoryNotWritableError < LinkError
|
class DirectoryNotWritableError < LinkError
|
||||||
def to_s; <<~EOS
|
def to_s
|
||||||
Could not symlink #{src}
|
<<~EOS
|
||||||
#{dst.dirname} is not writable.
|
Could not symlink #{src}
|
||||||
|
#{dst.dirname} is not writable.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -232,8 +232,9 @@ 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
|
||||||
When you install this Cask, you probably want to know this.
|
<<~EOS
|
||||||
|
When you install this Cask, you probably want to know this.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
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