Module: PolarBear::Utils

Included in:
CodeCollab
Defined in:
lib/polarbear/utils/executor.rb,
lib/polarbear/utils/ccollab_locator.rb

Defined Under Namespace

Classes: Executor

Instance Method Summary collapse

Instance Method Details

#find_ccollab_executableObject


Usage: using PolarBear::Utils

find_ccollab_executable

Returns:

  • (Object)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/polarbear/utils/ccollab_locator.rb', line 12

def find_ccollab_executable
  if OS.mac?
    rule = File::Find.new( 
        :pattern => 'ccollab',
        :follow => false, 
        :path => %w(/Applications))
  else OS.windows?
    rule = File::Find.new( 
        :pattern => 'ccollab.exe',
        :follow => false, 
        :path => ['c:/Program Files/Code Collaborator Client'])
  end
  
  # We use the block form to automatically stop once we find something.
  rule.find { |f| return f }

  raise 'ccollab not found'
end