Merge pull request #7200 from dawidd6/create-ruby

create: add --ruby option
This commit is contained in:
Mike McQuaid 2020-03-24 13:50:35 +00:00 committed by GitHub
commit fa8fe0fc39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 25 deletions

View File

@ -31,6 +31,8 @@ module Homebrew
description: "Create a basic template for a Perl build." description: "Create a basic template for a Perl build."
switch "--python", switch "--python",
description: "Create a basic template for a Python build." description: "Create a basic template for a Python build."
switch "--ruby",
description: "Create a basic template for a Ruby build."
switch "--rust", switch "--rust",
description: "Create a basic template for a Rust build." description: "Create a basic template for a Rust build."
switch "--no-fetch", switch "--no-fetch",
@ -86,6 +88,8 @@ module Homebrew
:perl :perl
elsif args.python? elsif args.python?
:python :python
elsif args.ruby?
:ruby
elsif args.rust? elsif args.rust?
:rust :rust
end end

View File

@ -112,6 +112,8 @@ module Homebrew
uses_from_macos "perl" uses_from_macos "perl"
<% elsif mode == :python %> <% elsif mode == :python %>
depends_on "python" depends_on "python"
<% elsif mode == :ruby %>
uses_from_macos "ruby"
<% elsif mode == :rust %> <% elsif mode == :rust %>
depends_on "rust" => :build depends_on "rust" => :build
<% elsif mode.nil? %> <% elsif mode.nil? %>
@ -166,6 +168,12 @@ module Homebrew
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"]) bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
<% elsif mode == :python %> <% elsif mode == :python %>
virtualenv_install_with_resources virtualenv_install_with_resources
<% elsif mode == :ruby %>
ENV["GEM_HOME"] = libexec
system "gem", "build", "\#{name}.gemspec"
system "gem", "install", "\#{name}-\#{version}.gem"
bin.install libexec/"bin/\#{name}"
bin.env_script_all_files(libexec/"bin", :GEM_HOME => ENV["GEM_HOME"])
<% elsif mode == :rust %> <% elsif mode == :rust %>
system "cargo", "install", "--locked", "--root", prefix, "--path", "." system "cargo", "install", "--locked", "--root", prefix, "--path", "."
<% else %> <% else %>

View File

@ -71,31 +71,6 @@ describe Cask::Cmd::Upgrade, :cask do
expect(local_transmission_path).to be_a_directory expect(local_transmission_path).to be_a_directory
expect(local_transmission.versions).to include("2.60") expect(local_transmission.versions).to include("2.60")
end end
it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do
local_caffeine = Cask::CaskLoader.load("local-caffeine")
local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
auto_updates = Cask::CaskLoader.load("auto-updates")
auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
expect(local_caffeine).to be_installed
expect(local_caffeine_path).to be_a_directory
expect(local_caffeine.versions).to include("1.2.2")
expect(auto_updates).to be_installed
expect(auto_updates_path).to be_a_directory
expect(auto_updates.versions).to include("2.57")
described_class.run("local-caffeine", "auto-updates")
expect(local_caffeine).to be_installed
expect(local_caffeine_path).to be_a_directory
expect(local_caffeine.versions).to include("1.2.3")
expect(auto_updates).to be_installed
expect(auto_updates_path).to be_a_directory
expect(auto_updates.versions).to include("2.61")
end
end end
describe "with --greedy it checks additional Casks" do describe "with --greedy it checks additional Casks" do

View File

@ -813,6 +813,8 @@ a simple example. For the complete API, see:
Create a basic template for a Perl build. Create a basic template for a Perl build.
* `--python`: * `--python`:
Create a basic template for a Python build. Create a basic template for a Python build.
* `--ruby`:
Create a basic template for a Ruby build.
* `--rust`: * `--rust`:
Create a basic template for a Rust build. Create a basic template for a Rust build.
* `--no-fetch`: * `--no-fetch`:

View File

@ -1044,6 +1044,10 @@ Create a basic template for a Perl build\.
Create a basic template for a Python build\. Create a basic template for a Python build\.
. .
.TP .TP
\fB\-\-ruby\fR
Create a basic template for a Ruby build\.
.
.TP
\fB\-\-rust\fR \fB\-\-rust\fR
Create a basic template for a Rust build\. Create a basic template for a Rust build\.
. .