Permalink
Browse files

support brew tap.

  • Loading branch information...
1 parent 66eebcd commit 407a11be95aabe87316dfe19ad11cb51591dca32 @seiji seiji committed Aug 17, 2013
Showing with 19 additions and 2 deletions.
  1. +1 −0 lib/brewdler.rb
  2. +4 −0 lib/brewdler/dsl.rb
  3. +11 −0 lib/brewdler/repo_installer.rb
  4. +2 −1 spec/dsl_spec.rb
  5. +1 −1 spec/install_command_spec.rb
View
1 lib/brewdler.rb
@@ -2,4 +2,5 @@
require "brewdler/dsl"
require "brewdler/brew_installer"
require "brewdler/cask_installer"
+require "brewdler/repo_installer"
require "brewdler/commands/install"
View
4 lib/brewdler/dsl.rb
@@ -15,5 +15,9 @@ def brew(name)
def cask(name)
Brewdler::CaskInstaller.install(name)
end
+
+ def tap(name)
+ Brewdler::RepoInstaller.install(name)
+ end
end
end
View
11 lib/brewdler/repo_installer.rb
@@ -0,0 +1,11 @@
+module Brewdler
+ class RepoInstaller
+ def self.install(name)
+ if system 'brew tap'
+ `brew tap #{name}`
+ else
+ raise "Unable to tap #{name}. Homebrew is not currently installed on your system"
+ end
+ end
+ end
+end
View
3 spec/dsl_spec.rb
@@ -1,9 +1,10 @@
require 'spec_helper'
describe Brewdler::Dsl do
- let(:dsl) { Brewdler::Dsl.new("brew 'git'\ncask 'google-chrome'") }
+ let(:dsl) { Brewdler::Dsl.new("tap 'phinze/cask'\nbrew 'git'\ncask 'google-chrome'") }
it "processes input" do
+ dsl.should_receive(:tap).with('phinze/cask')
dsl.should_receive(:brew).with('git')
dsl.should_receive(:cask).with('google-chrome')
dsl.process
View
2 spec/install_command_spec.rb
@@ -9,7 +9,7 @@
context "when a Brewfile is found" do
it "does not raise an error" do
- File.stub(:read).and_return("brew 'git'\ncask 'google-chrome'")
+ File.stub(:read).and_return("tap 'phinze/cask'\nbrew 'git'\ncask 'google-chrome'")
expect { Brewdler::Commands::Install.run }.to_not raise_error('No Brewfile found')
File.stub(:read => 'git', :open => ['git'])

0 comments on commit 407a11b

Please sign in to comment.