blob: e36113f4fbf5a7684c7b1bc47998474d01e6164b (
plain)
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
|
require 'pp'
REQUIRED_XAMARIN_MAC_VERSION="2.0"
XAMARIN_MAC_VERSION_FILE="/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version"
REQUIRED_MONO_VERSION="4.0"
MONO_BINARY="/Library/Frameworks/Mono.Framework/Versions/Current/bin/mono"
class String
def red; "\e[31m#{self}\e[0m" end
end
def compare_version(first, second)
val1 = first.split('.').map { |x| x.to_i }
val2 = second.split('.').map { |x| x.to_i }
return val1 <=> val2
end
def check_product(required_version, version_file, product_name)
actual_version = File.read(version_file).strip
retval = compare_version(actual_version, required_version)
if (retval < 0)
puts "Your installed #{product_name} (#{actual_version}) is too old, please use #{required_version} or newer".red
end
return retval
end
def check_mono(required_version, mono_binary)
actual_version = `#{mono_binary} --version`
# Extract the version number from a string like this:
# `Mono JIT compiler version 4.2.0 (explicit/08b7103 Mon Aug 17 16:58:52 EDT 2015)`
actual_version = actual_version.split('version ')[1]
actual_version = actual_version.split(' ')[0]
retval = compare_version(actual_version, required_version)
if (retval < 0)
puts "Your installed mono (#{actual_version}) is too old, please use #{required_version} or newer".red
end
return retval
end
def check_monodevelop_dependencies()
mono_ret = check_mono(REQUIRED_MONO_VERSION, MONO_BINARY)
xammac_ret = check_product(REQUIRED_XAMARIN_MAC_VERSION, XAMARIN_MAC_VERSION_FILE, "Xamarin.Mac")
if (xammac_ret < 0 || mono_ret < 0)
raise RuntimeError
end
end
def run()
check_monodevelop_dependencies()
end
$stdout.sync = true
run() if __FILE__==$0
|