diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index a30a82b80735b967530f7244b2d53bfc65a78fb2..6ddee7721f878c3e1838553e4f4cd562932c9da2 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} <Formula + class #{Formula.class_s name} <Formula url '#{url}' homepage '' md5 '' @@ -89,6 +84,27 @@ def make url end +def make url + path = Pathname.new url + + /(.*?)[-_.]?#{path.version}/.match path.basename + + unless $1.to_s.empty? + name = $1 + else + print "Formula name [#{path.stem}]: " + gots = $stdin.gets.chomp + if gots.empty? + name = path.stem + else + name = gots + end + end + + __make url, name +end + + def info name require 'formula'