lib/xcode/install.rb in xcode-install-0.1.1 vs lib/xcode/install.rb in xcode-install-0.2.0
- old
+ new
@@ -162,11 +162,13 @@
`sudo /usr/sbin/dseditgroup -o edit -t group -a staff _developer`
end
def get_seedlist
@xcodes = parse_seedlist(devcenter.download_seedlist)
- @xcodes += prereleases
+
+ names = @xcodes.map(&:name)
+ @xcodes += prereleases.reject { |pre| names.include?(pre.name) }
File.open(LIST_FILE,'w') do |f|
f << Marshal.dump(xcodes)
end
@@ -180,11 +182,11 @@
def parse_seedlist(seedlist)
seedlist['data'].select {
|t| /^Xcode [0-9]/.match(t['name'])
}.map { |x| Xcode.new(x) }.reject { |x| x.version < MINIMUM_VERSION }.sort {
|a,b| a.dateModified <=> b.dateModified
- }
+ }.select { |x| x.url.end_with?('.dmg') }
end
def list_versions
installed = installed_versions.map { |x| x.version }
seedlist.map { |x| x.name }.reject { |x| installed.include?(x) }
@@ -240,9 +242,18 @@
begin
@version = Gem::Version.new(@name.split(' ')[0])
rescue
@version = Installer::MINIMUM_VERSION
end
+ end
+
+ def to_s
+ "Xcode #{version} -- #{url}"
+ end
+
+ def ==(o)
+ dateModified == o.dateModified && name == o.name && path == o.path && \
+ url == o.url && version == o.version
end
def self.new_prelease(version, url)
self.new({'name' => version,
'dateModified' => Time.now.to_i,