Permalink
Browse files

opening .brewfile, Brewfile

  • Loading branch information...
1 parent 18cd25d commit 59d4399640572236c5909a9c98498550e32acadb @onemanstartup onemanstartup committed Oct 23, 2013
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/brewdler/commands/install.rb
@@ -2,17 +2,21 @@ module Brewdler::Commands
class Install
def self.run
begin
- file = File.read(File.join(Dir.pwd, "Brewfile"))
- Brewdler::Dsl.new(file).process
+ Brewdler::Dsl.new(brewfile).process
rescue Errno::ENOENT => e
raise "No Brewfile found"
rescue NameError
- file = File.open(File.join(Dir.pwd, "Brewfile"))
- file.find_all do |name|
+ brewfile.find_all do |name|
name.chomp!
Brewdler::BrewInstaller.install(name) if name.length > 0 && name !~ /^ *#/
end
end
end
+
+ private
+
+ def self.brewfile
+ File.read(Dir['{*,.*}{B,b}rewfile'].first)
+ end
end
end

0 comments on commit 59d4399

Please sign in to comment.