4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/embarista/tasks/coffeelint.rb', line 4
def self.coffeelint(cmd_args)
tool = 'coffeelint'
cmd_args = cmd_args || ''
node = which('node')
if node.nil?
puts "Could not find node in your path."
return
end
npm = which('npm')
if npm.nil?
puts "Could not find npm in your path."
return
end
coffeelint = which('coffeelint')
if coffeelint
sh "coffeelint #{cmd_args}"
else
if !File.directory?("node_modules/#{tool}")
sh "\"#{npm}\" install #{tool}"
end
sh "\"#{node}\" node_modules/#{tool}/bin/#{tool} #{cmd_args}"
end
end
|