Class: DependencyCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/ENV/DependencyCheck.rb

Class Method Summary collapse

Class Method Details

.carthage?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/ENV/DependencyCheck.rb', line 4

def self.carthage?
  checkComponent 'carthage'
end

.checkComponent(name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ENV/DependencyCheck.rb', line 12

def self.checkComponent(name)

  exts = ENV['PATH'] ? ENV['PATH'].split(':') : ['']

  exts.each do |path|

    ext = "#{path}/#{name}"
    if File.executable?(ext) && !File.directory?(ext)
      return true
    end

  end

  return false

end

.checkEnvObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ENV/DependencyCheck.rb', line 29

def self.checkEnv

  if !DependencyCheck.carthage?
    pastel =  Pastel.new
    puts pastel.red('[Error] Please install the Carhage. Use commend') + pastel.green(" [sudo] brew install carthage")
  end

  if !DependencyCheck.cocoapods?
    pastel =  Pastel.new
    puts pastel.red('[Error] Please install the Cocoapods. Use commend') + pastel.green(" [sudo] gem install cocoapods")
  end

end

.cocoapods?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/ENV/DependencyCheck.rb', line 8

def self.cocoapods?
  checkComponent 'pod'
end