Sha256: 0f237ef4232e850963a45883d374165e626a2eea24740638c4ca4cf9932054c9
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require "uri" module Resona module Formula class << self def print(gems) puts generate_resource_stanzas(gems) puts puts install_method end def generate_resource_stanzas(gems) stanzas = gems.sort.map do |name, info| resource_stanza(name, info[:version], info[:platform], info[:checksum], info[:remote_uri]) end stanzas.join("\n") end private def resource_stanza(name, version, platform, checksum, remote_uri) uri = if platform.nil? || platform.empty? URI.join(remote_uri, "/gems/#{name}-#{version}.gem") else URI.join(remote_uri, "/gems/#{name}-#{version}-#{platform}.gem") end <<-EOL resource "#{name}" do url "#{uri}" sha256 "#{checksum}" end EOL end def install_method <<-EOL def install resources.each do |r| r.verify_download_integrity(r.fetch) system("gem", "install", r.cached_download, "--no-document", "--install-dir", "\#{libexec}/vendor") end mkpath bin (bin/"__YOUR_FORMULA_SCRIPT__").write <<-EOS.undent #!/bin/bash export GEM_HOME="\#{libexec}/vendor" exec ruby __TARGET__ "$@" EOS # TODO: Continue installation end EOL end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resona-0.3.1 | lib/resona/formula.rb |