... sorting out dependencies... and you seem to have decided to skip that feature for this tool.

Actually, I've since added dependencies. If a target includes another target, that target is built first, etc. Also, it checks whether the output target (the file you want to create) is up-to-date, saving a rebuild if it's unnecessary.

Speaking of the Make idiom, one thing I particularly like, besides dependency chains, is the idea of targets, if for no other reason than the way in which it presents the organization of your content. Target dev includes section secure_password, and also target verbose_feedback, etc. This seems like a very simple and clear way to state things. Not only that, but it provides an intuitive and simple way to output sections in many configurations -- e.g. one section in many targets, one section for a specific target, one section as the target.

As to your code example, replacing a value like $password is simple enough with templates, but I think Plake wins if you need to omit part of the content entirely, simply because with Plake this behavior is inherent via targets. Let's say you have an experimental section of code that works, but that doesn't belong (yet) in your distro, or you have some functionality that is reserved for a certain set of people (premiere clients!).

my $target = shift; my $password; if ($target eq 'premiere') { $password = 'change me'; $extra_functionality = # Rendered from template call, or # should do_build() handle this? } elsif ($target eq 'dev') { $password = 'dev password'; $experimental_features = # Load from the template } else { # default $password = 'change me'; } do_build( $password, $extra_functionality, $experimental_features );

With Plake, these are created with a single, simple target setup.

target('dev', 'default_code experimentals secure_pwd', ''); target('premiere', 'default_code extras standard_pwd', '');

You have more power using templates, to be sure, but with the added cost of complexity. Plake was intended for a specific thing -- assembly based on targets -- and tries to simplify and reduce the work involved for that particular thing. (Sort of like Make.)

Update: As I continued to think about this, it dawned on me -- if you were to continue enhancing your template-based Perl script above, you would eventually have to deal with all the things that Plake already does, i.e. sticking sections together in a useful way, dependencies, etc. After you handled these issues, you would have a duplicate of Plake, based on a template system (at least if you decided to abstract your script so you could use it some other time). I had considered using templates at one point, but in the end felt like it was more than was required. So, I guess, my original statement was correct. Template systems don't answer for a build tool, which is what Plake is.

A blog among millions.

In reply to Re^4: RFC: Plake, a target-based file assembler by arbingersys
in thread RFC: Plake, a target-based file assembler by arbingersys

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.