fix a bug in `motion update' where comparing version will do unexpected behavior using the string

"2.9" > "2.10" #=> true

So, when we released version 2.10,
Prompting message to update that may not be appeared.
This commit is contained in:
Watson
2013-09-16 22:38:18 +09:00
parent f77549a728
commit 56a1d564ae

View File

@@ -36,6 +36,12 @@ module Motion; module Project
resp
end
def latest_version?(product, latest)
product = product.split(".")
latest = latest.split(".")
(product[0].to_i >= latest[0].to_i) && (product[1].to_i >= latest[1].to_i)
end
def run(args)
check_mode = false
wanted_software_version = nil
@@ -66,7 +72,7 @@ module Motion; module Project
latest_version, message = File.read(update_check_file).split('|', 2)
message ||= ''
if latest_version > product_version
unless latest_version?(product_version, latest_version)
message = "A new version of RubyMotion is available. Run `sudo motion update' to upgrade.\n" + message
end
message.strip!