Skip to content

Commit

Permalink
Add dependency checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeiklejohn committed Oct 7, 2011
1 parent bbe4594 commit 5203658
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/guard/yeti.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ module Guard
class Yeti < Guard

autoload :Notifier, 'guard/yeti/notifier'
autoload :Dependency, 'guard/yeti/dependency'

def initialize(watches = [], options = {})
super

['yeti', 'node'].each do |command|
Dependency.verify_or_raise(command)
end

UI.info "Guard::Yeti has started!"
@latest_output = "sucks"
end
Expand Down
12 changes: 12 additions & 0 deletions lib/guard/yeti/dependency.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Guard
class Yeti
class Dependency
def self.verify_or_raise(command)
output = system("which #{command} >/dev/null")
unless $?.to_i == 0
raise "Error: #{command} is not installed, which is a requirement of guard-yeti"
end
end
end
end
end

0 comments on commit 5203658

Please sign in to comment.