-
Notifications
You must be signed in to change notification settings - Fork 1
/
check_dependency.rb
executable file
·58 lines (42 loc) · 1.56 KB
/
check_dependency.rb
1
2
3
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/env ruby
###########################################################
is_to_install = false
###########################################################
# check ruby version
puts "Checking Ruby version ......"
if RUBY_VERSION =~ /^1\. | ^2\.[0-6]/x
puts "Your Ruby version is #{RUBY_VERSION}. Pls install Ruby v2.7+."
is_to_install = true
end
puts
###########################################################
# check ruby gems
puts "Checking Ruby gems ......"
required_gems = %w[parallel colorize find getoptlong time fileutils tmpdir bio bio-nwk]
required_gems.each do |gem_name|
if Gem::Specification.find_all_by_name(gem_name).empty?
puts "#{gem_name} is NOT installed. In bash, try \'gem install #{gem_name}\'"
is_to_install = true
else
#puts "#{gem_name} is installed."
;
end
end
puts
###########################################################
# check other tools
puts "Checking other tools ......"
required_tools = {"iqtree"=>"iqtree",
"nw_topology"=>"Newick Utilities", "mcmctree"=>"MCMCtree (PAML)", "Rscript"=>"R"}
required_tools.each_pair do |k, v|
if not system("which #{k} > /dev/null 2>&1")
puts "#{v} NOT installed! Pls install #{v} and add its path to the environmental variable PATH (e.g., https://askubuntu.com/questions/141718/what-is-the-path-environment-variable-and-how-do-i-add-to-it)!"
is_to_install = true
end
end
puts
###########################################################
unless is_to_install
require "colorize"
puts "Awesome! You seem to have all dependencies installed.".colorize(:red)
end