sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Binary to Ruby Archiver

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 181 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jim
      last edited by

      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.

      Hi

      1 Reply Last reply Reply Quote 0
      • tbdT Offline
        tbd
        last edited by

        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
        
        

        SketchUp Ruby Consultant | Podium 1.x developer
        http://plugins.ro

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          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.

          Hi

          1 Reply Last reply Reply Quote 0
          • tbdT Offline
            tbd
            last edited by

            @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 😉

            SketchUp Ruby Consultant | Podium 1.x developer
            http://plugins.ro

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement