Sha256: 42382e08a8d2a6b3c845316f5fe96bc8a15ff22ce7488c86be95499e665b0246
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
module PkgForge ## # Add upload methods to Forge class Forge attr_accessor :endpoint Contract None => nil def push! upload_artifacts! end private Contract HashOf[Symbol => String] => nil def add_artifact(params) state[:artifacts] ||= [] state[:artifacts] << params nil end Contract None => nil def expose_artifacts! FileUtils.mkdir_p 'pkg' return unless state[:artifacts] state[:artifacts].each do |artifact| dest = File.join('pkg', artifact[:long_name] || artifact[:name]) FileUtils.cp artifact[:source], dest FileUtils.chmod 0o0644, dest end nil end Contract None => String def version @version ||= `git describe --abbrev=0 --tags`.rstrip end Contract None => nil def upload_artifacts! return unless state[:artifacts] state[:artifacts].each do |artifact| args = ['targit', '--authfile', '.github', '--create'] args += ['--name', artifact[:name]] args += ['--endpoint', endpoint] if endpoint args += ["#{org}/#{name}", version, artifact[:source]] run args end nil end end module DSL ## # Add upload methods to Forge DSL class Forge Contract String => nil def endpoint(value) @forge.endpoint = value nil end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pkgforge-0.23.2 | lib/pkgforge/components/upload.rb |
pkgforge-0.23.1 | lib/pkgforge/components/upload.rb |