Skip to content

Commit 6672a4c

Browse files
committed
Auto update version number on home page
Provide a new template and helper function to be used for generating the home page. Previously, someone would have to manually update the version number that is displayed on the home page. Resolves: #192
1 parent e6b22f5 commit 6672a4c

File tree

6 files changed

+202
-15
lines changed

6 files changed

+202
-15
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ guides/
1010
!doc/guides/
1111
site/node_modules/
1212
!site/lib/
13-
!site/**/lib/
13+
!site/**/lib/
14+
static
15+
index.html

documentjs.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@
1515
},
1616
"parent": "Guides",
1717
"pageConfig": {"page":"guides"}
18+
},
19+
"funcunit": {
20+
"glob": {
21+
"pattern": "funcunit.md"
22+
},
23+
"templates": "main"
1824
}
1925
},
2026
"siteDefaults": {
2127
"static":"site/theme/static",
2228
"templates": "site/theme/templates"
2329
}
24-
}
30+
}

funcunit.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@page funcunit FuncUnit
2+
3+
@body

index.html

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<title>FuncUnit</title>
2121
<meta name="description" content="">
2222
<meta name="author" content="">
23-
<link rel="shortcut icon" type="image/png" href="guides/static/img/funcunit-logo-32x32.png">
23+
<link rel="shortcut icon" type="image/png" href="static/img/funcunit-logo-32x32.png">
2424

25-
<link rel="stylesheet" type="text/css" href='./guides/static/bundles/static.css'/>
25+
<link rel="stylesheet" type="text/css" href='static/bundles/static.css'/>
2626

2727
<!--[if lt IE 9]>
2828
<script type="text/javascript" src="site/app/lib/html5shiv.js"></script>
@@ -73,20 +73,14 @@
7373
</nav>
7474
</header>
7575

76-
77-
78-
79-
80-
81-
8276
<div class="hero">
8377
<div class="container">
8478
<span class="hero-background iconNew-fu-logo-icon"></span>
8579
<div id="hero-download" class="pull-right">
8680
<h1>Write better tests, faster.</h1>
8781

88-
<a href="https://raw.githubusercontent.com/bitovi/funcunit/v3.1.0/dist/funcunit.js" download="funcunit.js">
89-
<button class="download">Download 3.1.0<span>(One file. Everything you need.)</span></button>
82+
<a href="https://raw.githubusercontent.com/bitovi/funcunit/v3.2.0/dist/funcunit.js" download="funcunit.js">
83+
<button class="download">Download 3.2.0<span>(One file. Everything you need.)</span></button>
9084
</a>
9185
</div>
9286

@@ -139,7 +133,7 @@ <h1>Get Started</h1>
139133
<h2>You'll be up and running in no time</h2>
140134
<ul class="wizard">
141135
<li class="download"><a href="https://raw.githubusercontent.com/bitovi/funcunit/v3.1.0/dist/funcunit.js" download="funcunit.js">Download</a></li>
142-
<li class="guide"><a href="/guides/index.html">Read the Guide</a></li>
136+
<li class="guide"><a href="guides/index.html">Read the Guide</a></li>
143137
<li>Superpower your Tests!</li>
144138
</ul>
145139
</div>
@@ -171,8 +165,8 @@ <h2>You'll be up and running in no time</h2>
171165
<!-- <script src="/node_modules/steal/steal.js" config="site/package.json!npm"></script> -->
172166

173167
<!-- Production mode -->
174-
<script src="./site/static/app/app.js" config="../../package.json!npm" base-url='../../'></script>
168+
<script src="site/static/app/app.js" config="../../package.json!npm" base-url='../../'></script>
175169

176170
</body>
177171

178-
</html>
172+
</html>

main/helpers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const fs = require("fs");
2+
3+
module.exports = function(docMap, options, getCurrent){
4+
return {
5+
"getVersion" : function(){
6+
const package = fs.readFileSync(process.cwd() + '/package.json', 'utf8');
7+
return JSON.parse(package).version;
8+
}
9+
}
10+
};

main/layout.mustache

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<!DOCTYPE html>
2+
3+
<!--[if lt IE 7]>
4+
<html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="en">
5+
<![endif]-->
6+
<!--[if IE 7]>
7+
<html class="no-js ie lt-ie9 lt-ie8" lang="en">
8+
<![endif]-->
9+
<!--[if IE 8]>
10+
<html class="no-js ie lt-ie9" lang="en">
11+
<![endif]-->
12+
<!--[if IE 9]>
13+
<html class="no-js ie ie9" lang="en">
14+
<![endif]-->
15+
<!--[if gt IE 9]><!-->
16+
<html class="no-js" lang="en">
17+
<!--<![endif]-->
18+
<head>
19+
<meta charset="utf-8">
20+
<title>FuncUnit</title>
21+
<meta name="description" content="">
22+
<meta name="author" content="">
23+
<link rel="shortcut icon" type="image/png" href="static/img/funcunit-logo-32x32.png">
24+
25+
<link rel="stylesheet" type="text/css" href='static/bundles/static.css'/>
26+
27+
<!--[if lt IE 9]>
28+
<script type="text/javascript" src="site/app/lib/html5shiv.js"></script>
29+
<!--<![endif]-->
30+
</head>
31+
32+
<body class="">
33+
<header>
34+
<nav class="container">
35+
36+
<div class="logo-menu">
37+
<a class="brand funcunit" href="index.html">FuncUnit</a>
38+
<ul class="dropdown-menu">
39+
<li><a href="http://donejs.com">DoneJS</a></li>
40+
<li><a href="http://javascriptmvc.com">JavaScriptMVC</a></li>
41+
<li><a href="http://canjs.com">CanJS</a></li>
42+
<li><a href="http://jquerypp.com">jQuery++</a></li>
43+
<li><a href="http://stealjs.com">StealJS</a></li>
44+
<li class="active"><a href="index.html">FuncUnit</a></li>
45+
<li><a href="http://documentjs.com">DocumentJS</a></li>
46+
</ul>
47+
</div>
48+
<ul class="nav">
49+
<li class="active">
50+
<a href="index.html">Home</a>
51+
</li>
52+
<li class="guides"><a href="guides/index.html">Guides</a></li>
53+
<li class="docs"><a href="docs/index.html">API</a></li>
54+
<li class="community"><a href="https://github.com/bitovi/funcunit" target="_blank">GitHub</a></li>
55+
<li class="chat"><a href="https://gitter.im/bitovi/funcunit" target="_blank">Chat</a></li>
56+
<li class="forum"><a href="http://forums.donejs.com/c/testing" target="_blank">Forums</a></li>
57+
</ul>
58+
<div class="pull-right">
59+
<div class="bitovi-menu">
60+
<a href="http://bitovi.com" class="bitovi icon-bits">Bitovi</a>
61+
<ul class="dropdown-menu">
62+
<li><a href="http://bitovi.com">Bitovi.com</a></li>
63+
<li><a href="http://bitovi.com/blog">Blog</a></li>
64+
<li><a href="http://bitovi.com/design">Design</a></li>
65+
<li><a href="http://bitovi.com/development">Development</a></li>
66+
<li><a href="http://bitovi.com/training">Training</a></li>
67+
<li><a href="http://bitovi.com/open-source">Open Source</a></li>
68+
<li><a href="http://bitovi.com/about">About</a></li>
69+
<li><a href="http://bitovi.com/contact">Contact Us</a></li>
70+
</ul>
71+
</div>
72+
</div>
73+
</nav>
74+
</header>
75+
76+
<div class="hero">
77+
<div class="container">
78+
<span class="hero-background iconNew-fu-logo-icon"></span>
79+
<div id="hero-download" class="pull-right">
80+
<h1>Write better tests, faster.</h1>
81+
82+
<a href="https://raw.githubusercontent.com/bitovi/funcunit/v{{getVersion}}/dist/funcunit.js" download="funcunit.js">
83+
<button class="download">Download {{getVersion}}<span>(One file. Everything you need.)</span></button>
84+
</a>
85+
</div>
86+
87+
</div>
88+
</div>
89+
90+
<div class="content">
91+
<div class="container benefits">
92+
<h1>Superpower your tests</h1>
93+
94+
<p>FuncUnit enhances assertion libraries like QUnit and Jasmine, enabling them to simulate user actions, easily test asynchronous behavior, and support black box testing. Use its terse jQuery-like syntax to superpower your functional or unit tests.</p>
95+
96+
</div>
97+
98+
<div class="container twitter">
99+
100+
<a href="https://twitter.com/funcunit" class="twitter-follow-button" data-show-count="true" data-dnt="true">Follow @funcunit</a>
101+
102+
103+
</div>
104+
105+
<div class="dark social">
106+
<div class="container">
107+
<iframe src="https://ghbtns.com/github-btn.html?user=bitovi&repo=funcunit&type=watch&count=true"
108+
allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
109+
110+
<iframe src="https://ghbtns.com/github-btn.html?user=bitovi&repo=funcunit&type=fork&count=true"
111+
allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
112+
</div>
113+
</div>
114+
115+
<div class="container example">
116+
<h1>It's This Easy</h1>
117+
118+
<ul class="navigation">
119+
<li class="header">Pick a Test Runner:</li>
120+
<li class="tab selected">QUnit</li>
121+
<li class="tab">Jasmine</li>
122+
</ul>
123+
124+
<div class="content"></div>
125+
126+
<input type="button" class="runner" value="Run Tests"/>
127+
</div>
128+
129+
<div class="color get-started">
130+
<div class="container">
131+
<h1>Get Started</h1>
132+
133+
<h2>You'll be up and running in no time</h2>
134+
<ul class="wizard">
135+
<li class="download"><a href="https://raw.githubusercontent.com/bitovi/funcunit/v3.1.0/dist/funcunit.js" download="funcunit.js">Download</a></li>
136+
<li class="guide"><a href="guides/index.html">Read the Guide</a></li>
137+
<li>Superpower your Tests!</li>
138+
</ul>
139+
</div>
140+
</div>
141+
</div>
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
<footer>
154+
<nav class="container">
155+
<a class="brand javascriptmvc" href="index.html"></a>
156+
<ul class="nav">
157+
<li class="guides"><a href="guides/index.html">Guides</a></li>
158+
<li class="docs"><a href="docs/index.html">API</a></li>
159+
<li class="community"><a href="https://github.com/bitovi/funcunit">GitHub</a></li>
160+
</ul>
161+
</nav>
162+
</footer>
163+
164+
<!-- Dev mode -->
165+
<!-- <script src="/node_modules/steal/steal.js" config="site/package.json!npm"></script> -->
166+
167+
<!-- Production mode -->
168+
<script src="site/static/app/app.js" config="../../package.json!npm" base-url='../../'></script>
169+
170+
</body>
171+
172+
</html>

0 commit comments

Comments
 (0)