lib/uvm/cli.rb in wooga_uvm-0.3.2 vs lib/uvm/cli.rb in wooga_uvm-1.0.0
- old
+ new
@@ -25,11 +25,11 @@
unless version =~ Lib.version_regex
puts "Invalid format '#{version}' - please try a version in format `X.X.X`"
exit
end
- desired_version = File.join(UNITY_INSTALL_LOCATION,"Unity"+version)
+ desired_version = File.join(UNITY_INSTALL_LOCATION,"Unity-"+version)
unless Dir.exists? desired_version
puts "Version #{version} isn't available "
puts "Available versions are -"
list
@@ -79,27 +79,27 @@
end
private
def ensure_link
if !File.symlink?(UNITY_LINK) and File.directory?(UNITY_LINK)
- new_dir_name = File.join(UNITY_INSTALL_LOCATION,"Unity"+Lib.current)
+ new_dir_name = File.join(UNITY_INSTALL_LOCATION,"Unity-"+Lib.current)
FileUtils.mv(UNITY_LINK, new_dir_name)
FileUtils.ln_s(new_dir_name, UNITY_LINK, :force => true)
end
end
end
class Lib
def self.current
plist_path = File.join(UNITY_CONTENTS,"Info.plist")
if File.exists? plist_path
- `/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' #{plist_path}`.split("f").first
+ `/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' #{plist_path}`
end
end
def self.list
- installed = `find #{UNITY_INSTALL_LOCATION} -name "Unity*" -type d -maxdepth 1`.lines
- installed.map{|u| u.match(version_regex){|m| m[1]} }
+ installed = `find #{UNITY_INSTALL_LOCATION} -name "Unity-*" -type d -maxdepth 1`.lines
+ installed.select{|u| !u.match(version_regex).nil? }.map{|u| u.match(version_regex){|m| m[1]} }
end
def self.version_regex
/(\d+\.\d+\.\d+(f\d+)?)/
end