Sha256: 2e5f61125742743b27f24b1a5b54d099d6b21cb13da6ebe2e8f69c3df47e3d83
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
module S3Repo ## # Repo object, represents an Arch repo inside an S3 bucket class Repo < Base def add_package(file) upload!(file) package = Package.new(client: client, key: file) metadata.add_package(package) package end def packages @packages ||= parse_packages end def serve(path, recheck = true) cache.serve(path, recheck) end def metadata @metadata ||= Metadata.new(client: client) end private def cache @cache ||= Cache.new(client: client, tmpdir: @options[:tmpdir]) end def upload!(file) client.put_object( bucket: bucket, key: file, body: File.open(file) { |fh| fh.read } ) end def parse_packages resp = client.list_objects(bucket: bucket).contents.map(&:key) resp.select! { |x| x.match(/.*\.pkg\.tar\.xz$/) } resp.map { |x| Package.new(client: client, key: x) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
s3repo-0.0.2 | lib/s3repo/repo.rb |