From 7773266a3aee5de87739ade3bafe1333e3519b6a Mon Sep 17 00:00:00 2001 From: Dave Syer and Nick Street Date: Fri, 16 Aug 2013 11:15:26 +0100 Subject: [PATCH] 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 {@= groupId @} {@= artifactId @} {@= version @} [#55283992] --- _includes/widgets.html | 103 +++++++++++++++------- js/application.js | 8 ++ js/test/lib/jasmine-1.3.1/jasmine-html.js | 26 +++--- js/test/lib/jasmine-1.3.1/jasmine.js | 12 +-- js/test/spec/QuickStartWidgetSpec.js | 8 +- 5 files changed, 102 insertions(+), 55 deletions(-) diff --git a/_includes/widgets.html b/_includes/widgets.html index 40c136f35be..b11248081db 100644 --- a/_includes/widgets.html +++ b/_includes/widgets.html @@ -1,25 +1,25 @@ - - - + +{% capture maven_repository %} +{% include maven_repository.xml %} +{% endcapture %} + +{%if maven_repository contains 'not found in _includes directory' %} +{% capture maven_repository %} + + {@= id @} + {@= name @} + {@= url @} + + {@= snapshotsEnabled @} + + +{% endcapture %} +{% endif %} + + + +{% 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 @}' } - - + +{% 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 @}' } } - +{% endcapture %} +{% endif %} + + \ No newline at end of file diff --git a/js/application.js b/js/application.js index a9c33927f46..6bdd353403a 100644 --- a/js/application.js +++ b/js/application.js @@ -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(){ diff --git a/js/test/lib/jasmine-1.3.1/jasmine-html.js b/js/test/lib/jasmine-1.3.1/jasmine-html.js index 543d56963eb..fa1863d1d80 100644 --- a/js/test/lib/jasmine-1.3.1/jasmine-html.js +++ b/js/test/lib/jasmine-1.3.1/jasmine-html.js @@ -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) { 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 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) { 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) { 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) { if (!paramMap.spec) { return true; } - return spec.getFullName().indexOf(paramMap.spec) === 0; + return spec.getVersion().indexOf(paramMap.spec) === 0; }; diff --git a/js/test/lib/jasmine-1.3.1/jasmine.js b/js/test/lib/jasmine-1.3.1/jasmine.js index 6b3459b913f..eaf7d426b61 100644 --- a/js/test/lib/jasmine-1.3.1/jasmine.js +++ b/js/test/lib/jasmine-1.3.1/jasmine.js @@ -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) { 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) { diff --git a/js/test/spec/QuickStartWidgetSpec.js b/js/test/spec/QuickStartWidgetSpec.js index 7057641e8fa..d526fd1db15 100644 --- a/js/test/spec/QuickStartWidgetSpec.js +++ b/js/test/spec/QuickStartWidgetSpec.js @@ -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 () { "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 }