class Bundix::Source
Public Instance Methods
convert()
click to toggle source
# File lib/bundix/source.rb, line 127 def convert case spec.source when Bundler::Source::Rubygems convert_rubygems when Bundler::Source::Git convert_git when Bundler::Source::Path convert_path else pp spec fail 'unkown bundler source' end end
convert_git()
click to toggle source
# File lib/bundix/source.rb, line 160 def convert_git revision = spec.source.options.fetch('revision') uri = spec.source.options.fetch('uri') submodules = !!spec.source.submodules output = fetcher.nix_prefetch_git(uri, revision, submodules: submodules) # FIXME: this is a hack, we should separate $stdout/$stderr in the sh call hash = JSON.parse(output[/({[^}]+})\s*\z/m])['sha256'] fail "couldn't fetch hash for #{spec.full_name}" unless hash puts "#{hash} => #{uri}" if $VERBOSE { type: 'git', url: uri.to_s, rev: revision, sha256: hash, fetchSubmodules: submodules } end
convert_path()
click to toggle source
# File lib/bundix/source.rb, line 141 def convert_path { type: "path", path: spec.source.path } end
convert_rubygems()
click to toggle source
# File lib/bundix/source.rb, line 148 def convert_rubygems remotes = spec.source.remotes.map{|remote| remote.to_s.sub(/\/+$/, '') } hash = fetcher.fetch_local_hash(spec) remote, hash = fetcher.fetch_remotes_hash(spec, remotes) unless hash fail "couldn't fetch hash for #{spec.full_name}" unless hash puts "#{hash} => #{spec.full_name}.gem" if $VERBOSE { type: 'gem', remotes: (remote ? [remote] : remotes), sha256: hash } end