[REBOL] Re: Zips
From: nitsch-lists:netcologne at: 8-Jan-2003 23:17
Carl Read wrote:
>I've noticed quite a few REBOL programs being posted as Zips of late.
>This I think is going against the grain of one of REBOL's nicer
>features, and that is that we can just go...
>
>do http://www.whatever.xxx/script.r
>
>and be testing the script as quickly as it can be downloaded. No
>unpacking and installing before running required, and no
>un-installing either, if it's of no use to us.
>
>Sure, sometimes we need to pack script and data together, but isn't
>their (wasn't there?) a REBOL way to do this? .rip or some such?
>
>Simple things should be simple...
>
[REBOL [
Title: "packer - make self extracting and running archive"
Author: "Volker Nitsch"
Email: [nitsch-lists--netcologne--de]
Date: 12-Jul-2002
Version: 1.0.0
History: [
]
usage: {
set
}
]
;console-tool, copypaste files ;) :
;foreach file read %./[if parse file[thru %.r][probe file] ]
; --- configuration
; name for archive and unpack-directory.
; archive is calles %doced-archive.r and
; unpack-dir %doced-archive/
base-name: %my-project-archive
; list of files to archive
files: [
%file1.r
%file2.r
%file3.r
]
; header for archive script.
header: compose [
Title: "My Project - self running archive"
Author: "Me Of Course"
Email: [me--of--course]
Date: 28-Dec-2002
Version: 0.0.2.9
Build: (now/date)
Warranties: none
]
; last code in the archive-script, to run main-script after unpacking
; 'dir is set to the unpack-directory automatically
main: compose [
do system/options/script: clean-path dir/file1.r
]
; --- end configuration
unpack-dir: join base-name "/"
archive-name: join base-name %.r
if exists? dir: unpack-dir [
foreach file read unpack-dir [
if exists? file: unpack-dir/:file [delete file]
]
delete dir
]
out: cp ""
wrap: func [string /local out] [
out: cp ""
parse string [
some [
copy part 1 50 skip (append out part append out newline)
]
]
out
]
;===header
append out mold/only compose/only [
REBOL (header)
if not exists? dir: (unpack-dir) [make-dir dir]
]
append out newline
foreach file files [
append out mold/only reduce [
'write unpack-dir/:file 'decompress
]
append out newline
append out wrap rejoin [
"64#{"
enbase compress read file
"}"
]
append out newline
]
append out mold/only main
append out newline
either any [not exists? archive-name out <> read archive-name] [
write archive-name out
alert join "wrote to " archive-name
] [alert "no changes, no write"]
if confirm "test?" [do archive-name]
]