aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb16
-rw-r--r--Library/Homebrew/dev-cmd/bottle.rb4
-rw-r--r--Library/Homebrew/dev-cmd/bump-formula-pr.rb14
-rw-r--r--Library/Homebrew/dev-cmd/create.rb4
-rw-r--r--Library/Homebrew/dev-cmd/edit.rb2
-rw-r--r--Library/Homebrew/dev-cmd/mirror.rb2
-rw-r--r--Library/Homebrew/dev-cmd/pull.rb31
-rw-r--r--Library/Homebrew/dev-cmd/tap-new.rb4
-rw-r--r--Library/Homebrew/dev-cmd/update-test.rb2
9 files changed, 48 insertions, 31 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index b58672043..bfe4dbc00 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -368,7 +368,7 @@ class FormulaAuditor
if valid_versioned_aliases.empty?
if formula.tap
- problem <<-EOS.undent
+ problem <<~EOS
Formula has other versions so create a versioned alias:
cd #{formula.tap.alias_dir}
ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name}
@@ -379,7 +379,7 @@ class FormulaAuditor
end
unless invalid_versioned_aliases.empty?
- problem <<-EOS.undent
+ problem <<~EOS
Formula has invalid versioned aliases:
#{invalid_versioned_aliases.join("\n ")}
EOS
@@ -476,7 +476,7 @@ class FormulaAuditor
when "gfortran"
problem "Use `depends_on :fortran` instead of `depends_on 'gfortran'`"
when "ruby"
- problem <<-EOS.undent
+ problem <<~EOS
Don't use "ruby" as a dependency. If this formula requires a
minimum Ruby version not provided by the system you should
use the RubyRequirement:
@@ -484,7 +484,7 @@ class FormulaAuditor
where "1.8" is the minimum version of Ruby required.
EOS
when "open-mpi", "mpich"
- problem <<-EOS.undent
+ problem <<~EOS
There are multiple conflicting ways to install MPI. Use an MPIRequirement:
depends_on :mpi => [<lang list>]
Where <lang list> is a comma delimited list that can include:
@@ -492,7 +492,7 @@ class FormulaAuditor
EOS
when *BUILD_TIME_DEPS
next if dep.build? || dep.run?
- problem <<-EOS.undent
+ problem <<~EOS
#{dep} dependency should be
depends_on "#{dep}" => :build
Or if it is indeed a runtime dependency
@@ -541,7 +541,7 @@ class FormulaAuditor
first_word = reason.split[0]
if reason =~ /\A[A-Z]/ && !reason.start_with?(*whitelist)
- problem <<-EOS.undent
+ problem <<~EOS
'#{first_word}' from the keg_only reason should be '#{first_word.downcase}'.
EOS
end
@@ -854,7 +854,7 @@ class FormulaAuditor
return unless formula.tap&.official?
return unless formula.tap.tap_migrations.key?(formula.name)
- problem <<-EOS.undent
+ problem <<~EOS
#{formula.name} seems to be listed in tap_migrations.json!
Please remove #{formula.name} from present tap & tap_migrations.json
before submitting it to Homebrew/homebrew-#{formula.tap.repo}.
@@ -865,7 +865,7 @@ class FormulaAuditor
return unless formula.prefix.directory?
return unless Keg.new(formula.prefix).empty_installation?
- problem <<-EOS.undent
+ problem <<~EOS
The installation seems to be empty. Please ensure the prefix
is set correctly and expected files are installed.
The prefix configure/make argument may be case-sensitive.
diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb
index fb862c773..a54211f5c 100644
--- a/Library/Homebrew/dev-cmd/bottle.rb
+++ b/Library/Homebrew/dev-cmd/bottle.rb
@@ -324,7 +324,7 @@ module Homebrew
"#{key}: old: #{old_value}, new: #{value}"
end
- odie <<-EOS.undent
+ odie <<~EOS
--keep-old was passed but there are changes in:
#{mismatches.join("\n")}
EOS
@@ -428,7 +428,7 @@ module Homebrew
end
unless mismatches.empty?
- odie <<-EOS.undent
+ odie <<~EOS
--keep-old was passed but there are changes in:
#{mismatches.join("\n")}
EOS
diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
index 87d8274cc..fe7e6be3d 100644
--- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb
+++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -91,7 +91,7 @@ module Homebrew
pull_requests = fetch_pull_requests(formula)
return unless pull_requests
return if pull_requests.empty?
- duplicates_message = <<-EOS.undent
+ duplicates_message = <<~EOS
These open pull requests may be duplicates:
#{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")}
EOS
@@ -101,7 +101,7 @@ module Homebrew
elsif !ARGV.force? && ARGV.flag?("--quiet")
odie error_message
elsif !ARGV.force?
- odie <<-EOS.undent
+ odie <<~EOS
#{duplicates_message.chomp}
#{error_message}
EOS
@@ -247,13 +247,13 @@ module Homebrew
if new_formula_version < old_formula_version
formula.path.atomic_write(backup_file) unless ARGV.dry_run?
- odie <<-EOS.undent
+ odie <<~EOS
You probably need to bump this formula manually since changing the
version from #{old_formula_version} to #{new_formula_version} would be a downgrade.
EOS
elsif new_formula_version == old_formula_version
formula.path.atomic_write(backup_file) unless ARGV.dry_run?
- odie <<-EOS.undent
+ odie <<~EOS
You probably need to bump this formula manually since the new version
and old version are both #{new_formula_version}.
EOS
@@ -312,17 +312,15 @@ module Homebrew
remote = Utils.popen_read("hub fork 2>&1")[/remote:? (\S+)/, 1] if remote.to_s.empty?
odie "cannot get remote from 'hub'!" if remote.to_s.empty?
safe_system "git", "push", "--set-upstream", remote, "#{branch}:#{branch}"
- pr_message = <<-EOS.undent
+ pr_message = <<~EOS
#{formula.name} #{new_formula_version}#{devel_message}
Created with `brew bump-formula-pr`.
EOS
user_message = ARGV.value("message")
if user_message
- pr_message += <<-EOS.undent
-
+ pr_message += <<~EOS
---
-
#{user_message}
EOS
end
diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb
index e423842ba..e5481b532 100644
--- a/Library/Homebrew/dev-cmd/create.rb
+++ b/Library/Homebrew/dev-cmd/create.rb
@@ -71,7 +71,7 @@ module Homebrew
if Formula.aliases.include? fc.name
realname = Formulary.canonical_name(fc.name)
- raise <<-EOS.undent
+ raise <<~EOS
The formula #{realname} is already aliased to #{fc.name}
Please check that you are not creating a duplicate.
To force creation use --force.
@@ -165,7 +165,7 @@ class FormulaCreator
path.write ERB.new(template, nil, ">").result(binding)
end
- def template; <<-EOS.undent
+ 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!
diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb
index b1e485fe2..0039b4cce 100644
--- a/Library/Homebrew/dev-cmd/edit.rb
+++ b/Library/Homebrew/dev-cmd/edit.rb
@@ -11,7 +11,7 @@ module Homebrew
def edit
unless (HOMEBREW_REPOSITORY/".git").directory?
- raise <<-EOS.undent
+ raise <<~EOS
Changes will be lost!
The first time you `brew update', all local changes will be lost, you should
thus `brew update' before you `brew edit'!
diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb
index 6445bc34c..bf19ee3c5 100644
--- a/Library/Homebrew/dev-cmd/mirror.rb
+++ b/Library/Homebrew/dev-cmd/mirror.rb
@@ -20,7 +20,7 @@ module Homebrew
package_url = "#{bintray_repo_url}/#{bintray_package}"
unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url
- package_blob = <<-EOS.undent
+ package_blob = <<~EOS
{"name": "#{bintray_package}",
"public_download_numbers": true,
"public_stats": true}
diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb
index aa3c9a9d7..79b9da9eb 100644
--- a/Library/Homebrew/dev-cmd/pull.rb
+++ b/Library/Homebrew/dev-cmd/pull.rb
@@ -1,4 +1,4 @@
-#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] <patch-source> [<patch-source>]:
+#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`<bintray-org>] [`--test-bot-user=`<test-bot-user>] <patch-source> [<patch-source>]:
#:
#: Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
#: Optionally, installs the formulae changed by the patch.
@@ -41,6 +41,12 @@
#:
#: If `--warn-on-publish-failure` was passed, do not exit if there's a
#: failure publishing bottles on Bintray.
+#:
+#: If `--bintray-org=`<bintray-org> is passed, publish at the given Bintray
+#: organisation.
+#:
+#: If `--test-bot-user=`<test-bot-user> is passed, pull the bottle block
+#: commit from the specified user on GitHub.
require "net/http"
require "net/https"
@@ -52,6 +58,18 @@ require "tap"
require "version"
require "pkg_version"
+module GitHub
+ module_function
+
+ # Return the corresponding test-bot user name for the given GitHub organization.
+ def test_bot_user(user)
+ test_bot = ARGV.value "test-bot-user"
+ return test_bot if test_bot
+ return "BrewTestBot" if user.casecmp("homebrew").zero?
+ "#{user.capitalize}TestBot"
+ end
+end
+
module Homebrew
module_function
@@ -225,7 +243,7 @@ module Homebrew
url
else
bottle_branch = "pull-bottle-#{issue}"
- "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}"
+ "https://github.com/#{GitHub.test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}"
end
curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url
@@ -257,7 +275,7 @@ module Homebrew
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
end
- def publish_changed_formula_bottles(_tap, changed_formulae_names)
+ def publish_changed_formula_bottles(tap, changed_formulae_names)
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Need to load formulae to publish them!"
end
@@ -268,7 +286,8 @@ module Homebrew
changed_formulae_names.each do |name|
f = Formula[name]
next if f.bottle_unneeded? || f.bottle_disabled?
- next unless publish_bottle_file_on_bintray(f, bintray_creds)
+ bintray_org = ARGV.value("bintray-org") || tap.user.downcase
+ next unless publish_bottle_file_on_bintray(f, bintray_org, bintray_creds)
published << f.full_name
end
else
@@ -420,7 +439,7 @@ module Homebrew
end
# Publishes the current bottle files for a given formula to Bintray
- def publish_bottle_file_on_bintray(f, creds)
+ def publish_bottle_file_on_bintray(f, bintray_org, creds)
repo = Utils::Bottles::Bintray.repository(f.tap)
package = Utils::Bottles::Bintray.package(f.name)
info = FormulaInfoFromJson.lookup(f.name)
@@ -437,7 +456,7 @@ module Homebrew
"--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST",
"--header", "Content-Type: application/json",
"--data", '{"publish_wait_for_secs": 0}',
- "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
+ "https://api.bintray.com/content/#{bintray_org}/#{repo}/#{package}/#{version}/publish"
true
rescue => e
raise unless ARGV.include?("--warn-on-publish-failure")
diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb
index 964ba2f5d..1c3bf20eb 100644
--- a/Library/Homebrew/dev-cmd/tap-new.rb
+++ b/Library/Homebrew/dev-cmd/tap-new.rb
@@ -24,7 +24,7 @@ module Homebrew
(tap.path/"Formula").mkpath
- readme = <<-EOS.undent
+ readme = <<~EOS
# #{titleized_user} #{titleized_repo}
## How do I install these formulae?
@@ -43,7 +43,7 @@ module Homebrew
EOS
write_path(tap, "README.md", readme)
- travis = <<-EOS.undent
+ travis = <<~EOS
language: ruby
os: osx
env: OSX=10.12
diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb
index 1f1cdbeed..ee189ad5e 100644
--- a/Library/Homebrew/dev-cmd/update-test.rb
+++ b/Library/Homebrew/dev-cmd/update-test.rb
@@ -88,7 +88,7 @@ module Homebrew
safe_system "brew", "update", "--verbose"
actual_end_commit = Utils.popen_read("git", "rev-parse", branch).chomp
if start_commit != end_commit && start_commit == actual_end_commit
- raise <<-EOS.undent
+ raise <<~EOS
brew update didn't update #{branch}!
Start commit: #{start_commit}
Expected end commit: #{end_commit}