Created
March 4, 2016 06:27
-
-
Save kylekyle/a130f46993a0042915fd to your computer and use it in GitHub Desktop.
Dynamically generate docs from a gem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zlib' | |
require 'yard' | |
require 'tmpdir' | |
require 'stringio' | |
require 'fileutils' | |
require 'archive/tar/minitar' | |
io = StringIO.new File.read('sequel-4.32.0.gem') | |
catch :finished do | |
Archive::Tar::Minitar::Input.open(io) do |entries| | |
entries.each do |entry| | |
if entry.full_name == 'data.tar.gz' | |
Zlib::GzipReader.wrap StringIO.new(entry.read) do |gzio| | |
Dir.mktmpdir do |directory| | |
Archive::Tar::Minitar.unpack gzio, directory | |
Dir.chdir directory do | |
YARD::CLI::Yardoc.run '-c', '--no-stats', '-o', '/Users/kyle/Desktop/BOOM' | |
end | |
throw :finished, true | |
end | |
end | |
end | |
end | |
end | |
raise 'could not extract files from gem!' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment