Skip to content

Commit 33e23e1

Browse files
committed
allow for non formula.rb files
1 parent 9b1131a commit 33e23e1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

bin/brew2deb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
require 'optparse'
33
require 'fileutils'
44

5-
unless File.exists?('formula.rb')
5+
formula = ARGV.find{ |arg| arg =~ /\.rb$/ and File.exists?(arg) }
6+
formula ||= 'formula.rb'
7+
8+
unless File.exists?(formula)
69
STDERR.puts '*** No formula.rb found in the working directory'
710
exit(1)
811
end
912

13+
Dir.chdir File.dirname(File.expand_path(formula))
14+
1015
if ARGV.include? 'clean'
1116
FileUtils.rm_rf %w[ tmp-build tmp-install ], :verbose => true
1217
exit
@@ -20,8 +25,9 @@ HOMEBREW_WORKDIR = Pathname.new(Dir.pwd)
2025
HOMEBREW_CACHE = HOMEBREW_WORKDIR+'src'
2126
FileUtils.mkdir_p(HOMEBREW_CACHE)
2227

23-
require './formula'
28+
$:.unshift File.expand_path('.')
29+
load formula
2430

25-
klass = File.read('formula.rb')[/class (\w+)/, 1]
31+
klass = File.read(formula)[/class (\w+)/, 1]
2632
eval(klass).package!
2733

0 commit comments

Comments
 (0)