Skip to content

Instantly share code, notes, and snippets.

@chad
Created October 29, 2008 17:00
Show Gist options
  • Save chad/20746 to your computer and use it in GitHub Desktop.
Save chad/20746 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rubygems/package'
def write_package
open "/tmp/blah.rn", 'wb' do |io|
Gem::Package.open io, 'w' do |pkg|
#pkg.metadata = @spec.to_yaml
Dir["**/*"].each do |file|
next if File.directory? file
stat = File.stat file
mode = stat.mode & 0777
size = stat.size
pkg.add_file_simple file, mode, size do |tar_io|
tar_io.write open(file, "rb") { |f| f.read }
end
end
end
end
end
write_package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment