• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Pack Up Multiple Files into a Single .rb File?

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 4 Posters 478 Views 4 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 Jim 11 Sept 2010, 15:48

    I may have asked this before, but isn't it possible (and not even that hard) to package-up all of a plugin's file into a single .rb which would self-extract itself to the Plugins folder?

    I know Unix has had command-line utilities to do this type of thing forever (shar , for example.)

    Hi

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 11 Sept 2010, 17:42

      ~
      WinZip could do this since forever. It creates a self-extracting exe, that (dependant on the archiver's choice,) can prompt the enduser, where he/she wants to extract the files to.

      7zip can also do a similar job. See the 7z help file, "Command Line Version" section, "Switches" subsection, -sfx (Create SFX archive) switch.

      There used to be a company called PKware that made archivers as well.
      ~
      *PS: WinZip is not the built-in zip folder feature in Windows XP+, it's the application WinZip.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 11 Sept 2010, 17:47

        BTW.. 7zip is a plug-in capable app. There may be plugins out there that simplfy creating self-extracting archives.
        .
        EDIT: Oh.. I just tried creating a self-extracting archive using the checkbox in 7zip's create archive dialog, and it wrote out a exe file.
        โ—

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by 11 Sept 2010, 18:07

          I found the 7z's sxe documentation lacking, and it isn't cross-platform, is it?

          Hi

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 12 Sept 2010, 00:39

            Should be able to. There is a keyword in Ruby you can use to indicate the end of the file - as far as the ruby processor is concerned.

            So stuff the files you need after that point and have the script unpack it.
            Just need to find out how you indicate the start and end of the embedded files.

            Thomas Thomassen โ€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by 12 Sept 2010, 00:48

              It seems like it would be straight forward. I think pack and unpack can do base64 encoding/decoding, and so just encode every file, binary or not, to make it simpler. I'm just being lazy. ๐Ÿ˜„

              Hi

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 12 Sept 2010, 01:47

                Yea, base64 encoding would be doing it pretty much like you do with emails - using a unique indentifier to indicate the file splits.

                Thomas Thomassen โ€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tbd
                  last edited by 12 Sept 2010, 09:14

                  I did something like that in timetrack.rb - here is the uncompress part

                  
                  
                   zap_files = <<EOL
                  {"tt_stop_l.png"=>"... removed ...", "tt_go_s.png"=>"... removed ..."}
                  EOL
                  
                    if not FileTest.exists?("tt_stop_l.png")
                      eval(zap_files).each_pair do |x,y|
                        File.open(File.join(Sketchup.find_support_file("Plugins"), x),"wb") do |f|
                            f.write y.unpack("m")
                        end
                      end
                    end
                  
                  
                  

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

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

                  Advertisement