<=>(other)
click to toggle source
def <=>(other)
return unless self.class === other
version.<=>(other.version)
end
==(other)
click to toggle source
def ==(other)
self.class === other && track == other.track && version == other.version
end
create()
click to toggle source
def create
logger.debug "Creating #{track} #{version}"
return false unless create_path
return false unless download
return false unless create_metadata
true
end
create_path()
click to toggle source
def create_path
FileUtils.mkdir_p(path)
true
rescue
false
end
download()
click to toggle source
def download
sources.map do |url|
file = URI.parse(url).path.split('/').last
dst = File.join(path, file)
logger.debug "Downloading file #{url} to #{dst}"
task = ::Proxy::Omaha::HttpDownload.new(url, dst)
task.start
task
end.each(&:join).map(&:result).all?
end
exists?()
click to toggle source
def exists?
File.directory?(path)
end
expected_files()
click to toggle source
def expected_files
sources.map { |source| File.basename(source) }
end
expected_files_exist?()
click to toggle source
def expected_files_exist?
expected_files.map {|file| File.file?(File.join(path, file)) }.all?
end
path()
click to toggle source
def path
@path ||= File.join(Proxy::Omaha::Plugin.settings.contentpath, track, version.to_s)
end
purge()
click to toggle source
def purge
FileUtils.rm(Dir.glob(File.join(path, '*')), :force => true)
FileUtils.remove_dir(path)
true
rescue
false
end
sources()
click to toggle source
def sources
upstream = "https://#{track}.release.core-os.net/amd64-usr/#{version}"
[
"#{upstream}/coreos_production_pxe.vmlinuz",
"#{upstream}/coreos_production_pxe_image.cpio.gz",
"https://update.release.core-os.net/amd64-usr/#{version}/update.gz"
]
end
to_s()
click to toggle source
def to_s
version.to_s
end
updatefile()
click to toggle source
def updatefile
File.join(path, 'update.gz')
end
valid?()
click to toggle source
def valid?
expected_files_exist?
end