Sha256: a6c8721f3e1766f33d6acdf6ceeb96b459520182b1a53baa33592f25f06391e1
Contents?: true
Size: 1.38 KB
Versions: 7
Compression:
Stored size: 1.38 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_local 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
7 entries across 7 versions & 1 rubygems