<html><head><title>Footprintless::Overlay</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >

<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
BODY {
  background: white;
  color: black;
  font-family: arial,sans-serif;
  margin: 0;
  padding: 1ex;
}

A:link, A:visited {
  background: transparent;
  color: #006699;
}

A[href="#POD_ERRORS"] {
  background: transparent;
  color: #FF0000;
}

DIV {
  border-width: 0;
}

DT {
  margin-top: 1em;
  margin-left: 1em;
}

.pod { margin-right: 20ex; }

.pod PRE     {
  background: #eeeeee;
  border: 1px solid #888888;
  color: black;
  padding: 1em;
  white-space: pre;
}

.pod H1      {
  background: transparent;
  color: #006699;
  font-size: large;
}

.pod H1 A { text-decoration: none; }
.pod H2 A { text-decoration: none; }
.pod H3 A { text-decoration: none; }
.pod H4 A { text-decoration: none; }

.pod H2      {
  background: transparent;
  color: #006699;
  font-size: medium;
}

.pod H3      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-style: italic;
}

.pod H4      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-weight: normal;
}

.pod IMG     {
  vertical-align: top;
}

.pod .toc A  {
  text-decoration: none;
}

.pod .toc LI {
  line-height: 1.2em;
  list-style-type: none;
}

  /*]]>*/-->
</style>


</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.32,
  using Pod::Simple::PullParser v3.32,
  under Perl v5.025000 at Wed Aug 22 21:48:31 2018 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#VERSION'>VERSION</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#ENTITIES'>ENTITIES</a>
  <li class='indexItem indexItem1'><a href='#CONSTRUCTORS'>CONSTRUCTORS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#new(%24entity%2C_%24coordinate)'>new($entity, $coordinate)</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#clean()'>clean()</a>
    <li class='indexItem indexItem2'><a href='#initialize()'>initialize()</a>
    <li class='indexItem indexItem2'><a href='#update()'>update()</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
  <li class='indexItem indexItem1'><a href='#COPYRIGHT_AND_LICENSE'>COPYRIGHT AND LICENSE</a>
  <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a>
  <li class='indexItem indexItem1'><a href='#CONFIGURATION'>CONFIGURATION</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Footprintless::Overlay - An overlay manager</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="VERSION"
>VERSION</a></h1>

<p>version 1.29</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<pre>    # Standard way of getting an overlay
    use Footprintless;
    my $overlay = Footprintless-&#62;new()-&#62;overlay(&#39;overlay&#39;);

    $overlay-&#62;clean();

    $overlay-&#62;initialize();

    $overlay-&#62;update();</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>Overlays are a combination of a directory of static files and a directory of templated files that will be merged to an output directory. This is implemented in <a href="http://search.cpan.org/perldoc?Template%3A%3AOverlay" class="podlinkpod"
>Template::Overlay</a>.</p>

<p>Additionally, any folder under the <code>template_dir</code> can contain a <code>.footprintless</code> file containing a <code>clean</code> and/or <code>resources</code> entities:</p>

<pre>    return {
        clean =&#62; [
            &#39;foo.jar&#39;,
            &#39;bar.jar&#39;,
            &#39;ext/&#39;
        ],
        resources =&#62; {
            foo =&#62; &#39;com.pastdev:foo:1.0.0&#39;,
            bar =&#62; &#39;com.pastdev:bar:1.0.0&#39;
        }
    };</pre>

<p>The <code>clean</code> entity is an arrayref containing a list of paths to clean out. These paths will be added to the path of the directory containing the <code>.footprintless</code> file. The <code>resources</code> entity is a list of resources to download into the same directory as the <code>.footprintless</code> file.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="ENTITIES"
>ENTITIES</a></h1>

<p>A simple overlay:</p>

<pre>    overlay =&#62; {
        base_dir =&#62; &#34;/home/me/foo/base&#34;,
        clean =&#62; [
            &#34;/opt/tomcat/&#34;
        ],
        hostname =&#62; &#39;localhost&#39;,
        key =&#62; &#39;T&#39;,
        os =&#62; &#39;linux&#39;,
        template_dir =&#62; &#34;/home/me/foo/template&#34;,
        to_dir =&#62; &#39;/opt/foo/tomcat&#39;
    }</pre>

<p>A more complex example:</p>

<pre>    foo =&#62; {
        hostname =&#62; &#39;test.pastdev.com&#39;,
        overlay =&#62; {
            &#39;Config::Entities::inherit&#39; =&#62; [&#39;hostname&#39;, &#39;sudo_username&#39;],
            base_dir =&#62; &#39;/home/me/foo/base&#39;,
            clean =&#62; [
                &#39;/opt/foo/tomcat/&#39;
            ],
            key =&#62; &#39;T&#39;,
            os =&#62; &#39;linux&#39;,
            resolver_coordinate =&#62; &#39;foo&#39;,
            template_dir =&#62; &#39;/home/me/foo/template&#39;,
            to_dir =&#62; &#39;/opt/foo/tomcat&#39;
        },
        sudo_username =&#62; &#39;developer&#39;,
        tomcat =&#62; {
            &#39;Config::Entities::inherit&#39; =&#62; [&#39;hostname&#39;, &#39;sudo_username&#39;],
            catalina_base =&#62; &#39;/opt/foo/tomcat&#39;,
            http =&#62; {
                port =&#62; 20080
            },
            service =&#62; {
                action =&#62; {
                    &#39;kill&#39; =&#62; { command_args =&#62; &#39;stop -force&#39; },
                    &#39;status&#39; =&#62; { use_pid =&#62; 1 }
                },
                command =&#62; &#39;/opt/foo/tomcat/bin/catalina.sh&#39;,
                pid_file =&#62; &#39;/opt/foo/tomcat/bin/.catalina.pid&#39;,
            },
            shutdown =&#62; {
                port =&#62; 8505,
                password =&#62; $properties-&#62;{&#39;foo.tomcat.shutdown.password&#39;},
            },
            trust_store =&#62; {
                &#39;Config::Entities::inherit&#39; =&#62; [&#39;hostname&#39;, &#39;sudo_username&#39;],
                file =&#62; &#39;/opt/foo/tomcat/certs/truststore.jks&#39;,
                include_java_home_cacerts =&#62; 1,
                password =&#62; $properties-&#62;{&#39;foo.tomcat.trust_store.password&#39;},
            }
        }
    }</pre>

<p>An overlay can obtain base/template content from a resource. When initialize or update are called, the resource will be downloaded (if not already local) and extracted to a temp folder. The <code>base_dir</code> and <code>template_dir</code> paths will be appended to the extract temp folder:</p>

<pre>    overlay =&#62; {
        base_dir =&#62; &#39;base&#39;,
        clean =&#62; [
            &#39;/opt/tomcat/&#39;
        ],
        hostname =&#62; &#39;localhost&#39;,
        key =&#62; &#39;T&#39;,
        os =&#62; &#39;linux&#39;,
        resource =&#62; &#39;com.pastdev:app-overlay:zip:package:1.0.0&#39;,
        template_dir =&#62; &#39;template&#39;,
        to_dir =&#62; &#39;/opt/foo/tomcat&#39;
    }</pre>

<p>An overlay can have multiple template folders. If it does, they will be processed in the order they are listed:</p>

<pre>    overlay =&#62; {
        base_dir =&#62; &#39;base&#39;,
        clean =&#62; [
            &#39;/opt/tomcat/&#39;
        ],
        hostname =&#62; &#39;localhost&#39;,
        key =&#62; &#39;T&#39;,
        os =&#62; &#39;linux&#39;,
        template_dir =&#62; [
            &#39;first/template_dir&#39;,
            &#39;second/template_dir&#39;,
        ],
        to_dir =&#62; &#39;/opt/foo/tomcat&#39;
    }</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="CONSTRUCTORS"
>CONSTRUCTORS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="new($entity,_$coordinate)"
>new($entity, $coordinate)</a></h2>

<p>Constructs a new overlay configured by <code>$entities</code> at <code>$coordinate</code>.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="METHODS"
>METHODS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="clean()"
>clean()</a></h2>

<p>Cleans the overlay. Each path in the <code>clean</code> entity, will be removed from the destination. If the path ends in a <code>/</code>, then after being removed, the directory will be recreated.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="initialize()"
>initialize()</a></h2>

<p>Will call <code>clean</code>, then <code>overlay</code> on an instance of <a href="http://search.cpan.org/perldoc?Template%3A%3AOverlay" class="podlinkpod"
>Template::Overlay</a> configured to this entity.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="update()"
>update()</a></h2>

<p>Will overlay <i>ONLY</i> the templated files. It will not <code>clean</code>, nor copy any files from <code>base_dir</code> like <code>initialize</code> does.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>Lucas Theisen &#60;lucastheisen@pastdev.com&#62;</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_AND_LICENSE"
>COPYRIGHT AND LICENSE</a></h1>

<p>This software is copyright (c) 2016 by Lucas Theisen.</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SEE_ALSO"
>SEE ALSO</a></h1>

<p>Please see those modules/websites for more information related to this module.</p>

<ul>
<li><a href="http://search.cpan.org/perldoc?Footprintless" class="podlinkpod"
>Footprintless</a></li>

<li><a href="http://search.cpan.org/perldoc?Config%3A%3AEntities" class="podlinkpod"
>Config::Entities</a></li>

<li><a href="http://search.cpan.org/perldoc?Footprintless" class="podlinkpod"
>Footprintless</a></li>

<li><a href="http://search.cpan.org/perldoc?Footprintless%3A%3AMixins" class="podlinkpod"
>Footprintless::Mixins</a></li>

<li><a href="http://search.cpan.org/perldoc?Template%3A%3AOverlay" class="podlinkpod"
>Template::Overlay</a></li>

<li><a href="http://search.cpan.org/perldoc?Template%3A%3AResolver" class="podlinkpod"
>Template::Resolver</a></li>
</ul>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="CONFIGURATION"
>CONFIGURATION</a></h1>

<p>This module can optionally be configured to use a customized resolver. To do so, configure a resolver factory in your entities:</p>

<pre>    footprintless =&#62; {
        overlay =&#62; {
            resolver_factory =&#62; &#39;My::ResolverFactory&#39;
        }
    }</pre>

<p>The resolver factory must have a <code>new_resolver</code> method that takes a spec and a list of options and returns a <code>Template::Resolver</code>, for example:</p>

<pre>    sub new_resolver {
        my ($self, $resolver_spec, %resolver_opts) = @_;
        return Template::Resolver-&#62;new(
            $resolver_spec,
            %resolver_opts,
            additional_transforms =&#62; {
                random =&#62; sub {
                    my ($resolver_self, $value) = @_;
                    return $value . rand();
                }
            });
    }</pre>

<!-- end doc -->

</body></html>