Skip to content

Commit

Permalink
Merge pull request #271 from asteris-llc/feature/boolean-stuff-mmkay
Browse files Browse the repository at this point in the history
param: accept boolean values
  • Loading branch information
BrianHicks authored Sep 20, 2016
2 parents a5e1402 + d54cf73 commit 9bb2f00
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 141 deletions.
84 changes: 42 additions & 42 deletions docs/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,50 @@
<description>Recent content on Converge</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Fri, 16 Sep 2016 15:32:02 -0500</lastBuildDate>
<lastBuildDate>Mon, 19 Sep 2016 19:45:28 -0500</lastBuildDate>
<atom:link href="http://converge.aster.is/index.xml" rel="self" type="application/rss+xml" />

<item>
<title>param</title>
<link>http://converge.aster.is/resources/param/</link>
<pubDate>Mon, 19 Sep 2016 19:45:28 -0500</pubDate>

<guid>http://converge.aster.is/resources/param/</guid>
<description>

&lt;p&gt;Param controls the flow of values through &lt;code&gt;module&lt;/code&gt; calls. You can use the
&lt;code&gt;{{param &amp;quot;name&amp;quot;}}&lt;/code&gt; template call anywhere you need the value of a param
inside the current module.&lt;/p&gt;

&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-hcl&#34;&gt;param &amp;quot;message&amp;quot; {
default = &amp;quot;Hello, World!&amp;quot;
}

param &amp;quot;filename&amp;quot; {
default = &amp;quot;test.txt&amp;quot;
}

task &amp;quot;render&amp;quot; {
check = &amp;quot;cat {{param `filename`}} | tee /dev/stderr | grep -q &#39;{{param `message`}}&#39;&amp;quot;
apply = &amp;quot;echo &#39;{{param `message`}}&#39; &amp;gt; {{param `filename`}}&amp;quot;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; (anything)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Default is an optional field that provides a default value if none is
provided to this parameter. If this field is not set, this param will be
treated as required.&lt;/p&gt;
</description>
</item>

<item>
<title>user.group</title>
<link>http://converge.aster.is/resources/user-group/</link>
Expand Down Expand Up @@ -574,47 +615,6 @@ the called module as the default values for the &lt;code&gt;param&lt;/code&gt;s
</description>
</item>

<item>
<title>param</title>
<link>http://converge.aster.is/resources/param/</link>
<pubDate>Thu, 08 Sep 2016 23:18:03 -0700</pubDate>

<guid>http://converge.aster.is/resources/param/</guid>
<description>

&lt;p&gt;Param controls the flow of values through &lt;code&gt;module&lt;/code&gt; calls. You can use the
&lt;code&gt;{{param &amp;quot;name&amp;quot;}}&lt;/code&gt; template call anywhere you need the value of a param
inside the current module.&lt;/p&gt;

&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-hcl&#34;&gt;param &amp;quot;message&amp;quot; {
default = &amp;quot;Hello, World!&amp;quot;
}

param &amp;quot;filename&amp;quot; {
default = &amp;quot;test.txt&amp;quot;
}

task &amp;quot;render&amp;quot; {
check = &amp;quot;cat {{param `filename`}} | tee /dev/stderr | grep -q &#39;{{param `message`}}&#39;&amp;quot;
apply = &amp;quot;echo &#39;{{param `message`}}&#39; &amp;gt; {{param `filename`}}&amp;quot;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; (optional string)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Default is an optional field that provides a default value if none is
provided to this parameter. If this field is not set, this param will be
treated as required.&lt;/p&gt;
</description>
</item>

<item>
<title>file.content</title>
<link>http://converge.aster.is/resources/file-content/</link>
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/file-content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ <h2 id="parameters">Parameters</h2>
<nav class="pagination" aria-label="Footer">
<div class="previous">

<a href="http://converge.aster.is/resources/param/" title="param">
<a href="http://converge.aster.is/resources/module/" title="module">
<span class="direction">
Previous
</span>
Expand All @@ -558,7 +558,7 @@ <h2 id="parameters">Parameters</h2>
</div>
<div class="stretch">
<div class="title">
param
module
</div>
</div>
</div>
Expand Down
84 changes: 42 additions & 42 deletions docs/resources/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,50 @@
<description>Recent content in Resources on Converge</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Fri, 16 Sep 2016 15:32:02 -0500</lastBuildDate>
<lastBuildDate>Mon, 19 Sep 2016 19:45:28 -0500</lastBuildDate>
<atom:link href="http://converge.aster.is/resources/index.xml" rel="self" type="application/rss+xml" />

<item>
<title>param</title>
<link>http://converge.aster.is/resources/param/</link>
<pubDate>Mon, 19 Sep 2016 19:45:28 -0500</pubDate>

<guid>http://converge.aster.is/resources/param/</guid>
<description>

&lt;p&gt;Param controls the flow of values through &lt;code&gt;module&lt;/code&gt; calls. You can use the
&lt;code&gt;{{param &amp;quot;name&amp;quot;}}&lt;/code&gt; template call anywhere you need the value of a param
inside the current module.&lt;/p&gt;

&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-hcl&#34;&gt;param &amp;quot;message&amp;quot; {
default = &amp;quot;Hello, World!&amp;quot;
}

param &amp;quot;filename&amp;quot; {
default = &amp;quot;test.txt&amp;quot;
}

task &amp;quot;render&amp;quot; {
check = &amp;quot;cat {{param `filename`}} | tee /dev/stderr | grep -q &#39;{{param `message`}}&#39;&amp;quot;
apply = &amp;quot;echo &#39;{{param `message`}}&#39; &amp;gt; {{param `filename`}}&amp;quot;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; (anything)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Default is an optional field that provides a default value if none is
provided to this parameter. If this field is not set, this param will be
treated as required.&lt;/p&gt;
</description>
</item>

<item>
<title>user.group</title>
<link>http://converge.aster.is/resources/user-group/</link>
Expand Down Expand Up @@ -407,47 +448,6 @@ the called module as the default values for the &lt;code&gt;param&lt;/code&gt;s
</description>
</item>

<item>
<title>param</title>
<link>http://converge.aster.is/resources/param/</link>
<pubDate>Thu, 08 Sep 2016 23:18:03 -0700</pubDate>

<guid>http://converge.aster.is/resources/param/</guid>
<description>

&lt;p&gt;Param controls the flow of values through &lt;code&gt;module&lt;/code&gt; calls. You can use the
&lt;code&gt;{{param &amp;quot;name&amp;quot;}}&lt;/code&gt; template call anywhere you need the value of a param
inside the current module.&lt;/p&gt;

&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-hcl&#34;&gt;param &amp;quot;message&amp;quot; {
default = &amp;quot;Hello, World!&amp;quot;
}

param &amp;quot;filename&amp;quot; {
default = &amp;quot;test.txt&amp;quot;
}

task &amp;quot;render&amp;quot; {
check = &amp;quot;cat {{param `filename`}} | tee /dev/stderr | grep -q &#39;{{param `message`}}&#39;&amp;quot;
apply = &amp;quot;echo &#39;{{param `message`}}&#39; &amp;gt; {{param `filename`}}&amp;quot;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; (optional string)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Default is an optional field that provides a default value if none is
provided to this parameter. If this field is not set, this param will be
treated as required.&lt;/p&gt;
</description>
</item>

<item>
<title>file.content</title>
<link>http://converge.aster.is/resources/file-content/</link>
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/module/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,14 @@ <h2 id="parameters">Parameters</h2>

<div class="next">

<a href="http://converge.aster.is/resources/param/" title="param">
<a href="http://converge.aster.is/resources/file-content/" title="file.content">
<span class="direction">
Next
</span>
<div class="page">
<div class="stretch">
<div class="title">
param
file.content
</div>
</div>
<div class="button button-next" role="button" aria-label="Next">
Expand Down
22 changes: 3 additions & 19 deletions docs/resources/param/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ <h2 id="example">Example</h2>
<h2 id="parameters">Parameters</h2>

<ul>
<li><code>default</code> (optional string)</li>
<li><code>default</code> (anything)</li>
</ul>

<p>Default is an optional field that provides a default value if none is
Expand All @@ -546,34 +546,18 @@ <h2 id="parameters">Parameters</h2>
<nav class="pagination" aria-label="Footer">
<div class="previous">

<a href="http://converge.aster.is/resources/module/" title="module">
<span class="direction">
Previous
</span>
<div class="page">
<div class="button button-previous" role="button" aria-label="Previous">
<i class="icon icon-back"></i>
</div>
<div class="stretch">
<div class="title">
module
</div>
</div>
</div>
</a>

</div>

<div class="next">

<a href="http://converge.aster.is/resources/file-content/" title="file.content">
<a href="http://converge.aster.is/resources/user-group/" title="user.group">
<span class="direction">
Next
</span>
<div class="page">
<div class="stretch">
<div class="title">
file.content
user.group
</div>
</div>
<div class="button button-next" role="button" aria-label="Next">
Expand Down
16 changes: 16 additions & 0 deletions docs/resources/user-group/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,22 @@ <h2 id="parameters">Parameters</h2>
<nav class="pagination" aria-label="Footer">
<div class="previous">

<a href="http://converge.aster.is/resources/param/" title="param">
<span class="direction">
Previous
</span>
<div class="page">
<div class="button button-previous" role="button" aria-label="Previous">
<i class="icon icon-back"></i>
</div>
<div class="stretch">
<div class="title">
param
</div>
</div>
</div>
</a>

</div>

<div class="next">
Expand Down
12 changes: 6 additions & 6 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

<url>
<loc>http://converge.aster.is/</loc>
<lastmod>2016-09-16T15:32:02-05:00</lastmod>
<lastmod>2016-09-19T19:45:28-05:00</lastmod>
</url>

<url>
<loc>http://converge.aster.is/resources/param/</loc>
<lastmod>2016-09-19T19:45:28-05:00</lastmod>
</url>

<url>
Expand Down Expand Up @@ -46,11 +51,6 @@
<lastmod>2016-09-08T23:18:03-07:00</lastmod>
</url>

<url>
<loc>http://converge.aster.is/resources/param/</loc>
<lastmod>2016-09-08T23:18:03-07:00</lastmod>
</url>

<url>
<loc>http://converge.aster.is/resources/file-content/</loc>
<lastmod>2016-09-08T23:18:02-07:00</lastmod>
Expand Down
4 changes: 2 additions & 2 deletions docs_source/content/resources/param.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "param"
slug: "param"
date: "2016-09-08T23:18:03-07:00"
date: "2016-09-19T19:45:54-05:00"
menu:
main:
parent: resources
Expand Down Expand Up @@ -34,7 +34,7 @@ task "render" {

## Parameters

- `default` (optional string)
- `default` (anything scalar)

Default is an optional field that provides a default value if none is
provided to this parameter. If this field is not set, this param will be
Expand Down
2 changes: 1 addition & 1 deletion load/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ param x {
preparer, ok := item.(*param.Preparer)

require.True(t, ok, fmt.Sprintf("preparer was %T, not *param.Preparer", item))
assert.Equal(t, "default", *preparer.Default)
assert.Equal(t, "default", preparer.Default)
}

func TestSetResourcesModules(t *testing.T) {
Expand Down
8 changes: 2 additions & 6 deletions render/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestRenderParam(t *testing.T) {
g := graph.New()
g.Add("root", nil)
g.Add("root/file.content.x", &content.Preparer{Destination: "{{param `destination`}}"})
g.Add("root/param.destination", &param.Preparer{Default: newDefault("1")})
g.Add("root/param.destination", &param.Preparer{Default: "1"})

g.ConnectParent("root", "root/file.content.x")
g.ConnectParent("root", "root/param.destination")
Expand All @@ -82,7 +82,7 @@ func TestRenderValues(t *testing.T) {
g := graph.New()
g.Add("root", nil)
g.Add("root/file.content.x", &content.Preparer{Destination: "{{param `destination`}}"})
g.Add("root/param.destination", &param.Preparer{Default: newDefault("1")})
g.Add("root/param.destination", &param.Preparer{Default: "1"})

g.ConnectParent("root", "root/file.content.x")
g.ConnectParent("root", "root/param.destination")
Expand All @@ -101,7 +101,3 @@ func TestRenderValues(t *testing.T) {

assert.Equal(t, "2", content.Destination)
}

func newDefault(x string) *string {
return &x
}
Loading

0 comments on commit 9bb2f00

Please sign in to comment.