dev-cmd/create: add --node option

This commit is contained in:
Seeker 2020-07-12 21:25:01 -07:00
parent df17f8a0cf
commit a3f1e09bce
5 changed files with 21 additions and 1 deletions

View File

@ -29,6 +29,8 @@ module Homebrew
description: "Create a basic template for a Go build."
switch "--meson",
description: "Create a basic template for a Meson-style build."
switch "--node",
description: "Create a basic template for a Node build."
switch "--perl",
description: "Create a basic template for a Perl build."
switch "--python",
@ -54,7 +56,7 @@ module Homebrew
switch :force
switch :verbose
switch :debug
conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--perl", "--python", "--rust"
conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node", "--perl", "--python", "--rust"
named 1
end
end
@ -92,6 +94,8 @@ module Homebrew
:crystal
elsif args.go?
:go
elsif args.node?
:node
elsif args.perl?
:perl
elsif args.python?

View File

@ -84,6 +84,10 @@ module Homebrew
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
<% if mode == :node %>
require "language/node"
<% end %>
class #{Formulary.class_s(name)} < Formula
<% if mode == :python %>
include Language::Python::Virtualenv
@ -112,6 +116,8 @@ module Homebrew
<% elsif mode == :meson %>
depends_on "meson" => :build
depends_on "ninja" => :build
<% elsif mode == :node %>
depends_on "node"
<% elsif mode == :perl %>
uses_from_macos "perl"
<% elsif mode == :python %>
@ -153,6 +159,9 @@ module Homebrew
system "ninja", "-v"
system "ninja", "install", "-v"
end
<% elsif mode == :node %>
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["\#{libexec}/bin/*"]
<% elsif mode == :perl %>
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
ENV.prepend_path "PERL5LIB", libexec/"lib"

View File

@ -169,6 +169,7 @@ _brew_create() {
--help
--meson
--no-fetch
--node
--perl
--python
--ruby

View File

@ -784,6 +784,8 @@ a simple example. For the complete API, see:
Create a basic template for a Go build.
* `--meson`:
Create a basic template for a Meson-style build.
* `--node`:
Create a basic template for a Node build.
* `--perl`:
Create a basic template for a Perl build.
* `--python`:

View File

@ -1022,6 +1022,10 @@ Create a basic template for a Go build\.
Create a basic template for a Meson\-style build\.
.
.TP
\fB\-\-node\fR
Create a basic template for a Node build\.
.
.TP
\fB\-\-perl\fR
Create a basic template for a Perl build\.
.