From d78ea6c7a12c411f12db9e5c856f2b85d20a7962 Mon Sep 17 00:00:00 2001 From: Nick Sieger Date: Thu, 23 Mar 2017 10:37:45 -0500 Subject: [PATCH] "brew gem formula" which prints formula to stdout --- lib/brew/gem/cli.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/brew/gem/cli.rb b/lib/brew/gem/cli.rb index 4fd7e70..1f0899b 100644 --- a/lib/brew/gem/cli.rb +++ b/lib/brew/gem/cli.rb @@ -10,6 +10,7 @@ module Brew::Gem::CLI "upgrade" => "Upgrade to the latest version of a brew gem", "uninstall" => "Uninstall a brew gem", "info" => "Show information for an installed gem", + "formula" => "Print out the generated formula for a gem", "help" => "This message" } @@ -75,8 +76,13 @@ def run(args = ARGV) version = fetch_version(name, supplied_version) with_temp_formula(name, version, use_homebrew_ruby) do |filename| - system "brew #{command} #{filename}" - exit $?.exitstatus unless $?.success? + case command + when "formula" + $stdout.puts File.read(filename) + else + system "brew #{command} #{filename}" + exit $?.exitstatus unless $?.success? + end end end end