Binary to Ruby Archiver
-
I'd really like a way to package multiple files - both binary and plain text - into a single plain-text encoded Ruby script archive.
So when it is first loaded in SketchUp, it decodes the files and writes then to the right files and folders.
I'm thinking this would make it easier to write a plugins manager with version control and network upgrades. It would be very cool to have a "Check for Plugin Updates" and "Update Selected Plugins" dialog.
Not a new idea around here, but an idea worth reviewing from time-to-time.
-
I did something similar with TimeTracker - have a Hash with the name of the file as key and as value a pack('m') like this:
# compress files # extensions to have in the archive files = Dir["*.{gif,png,jpg,rb}"] all = Hash.new files.each do |x| all[x] = [File.open(x,"rb").read].pack("m") end File.open("archive.txt","w") do |f| f.write "archive = "+all.inspect end
-
Actually, unix/Linux has a utility named shar - shell archive - that does almost exactly this; except for it is for shell.
Thanks, TBD. Will need to consider including files and folders in the archive.
-
@jim said:
Will need to consider including files and folders in the archive.
you just need to add the complete path to the filename and a way to create/check for directories. easy
Advertisement