1 Star 0 Fork 2

lenmom/monodevelop

forked from Hotsun/monodevelop 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dependency_checker.rb 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
Mikayla Hutchinson 提交于 2016-12-08 13:38 . [build] Fix XM version check
require 'pp'
NOT_INSTALLED_VERSION="-1"
XAMARIN_MAC_MIN_VERSION="2.3"
XAMARIN_MAC_VERSION=lambda { product_version ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version") }
XAMARIN_MAC_URL="http://www.xamarin.com"
MONO_MIN_VERSION="4.2"
MONO_VERSION=lambda { mono_version("/Library/Frameworks/Mono.framework/Versions/Current/bin/mono") }
MONO_URL="http://mono-project.com"
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 mono_version(binary)
if File.exist?("#{binary}")
actual_version = `#{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]
return actual_version.split(' ')[0]
else
return NOT_INSTALLED_VERSION
end
end
def product_version(version_file)
if File.exist?(version_file)
return File.open(version_file, 'rb') { |f| f.read }
else
return NOT_INSTALLED_VERSION
end
end
def check_product(product_min_version, product_version, product_url, product_name)
actual_version = product_version.call
retval = compare_version(actual_version, product_min_version)
if (retval < 0)
if (actual_version == NOT_INSTALLED_VERSION)
puts "You do not have #{product_name} installed.".red
else
puts "Your installed #{product_name} (#{actual_version}) is too old, please use #{product_min_version} or newer".red
end
puts "You can download it from #{product_url}".red
puts
end
return retval
end
def check_monodevelop_dependencies()
result = [
check_product(MONO_MIN_VERSION, MONO_VERSION, MONO_URL, "Mono"),
check_product(XAMARIN_MAC_MIN_VERSION, XAMARIN_MAC_VERSION, XAMARIN_MAC_URL, "Xamarin.Mac")
]
if (result.min < 0)
exit 1
end
end
$stdout.sync = true
check_monodevelop_dependencies() if __FILE__==$0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lenmom/monodevelop.git
[email protected]:lenmom/monodevelop.git
lenmom
monodevelop
monodevelop
master

搜索帮助