Zips
[1/9] from: carl::cybercraft::co::nz at: 9-Jan-2003 10:24
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...
--
Carl Read
[2/9] 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
<<quoted lines omitted: 6>>
>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]
]
[3/9] from: al:bri:xtra at: 9-Jan-2003 12:47
Carl Read wrote:
> 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 [
Name: 'Pack
Title: "Pack"
File: %Pack.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Web: http://valley.150m.com
Date: 9/January/2003
Version: 1.1.3
Purpose: {Self-extracting file packer & unpacker.}
Category: [util compress 5]
Needs: [%"Recursive Read.r"]
]
make object! [
Unpacker: [
Rebol [
Name: 'Unpacker
Title: "Self-extracting file unpacker."
Date: (now)
]
Unpack: func [Pack [block!]][
parse Pack [
some [
set File file! set Data binary! (
make paren! [
write/binary File decompress Data
]
)
| set File file! (
make paren! [make-dir/deep File]
)
]
end
]
]
Unpack ; 'Case goes here.
]
set 'Pack function [
{Self-extracting File packer.}
File [file! block!] "File can be directory or block of file!
values."
/Deep "Copy subdirectories as well."
] [
Files Block Directory
] [
append/only compose/deep Unpacker any [
if block? File [
Block: File
map Block func [File [file!]] [
either #"/" = last File [
File
] [
reduce [File compress read/binary File]
]
]
]
if #"/" = last File [
Directory: File
map either Deep [
recursive-read Directory
] [
read Directory
] func [File [file!]] [
either #"/" = last File [
File
] [
reduce [File compress read/binary Directory/:File]
]
]
]
reduce [File compress read/binary File]
]
]
]
Use:
save %Packed.r pack %MyFilesDirectory/
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/9] from: carl:cybercraft at: 9-Jan-2003 14:27
Volker Nitsch:
REBOL [ ...
Andrew Martin:
REBOL [ ...
Do I hear three
? (;
But ... how do we get people to use them? Or to know where to find
them?
RIP (was it called that?) was RT's method, wasn't it? Shouldn't a
packer be in REBOL itself?
--
Carl Read
[5/9] from: nitsch-lists:netcologne at: 9-Jan-2003 10:37
Eeps - my last post uses no /binary, so on windows it will not work with
images.
add them to the 'read 's and 'write 's, i do and test it later.
-volker
Volker Nitsch wrote:
> Carl Read wrote:
>
[snip]
[6/9] from: nitsch-lists:netcologne at: 9-Jan-2003 10:41
Carl Read wrote:
>Volker Nitsch:
> REBOL [ ...
<<quoted lines omitted: 5>>
>RIP (was it called that?) was RT's method, wasn't it? Shouldn't a
>packer be in REBOL itself?
RIP packs as binary AFAIK. that is shorter, but confusing.
browsers think "*.rip? whats that? *shrug* 'that is allways text..".
emailers too, and may look for good places for linebreaks.
also the original unpacks, but does not start something.
mine (to myself: ADD THE /binary everywhere and test!)
saves everything enbased, and wraps to 5-chars or such.
-volker
[7/9] from: nitsch-lists:netcologne at: 9-Jan-2003 10:46
Andrew Martin wrote:
>Carl Read wrote:
>>Sure, sometimes we need to pack script and data together, but isn't their
<<quoted lines omitted: 4>>
>Rebol [
> Name: 'Pack
First! i expect: Andrew, your script does not run, it says something
about "map not found"!
at least i can not find "map:" ;)
oh this awfull good stuffed %user.r :)
[8/9] from: al:bri:xtra at: 10-Jan-2003 8:03
Volker wrote:
> First! i expect: Andrew, your script does not run, it says something about
map not found
!
> at least i can not find "map:" ;)
Ooops! You'll need my %Values.r. It's at:
http://valley.150m.com/Rebol/Values.r
> oh this awfull good stuffed %user.r :)
Just put:
do %../Values/Values.r
in your %User.r file. :) It's far easier! Then one can put nice library
scripts in the %../Values/ directory, and get them automatically loaded into
your Rebol context on every startup. Why not make things difficult by having
to edit one's %User.r for every new script that one wants to use? :)
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[9/9] from: sunandadh:aol at: 9-Jan-2003 14:43
Andrew:
> Ooops! You'll need my %Values.r. It's at:
> http://valley.150m.com/Rebol/Values.r
>
> > oh this awfull good stuffed %user.r :)
Having scripts that build on other functions is a good way to develop code,
but it seems to cause some head-scratching when people pick up a script
without the ones that are needed upstream.
Something to think about: add code like this to the *public* versions of your
scripts
if unset 'map [do http://valley.150m.com/Rebol/Values.r]
Sort of working documentation about pre-requisites.
Sunanda.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted