Sha256: 4ef8846bf8bd6e956cd932cbd8eee3b245b3e3a56524ade0b0d4b3b7fc642b78

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

require 's3repo'
require 'mercenary'

def find(pattern, limits)
  Dir.glob(pattern).select { |x| !limits || limits.include?(File.dirname(x)) }
end

Mercenary.program(:s3repo) do |p|
  p.version S3Repo::VERSION
  p.description 'Package management tool for Archlinux repos'
  p.syntax 's3repo <subcommand> [args]'

  p.command(:build) do |c|
    c.syntax 'build [package...]'
    c.description 'Build package files from PKGBUILDs'

    c.action do |args, _|
      S3Repo.new.build_packages find('*/PKGBUILD', args), ENV['MAKEPKG_FLAGS']
    end
  end

  p.command(:upload) do |c|
    c.syntax 'upload [package...]'
    c.description 'Upload packages to repo'

    c.action do |args, _|
      S3Repo.new.add_packages find('*/*.pkg.tar.xz', args)
    end
  end

  p.command(:remove) do |c|
    c.syntax 'remove [package...]'
    c.description 'Remove packages from repo DB'

    c.action do |args, _|
      S3Repo.new.remove_packages args
    end
  end

  p.command(:prune) do |c|
    c.syntax 'prune'
    c.description 'Prune orphaned files from the repo'

    c.action do
      S3Repo.new.prune_files
    end
  end

  p.action do
    puts p
    exit 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
s3repo-1.0.0 bin/s3repo