Sha256: 6986e618817dc7123ab02354b8c1cdcc62ab3623043ae27df13f7c9244101736
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require "uri" module Resona module Formula class << self def print(gems) gems.each do |name, info| puts resource_stanza(name, info[:version], info[:platform], info[:checksum], info[:remote_uri]) end puts puts install_method end def generate_resource_stanzas(gems) res = "" gems.each do |name, info| res << resource_stanza(name, info[:version], info[:platform], info[:checksum], info[:remote_uri]) end res 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.2.0 | lib/resona/formula.rb |