class Buildr::PackageGemTask
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/buildr/packaging/gems.rb, line 22 def initialize(*args) super @spec = Gem::Specification.new end
Public Instance Methods
spec() { |spec| ... }
click to toggle source
# File lib/buildr/packaging/gems.rb, line 27 def spec yield @spec if block_given? @spec end
upload()
click to toggle source
# File lib/buildr/packaging/gems.rb, line 32 def upload end
Private Instance Methods
create_from(file_map)
click to toggle source
# File lib/buildr/packaging/gems.rb, line 37 def create_from(file_map) spec.mark_version spec.validate File.open(name, 'wb') do |io| Gem::Package.open(io, 'w', nil) do |pkg| pkg.metadata = spec.to_yaml file_map.each do |path, content| next if content.nil? || File.directory?(content.to_s) pkg.add_file_simple(path, File.stat(content.to_s).mode & 0777, File.size(content.to_s)) do |os| File.open(content.to_s, "rb") do |file| os.write file.read(4096) until file.eof? end end end end end end