aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/dev-cmd/create.rb47
-rw-r--r--README.md7
-rw-r--r--docs/Manpage.md3
-rw-r--r--manpages/brew.12
4 files changed, 37 insertions, 22 deletions
diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb
index 6855d6f37..58a155b13 100644
--- a/Library/Homebrew/dev-cmd/create.rb
+++ b/Library/Homebrew/dev-cmd/create.rb
@@ -10,7 +10,8 @@
#: If `--meson` is passed, create a basic template for a Meson-style build.
#:
#: If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
-#: will thus not add the SHA256 to the formula for you.
+#: will thus not add the SHA256 to the formula for you. It will also not check
+#: the GitHub API for GitHub projects (to fill out the description and homepage).
#:
#: The options `--set-name` and `--set-version` each take an argument and allow
#: you to explicitly set the name and version of the package you are creating.
@@ -100,7 +101,7 @@ module Homebrew
end
class FormulaCreator
- attr_reader :url, :sha256
+ attr_reader :url, :sha256, :desc, :homepage
attr_accessor :name, :version, :tap, :path, :mode
def url=(url)
@@ -108,11 +109,15 @@ class FormulaCreator
path = Pathname.new(url)
if @name.nil?
case url
- when %r{github\.com/\S+/(\S+)\.git}
- @name = $1
+ when %r{github\.com/(\S+)/(\S+)\.git}
+ @user = $1
+ @name = $2
@head = true
- when %r{github\.com/\S+/(\S+)/archive/}
- @name = $1
+ @github = true
+ when %r{github\.com/(\S+)/(\S+)/(archive|releases)/}
+ @user = $1
+ @name = $2
+ @github = true
else
@name = path.basename.to_s[/(.*?)[-_.]?#{Regexp.escape(path.version.to_s)}/, 1]
end
@@ -131,7 +136,7 @@ class FormulaCreator
end
def fetch?
- !head? && !ARGV.include?("--no-fetch")
+ !ARGV.include?("--no-fetch")
end
def head?
@@ -145,11 +150,25 @@ class FormulaCreator
opoo "Version cannot be determined from URL."
puts "You'll need to add an explicit 'version' to the formula."
elsif fetch?
- r = Resource.new
- r.url(url)
- r.version(version)
- r.owner = self
- @sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
+ unless head?
+ r = Resource.new
+ r.url(url)
+ r.version(version)
+ r.owner = self
+ @sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
+ end
+
+ if @user && @name
+ begin
+ metadata = GitHub.repository(@user, @name)
+ @desc = metadata["description"]
+ @homepage = metadata["homepage"]
+ rescue GitHub::HTTPNotFoundError
+ # If there was no repository found assume the network connection is at
+ # fault rather than the input URL.
+ nil
+ end
+ end
end
path.write ERB.new(template, nil, ">").result(binding)
@@ -161,8 +180,8 @@ class FormulaCreator
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class #{Formulary.class_s(name)} < Formula
- desc ""
- homepage ""
+ desc "#{desc}"
+ homepage "#{homepage}"
<% if head? %>
head "#{url}"
<% else %>
diff --git a/README.md b/README.md
index 47aa217cf..5378813ee 100644
--- a/README.md
+++ b/README.md
@@ -35,12 +35,7 @@ We explicitly welcome contributions from people who have never contributed to op
A good starting point for contributing is running `brew audit --strict`with some of the packages you use (e.g. `brew audit --strict wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit --strict` shows no results and [submit a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit --strict` without arguments to have it run on all packages and pick one. Good luck!
## Security
-Please report security issues to security@brew.sh.
-
-This is our PGP key which is valid until May 24, 2017.
-* Key ID: `0xE33A3D3CCE59E297`
-* Fingerprint: `C657 8F76 2E23 441E C879 EC5C E33A 3D3C CE59 E297`
-* Full key: https://keybase.io/homebrew/key.asc
+Please report security issues to our [HackerOne](https://hackerone.com/homebrew/).
## Who Are You?
Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid).
diff --git a/docs/Manpage.md b/docs/Manpage.md
index e8171e5b0..b23623e65 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -713,7 +713,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--meson` is passed, create a basic template for a Meson-style build.
If `--no-fetch` is passed, Homebrew will not download `URL` to the cache and
- will thus not add the SHA256 to the formula for you.
+ will thus not add the SHA256 to the formula for you. It will also not check
+ the GitHub API for GitHub projects (to fill out the description and homepage).
The options `--set-name` and `--set-version` each take an argument and allow
you to explicitly set the name and version of the package you are creating.
diff --git a/manpages/brew.1 b/manpages/brew.1
index 5c67849d0..e39d012f3 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -735,7 +735,7 @@ Generate a formula for the downloadable file at \fIURL\fR and open it in the edi
If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. If \fB\-\-meson\fR is passed, create a basic template for a Meson\-style build\.
.
.IP
-If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\.
+If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. It will also not check the GitHub API for GitHub projects (to fill out the description and homepage)\.
.
.IP
The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument and allow you to explicitly set the name and version of the package you are creating\.