mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-28 15:28:15 +00:00
chore(ngdocs): fixup the docs version switcher
This commit is contained in:
parent
90979061e8
commit
7215afa21c
3 changed files with 7 additions and 9 deletions
|
|
@ -39,7 +39,7 @@ exports.merge = merge;
|
||||||
exports.Doc = Doc;
|
exports.Doc = Doc;
|
||||||
|
|
||||||
exports.ngVersions = function() {
|
exports.ngVersions = function() {
|
||||||
var line, versions = [], regex = /^v([1-9]\d*(?:\.\d+)+)$/; //only fetch >= 1.0.0 versions
|
var versions = [], regex = /^v([1-9]\d*(?:\.\d+\S+)+)$/; //only fetch >= 1.0.0 versions
|
||||||
shell.exec('git tag', {silent: true}).output.split(/\s*\n\s*/)
|
shell.exec('git tag', {silent: true}).output.split(/\s*\n\s*/)
|
||||||
.forEach(function(line) {
|
.forEach(function(line) {
|
||||||
var matches = regex.exec(line);
|
var matches = regex.exec(line);
|
||||||
|
|
@ -47,7 +47,7 @@ exports.ngVersions = function() {
|
||||||
versions.push(matches[1]);
|
versions.push(matches[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
versions.push(exports.ngCurrentVersion().number);
|
versions.push(exports.ngCurrentVersion().full);
|
||||||
return versions;
|
return versions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ var docsApp = {
|
||||||
serviceFactory: {}
|
serviceFactory: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', function($scope, $window, NG_VERSIONS) {
|
docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', 'NG_VERSION', function($scope, $window, NG_VERSIONS, NG_VERSION) {
|
||||||
$scope.versions = expandVersions(NG_VERSIONS);
|
$scope.versions = expandVersions(NG_VERSIONS);
|
||||||
$scope.version = ($scope.version || angular.version.full).match(/^([\d\.]+\d+)/)[1]; //match only the number
|
$scope.version = ($scope.version || NG_VERSION).match(/^([\d\.]+\d+\S+)/)[1]; //match only the number
|
||||||
|
|
||||||
$scope.jumpToDocsVersion = function(value) {
|
$scope.jumpToDocsVersion = function(value) {
|
||||||
var isLastStable,
|
var isLastStable,
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@ module.exports = {
|
||||||
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
|
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
|
||||||
|
|
||||||
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
|
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
|
||||||
var numVersion = semver[0] + '.' + semver[1] + '.' + semver[2];
|
|
||||||
version = {
|
version = {
|
||||||
number: numVersion,
|
|
||||||
full: fullVersion,
|
full: fullVersion,
|
||||||
major: semver[0],
|
major: semver[0],
|
||||||
minor: semver[1],
|
minor: semver[1],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue