:python ____ ____ ____ |
@____ @____ @ ____ @ ____ |
var = `____` |
... | :eval ____ |
For further details, may have a look at user-python.html.
For how to use AAP variables in python blocks: Chapter
Using
Aap variables in Python
About indenting in AAP (see also Line Syntax Chapter):
some_user_var = some text here bla bla files = ./index.php ./images/header.jpg ./favicon.icois the same as:
some_user_var = some text here bla bla files = ./index.php ./images/header.jpg ./favicon.ico
@print "a very long long long... \ broken python line"
:rule %.html : htmlbegin.part header.part %.part htmlend.part :print something # <- code begins here :cat $source >! $(target)is the same as:
:rule %.html : htmlbegin.part header.part %.part htmlend.part :print something # <- code begins here :cat $source >! $(target)
simple recipe with AAP, copying files (normally someone should better use the built-in :copy instead of :sys cp)
all : file1 file2 :sys cp $source ./any_target_dir/
That will constantly copy all the files. That is, because `all' is a Virtual Target, and they get always built. Also it's the default target: aap <=> aap all
So the trick is to explicitly putting the sources and target files next to each other to create a proper dependency (here I use the built-in :copy command):
target_dir = any_dir/another_dir all : $target_dir/file1 $target_dir/file2 #list of files to be 'done' $target_dir/file1 : file1 #any_dir/another_dir/file1 depends on ./file1 :copy $source $target_dir $target_dir/file2 : file2 #any_dir/another_dir/file1 depends on ./file1 :copy $source $target_dir
That works now (only copies when the source file got changed or when the target file got deleted).
When you want to copy things to the net.
target_dir = ftp://username:password@server/folder all : $target_dir/file1 $target_dir/file2 $target_dir/file1 : file1 :sys curl -T $source $(target_dir)/ $target_dir/file2 : file2 :sys curl -T $source $(target_dir)/
That actually works too, when you have an app --version > 1.080 or so.
You just need to 'flag' your files with it, including providing the publish attribute the url, where/how actually it has to publish:
:attr {publish = ftp://user@ftp.foo.org/folder/%file%} file1 file2 :publish file1 file2
The %file% gets 'replaced' for each item after the { } construct. Well, that's the way you attribute files in AAP :) (There is also the `%basename%' item, what actually trims any folder in front of the file(s) (e.g. the basename of /home/calmar/tmp/file1 is file1)).
Now a
aap publish
will update the remote files.
With vim and lftp, I was able to update changed files in a very fast manner. Out of vim:
:w <CR> Ctrl-z k (lftp history) <CR> fg <CR> (back in vim)
That took about 2 seconds for each file, what is good
I think,
but with AAP I can open many files in vim, work on
them, and executing AAP (e.g. :!aap within vim). That's
faster and less typing, and with much more
potential power.
In fact, I actually use this vim setting:
au FileType xhtml,html,php map <F9> :update<CR>:!aap<CR>
When you already have your project up-to-date, you may just want AAP to create the sign files instead of building/copying/publishing the files really. You can use the -t (--touch) switch for that (aap --help). Workes nicely.
With vim and AAP together, it would even be possible to create some webpage-modifications on M$-Win, without having to suffer so much - less need for a ftp-GUI-mouse prog. (very suitable for MS-Win, I mean)
:progsearch BROWSER elinks lynx opera @if BROWSER: :sys {interactive} $BROWSER readme.html
text = some_string :cat file | :eval string.replace(stdin, '@MACRO@', _no.text) >! file.outHere the @MACRO@ string in your file, gets replaced with the $text variable. Infos about the >!, see near the end chapter Common arguments for Commands.
May send comments to: mac@calmar.ws, thanks!