From 14818039ae920d43e86e39cc9f9dd106ce0c8fb7 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Mon, 28 Sep 2009 17:01:44 +0100 Subject: [PATCH] If brew create can't figure out the name, prompt for it This was adapted from adamv@d5e78ee26535dec4b11c33d14832a9ee945a29fd I decided prompting would was the most usable solution here, as the stem is unlikely to be useful so the user would have to rename the file and change the class name as well as type the command once and then again with --force. Dissent welcome. Fixes Homebrew/homebrew#15 --- Library/Homebrew/brew.h.rb | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index a30a82b807..6ddee7721f 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -21,21 +21,16 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -def make url +def __make url, name require 'formula' - path=Pathname.new url - - /(.*?)[-_.]?#{path.version}/.match path.basename - raise "Couldn't parse name from #{url}" if $1.nil? or $1.empty? - - path=Formula.path $1 + path = Formula.path name raise "#{path} already exists" if path.exist? template=<<-EOS require 'brewkit' - class #{Formula.class_s $1}