Module: Pkg::Gem

Defined in:
lib/packaging/gem.rb

Class Method Summary collapse

Class Method Details

.rsync_to_downloads(file) ⇒ Object

Use rsync to deploy a file and any associated detached signatures, checksums, or other glob-able artifacts to an external download server.



13
14
15
16
# File 'lib/packaging/gem.rb', line 13

def rsync_to_downloads(file)
  Pkg::Util.deprecate('Pkg::Gem.rsync_to_downloads', 'Pkg::Util::Ship.ship_pkgs')
  Pkg::Util::Ship.ship_pkgs(["#{file}*"], Pkg::Config.gem_host, Pkg::Config.gem_path, platform_independent: true)
end

.ship(file) ⇒ Object

This is preserved because I don't want to update the deprecated code path yet; I'm not entirely sure I've fixed everything that might attempt to call this method so this is now a wrapper for a wrapper.



6
7
8
9
# File 'lib/packaging/gem.rb', line 6

def ship(file)
  rsync_to_downloads(file)
  ship_to_rubygems(file)
end

.ship_to_rubygems(file) ⇒ Object

Ship a Ruby gem file to rubygems.org. Requires the existence of a ~/.gem/credentials file or else rubygems.org won't have any idea who you are.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/packaging/gem.rb', line 21

def ship_to_rubygems(file)
  Pkg::Util::File.file_exists?("#{ENV['HOME']}/.gem/credentials", :required => true)
  Pkg::Util::Execution.capture3("gem push #{file}")
rescue => e
  puts "###########################################"
  puts "#  Publishing to rubygems failed. Make sure your .gem/credentials"
  puts "#  file is set up and you are an owner of #{Pkg::Config.gem_name}"
  puts "###########################################"
  puts
  puts e
  raise e
end