aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2018-01-17 10:42:43 +0000
committerMike McQuaid2018-01-17 10:42:43 +0000
commit1f48e17f1b2f681ea56b72b8d2c1eebdb77f2181 (patch)
treed6441603e1e8fb405b91ab1bb0e869c5a4af6a69
parent8cd0d85afba1bd07a6af24ffca54518ec8ff0d1c (diff)
downloadbrew-1f48e17f1b2f681ea56b72b8d2c1eebdb77f2181.tar.bz2
rubocop: fix brew style warnings.
-rw-r--r--Library/Homebrew/dev-cmd/create.rb134
-rw-r--r--Library/Homebrew/keg.rb7
-rw-r--r--Library/Homebrew/test/cask/dsl_spec.rb5
-rw-r--r--Library/Homebrew/test/support/helper/output_as_tty.rb4
-rw-r--r--Library/Homebrew/utils/github.rb2
5 files changed, 75 insertions, 77 deletions
diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb
index e5481b532..122be2593 100644
--- a/Library/Homebrew/dev-cmd/create.rb
+++ b/Library/Homebrew/dev-cmd/create.rb
@@ -165,77 +165,73 @@ class FormulaCreator
path.write ERB.new(template, nil, ">").result(binding)
end
- def template; <<~EOS
- # Documentation: https://docs.brew.sh/Formula-Cookbook.html
- # 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
- desc "#{desc}"
- homepage "#{homepage}"
- <% if head? %>
- head "#{url}"
- <% else %>
- url "#{url}"
- <% unless version.nil? or version.detected_from_url? %>
- version "#{version}"
- <% end %>
- sha256 "#{sha256}"
- <% end %>
-
- <% if mode == :cmake %>
- depends_on "cmake" => :build
- <% elsif mode == :meson %>
- depends_on "meson" => :build
- depends_on "ninja" => :build
- <% elsif mode.nil? %>
- # depends_on "cmake" => :build
- <% end %>
-
- def install
- # ENV.deparallelize # if your formula fails when building in parallel
-
- <% if mode == :cmake %>
- system "cmake", ".", *std_cmake_args
- <% elsif mode == :autotools %>
- # Remove unrecognized options if warned by configure
- system "./configure", "--disable-debug",
- "--disable-dependency-tracking",
- "--disable-silent-rules",
- "--prefix=\#{prefix}"
- <% elsif mode == :meson %>
- mkdir "build" do
- system "meson", "--prefix=\#{prefix}", ".."
- system "ninja"
- system "ninja", "test"
- system "ninja", "install"
+ def template
+ <<~EOS
+ # Documentation: https://docs.brew.sh/Formula-Cookbook.html
+ # 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
+ desc "#{desc}"
+ homepage "#{homepage}"
+ <% if head? %>
+ head "#{url}"
+ <% else %>
+ url "#{url}"
+ <% unless version.nil? or version.detected_from_url? %>
+ version "#{version}"
+ <% end %>
+ sha256 "#{sha256}"
+ <% end %>
+ <% if mode == :cmake %>
+ depends_on "cmake" => :build
+ <% elsif mode == :meson %>
+ depends_on "meson" => :build
+ depends_on "ninja" => :build
+ <% elsif mode.nil? %>
+ # depends_on "cmake" => :build
+ <% end %>
+ def install
+ # ENV.deparallelize # if your formula fails when building in parallel
+ <% if mode == :cmake %>
+ system "cmake", ".", *std_cmake_args
+ <% elsif mode == :autotools %>
+ # Remove unrecognized options if warned by configure
+ system "./configure", "--disable-debug",
+ "--disable-dependency-tracking",
+ "--disable-silent-rules",
+ "--prefix=\#{prefix}"
+ <% elsif mode == :meson %>
+ mkdir "build" do
+ system "meson", "--prefix=\#{prefix}", ".."
+ system "ninja"
+ system "ninja", "test"
+ system "ninja", "install"
+ 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
+ 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
- <% 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
-
- 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
end
end
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index bb9778c81..e3b93fa72 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -54,9 +54,10 @@ class Keg
end
class DirectoryNotWritableError < LinkError
- def to_s; <<~EOS
- Could not symlink #{src}
- #{dst.dirname} is not writable.
+ def to_s
+ <<~EOS
+ Could not symlink #{src}
+ #{dst.dirname} is not writable.
EOS
end
end
diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb
index a17acfca6..cd296b5ab 100644
--- a/Library/Homebrew/test/cask/dsl_spec.rb
+++ b/Library/Homebrew/test/cask/dsl_spec.rb
@@ -232,8 +232,9 @@ describe Hbc::DSL, :cask do
expect(cask.caveats).to be_empty
cask = Hbc::Cask.new("cask-with-caveats") do
- def caveats; <<~EOS
- When you install this Cask, you probably want to know this.
+ def caveats
+ <<~EOS
+ When you install this Cask, you probably want to know this.
EOS
end
end
diff --git a/Library/Homebrew/test/support/helper/output_as_tty.rb b/Library/Homebrew/test/support/helper/output_as_tty.rb
index aa9da73cc..22f96510e 100644
--- a/Library/Homebrew/test/support/helper/output_as_tty.rb
+++ b/Library/Homebrew/test/support/helper/output_as_tty.rb
@@ -19,7 +19,7 @@ module Test
return super(block) unless @tty
colored_tty_block = lambda do
- instance_eval("$#{@output}").extend(Module.new do
+ instance_eval("$#{@output}", __FILE__, __LINE__).extend(Module.new do
def tty?
true
end
@@ -32,7 +32,7 @@ module Test
return super(colored_tty_block) if @colors
uncolored_tty_block = lambda do
- instance_eval <<-EOS
+ instance_eval <<-EOS, __FILE__, __LINE__ + 1
begin
captured_stream = StringIO.new
diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb
index be9bf4dd3..016676323 100644
--- a/Library/Homebrew/utils/github.rb
+++ b/Library/Homebrew/utils/github.rb
@@ -129,7 +129,7 @@ module GitHub
# 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"]
- 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
token, username = api_credentials