Browse Source

Gradle and maven snippets can be externalised

* Maven templates go in _includes/maven_{dependency,repository}.xml
* Gradle templates go in _includes/gradle_{dependency,repository}.gradle

Example maven_dependency.xml

    <dependency>
        <groupId>{@= groupId @}</groupId>
        <artifactId>{@= artifactId @}</artifactId>
        <version>{@= version @}</version>
    </dependency>

[#55283992]
pull/33/merge
Dave Syer and Nick Street 13 years ago
parent
commit
7773266a3a
  1. 103
      _includes/widgets.html
  2. 8
      js/application.js
  3. 26
      js/test/lib/jasmine-1.3.1/jasmine-html.js
  4. 12
      js/test/lib/jasmine-1.3.1/jasmine.js
  5. 8
      js/test/spec/QuickStartWidgetSpec.js

103
_includes/widgets.html

@ -1,25 +1,25 @@ @@ -1,25 +1,25 @@
<script type="text/html" id="project-documentation-widget-template">
<div class="right-pane-widget--container no-top-border project-documentation--container">
<div class="item-dropdown-widget">
<div class="item-dropdown--title"><%= name %></div>
<div class="item-dropdown--title">{@= name @}</div>
<div class="item--dropdown">
<div class="item--body">
<div class="item--body-title">
<div class="item--left-column">Release</div>
<div class="item--right-column">Documentation</div>
</div>
<% _.each(releases, function(release) { %>
{@ _.each(releases, function(release) { @}
<div class="item--body--version">
<div class="item--left-column">
<p><%= release.fullName %></p>
<div class="spring-icon <%= release.statusIconClass() %>"></div>
<p>{@= release.version @}</p>
<div class="spring-icon {@= release.statusIconClass() @}"></div>
</div>
<div class="item--right-column">
<a href='<%= release.refDocUrl %>' class="docs-link reference-link">Reference</a>
<a href='<%= release.apiDocUrl %>' class="docs-link api-link">API</a>
<a href='{@= release.refDocUrl @}' class="docs-link reference-link">Reference</a>
<a href='{@= release.apiDocUrl @}' class="docs-link api-link">API</a>
</div>
</div>
<% }); %>
{@ }); @}
</div>
</div>
</div>
@ -29,9 +29,9 @@ @@ -29,9 +29,9 @@
<script type="text/html" id="project-quickstart-controls-template">
<div class="js-quickstart-selector">
<select class='selector selectpicker'>
<% _.each(releases, function(release, index) { %>
<option value="<%= index %>" data-content="<span><%= release.shortName %></span><div class='spring-icon <%= release.statusIconClass() %>'/>"> ()</option>
<% }); %>
{@ _.each(releases, function(release, index) { @}
<option value="{@= index @}" data-content="<span>{@= release.versionDisplayName @}</span><div class='spring-icon {@= release.statusIconClass() @}'/>"> ()</option>
{@ }); @}
</select>
</div>
@ -52,32 +52,71 @@ @@ -52,32 +52,71 @@
</script>
<script type="text/html" id="project-quickstart-maven-widget-dependency-template">&lt;dependency&gt;
&lt;groupId&gt;<%= groupId %>&lt;/groupId&gt;
&lt;artifactId&gt;<%= artifactId %>&lt;/artifactId&gt;
&lt;version&gt;<%= fullName %>&lt;/version&gt;
&lt;/dependency&gt;
</script>
<script type="text/html" id="project-quickstart-maven-widget-repository-template">
&lt;repository&gt;
&lt;id&gt;<%= id %>&lt;/id&gt;
&lt;name&gt;<%= name %>&lt;/name&gt;
&lt;url&gt;<%= url %>&lt;/url&gt;
&lt;snapshots&gt;
&lt;enabled&gt;<%= snapshotsEnabled %>&lt;/enabled&gt;
&lt;/snapshots&gt;
&lt;/repository&gt;
</script>
<script type="text/html" id="project-quickstart-gradle-widget-dependency-template">dependencies {
compile '<%= groupId %>:<%= artifactId %>:<%= fullName %>'
{% capture maven_dependency %}
{% include maven_dependency.xml %}
{% endcapture %}
{%if maven_dependency contains 'not found in _includes directory' %}
{% capture maven_dependency %}
<dependency>
<groupId>{@= groupId @}</groupId>
<artifactId>{@= artifactId @}</artifactId>
<version>{@= version @}</version>
</dependency>
{% endcapture %}
{% endif %}
<script type="text/html" id="project-quickstart-maven-widget-dependency-template">{{ maven_dependency | escape }}</script>
{% capture maven_repository %}
{% include maven_repository.xml %}
{% endcapture %}
{%if maven_repository contains 'not found in _includes directory' %}
{% capture maven_repository %}
<repository>
<id>{@= id @}</id>
<name>{@= name @}</name>
<url>{@= url @}</url>
<snapshots>
<enabled>{@= snapshotsEnabled @}</enabled>
</snapshots>
</repository>
{% endcapture %}
{% endif %}
<script type="text/html" id="project-quickstart-maven-widget-repository-template">{{ maven_repository | escape }}</script>
{% capture gradle_dependency %}
{% include gradle_dependency.gradle %}
{% endcapture %}
{%if gradle_dependency contains 'not found in _includes directory' %}
{% capture gradle_dependency %}
dependencies {
compile '{@= groupId @}:{@= artifactId @}:{@= version @}'
}
</script>
<script type="text/html" id="project-quickstart-gradle-widget-repository-template">repositories {
{% endcapture %}
{% endif %}
<script type="text/html" id="project-quickstart-gradle-widget-dependency-template">{{ gradle_dependency | escape }}</script>
{% capture gradle_repository %}
{% include gradle_repository.gradle %}
{% endcapture %}
{%if gradle_repository contains 'not found in _includes directory' %}
{% capture gradle_repository %}
repositories {
maven {
url '<%= url %>'
url '{@= url @}'
}
}
</script>
{% endcapture %}
{% endif %}
<script type="text/html" id="project-quickstart-gradle-widget-repository-template">{{ gradle_repository | escape }}</script>
<script type="text/html" id="project-quickstart-zip-widget-dependency-template">
This is a zip url
</script>

8
js/application.js

@ -1,3 +1,11 @@ @@ -1,3 +1,11 @@
/* ERB style templates conflict with Jekyll HTML escaping */
_.templateSettings = {
evaluate : /\{@([\s\S]+?)@\}/g,
interpolate : /\{@=([\s\S]+?)@\}/g,
escape : /\{@-([\s\S]+?)@\}/g
};
$(function(){
$.fn.springPopover = function(){

26
js/test/lib/jasmine-1.3.1/jasmine-html.js

@ -118,7 +118,7 @@ jasmine.HtmlReporter = function(_doc) { @@ -118,7 +118,7 @@ jasmine.HtmlReporter = function(_doc) {
return true;
}
return spec.getFullName().indexOf(focusedSpecName()) === 0;
return spec.getVersion().indexOf(focusedSpecName()) === 0;
};
return self;
@ -398,17 +398,17 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views) { @@ -398,17 +398,17 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
this.summary = this.createDom('div', { className: 'specSummary' },
this.createDom('a', {
className: 'description',
href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
title: this.spec.getFullName()
href: jasmine.HtmlReporter.sectionLink(this.spec.getVersion()),
title: this.spec.getVersion()
}, this.spec.description)
);
this.detail = this.createDom('div', { className: 'specDetail' },
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
title: this.spec.getFullName()
}, this.spec.getFullName())
href: '?spec=' + encodeURIComponent(this.spec.getVersion()),
title: this.spec.getVersion()
}, this.spec.getVersion())
);
};
@ -471,7 +471,7 @@ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.Ht @@ -471,7 +471,7 @@ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.Ht
this.views = views;
this.element = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getVersion()) }, this.suite.description)
);
this.appendToSummary(this.suite, this.element);
@ -548,8 +548,8 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { @@ -548,8 +548,8 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
for (var i = 0; i < suites.length; i++) {
var suite = suites[i];
var suiteDiv = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getVersion()) }, "run"),
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getVersion()) }, suite.description));
this.suiteDivs[suite.id] = suiteDiv;
var parentDiv = this.outerDiv;
if (suite.parentSuite) {
@ -620,11 +620,11 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { @@ -620,11 +620,11 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
status = 'skipped';
}
var specDiv = this.createDom('div', { className: 'spec ' + status },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getVersion()) }, "run"),
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(spec.getFullName()),
title: spec.getFullName()
href: '?spec=' + encodeURIComponent(spec.getVersion()),
title: spec.getVersion()
}, spec.description));
@ -677,5 +677,5 @@ jasmine.TrivialReporter.prototype.specFilter = function(spec) { @@ -677,5 +677,5 @@ jasmine.TrivialReporter.prototype.specFilter = function(spec) {
if (!paramMap.spec) {
return true;
}
return spec.getFullName().indexOf(paramMap.spec) === 0;
return spec.getVersion().indexOf(paramMap.spec) === 0;
};

12
js/test/lib/jasmine-1.3.1/jasmine.js

@ -2227,8 +2227,8 @@ jasmine.Spec = function(env, suite, description) { @@ -2227,8 +2227,8 @@ jasmine.Spec = function(env, suite, description) {
spec.matchersClass = null;
};
jasmine.Spec.prototype.getFullName = function() {
return this.suite.getFullName() + ' ' + this.description + '.';
jasmine.Spec.prototype.getVersion = function() {
return this.suite.getVersion() + ' ' + this.description + '.';
};
@ -2463,12 +2463,12 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { @@ -2463,12 +2463,12 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
self.specs_ = [];
};
jasmine.Suite.prototype.getFullName = function() {
var fullName = this.description;
jasmine.Suite.prototype.getVersion = function() {
var version = this.description;
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
fullName = parentSuite.description + ' ' + fullName;
version = parentSuite.description + ' ' + version;
}
return fullName;
return version;
};
jasmine.Suite.prototype.finish = function(onComplete) {

8
js/test/spec/QuickStartWidgetSpec.js

@ -20,9 +20,9 @@ describe("QuickStartWidget", function () { @@ -20,9 +20,9 @@ describe("QuickStartWidget", function () {
"url": "http://repo.springsource.org/milestone",
"snapshotsEnabled": false
},
"fullName": "1.4.0.RC1",
"version": "1.4.0.RC1",
"supported": false,
"shortName": "1.4.0.RC1",
"versionDisplayName": "1.4.0.RC1",
"current": false,
"preRelease": true
},
@ -32,9 +32,9 @@ describe("QuickStartWidget", function () { @@ -32,9 +32,9 @@ describe("QuickStartWidget", function () {
"groupId": "org.springframework.data",
"artifactId": "spring-data-jpa",
"repository": null,
"fullName": "1.3.4.RELEASE",
"version": "1.3.4.RELEASE",
"supported": false,
"shortName": "1.3.4",
"versionDisplayName": "1.3.4",
"current": true,
"preRelease": false
}

Loading…
Cancel
Save