Skip to content

Commit

Permalink
Reversed canary rule structure (TryGhost#254)
Browse files Browse the repository at this point in the history
refs TryGhost#144

- This structure based on the similar convention as in Ghost core where 'canary' is a perpetual version out of which stable 'v2', 'v3'... versions are branched out once they reach a stable version
- Modified test suits to use 'canary' instead of 'v3'
- Made 'v3' rules to be aliased to 'canary'  and not the other way around
- Updated web UI to work with canary version
  • Loading branch information
naz authored Sep 13, 2019
1 parent 68d241b commit da51c0a
Show file tree
Hide file tree
Showing 38 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/tpl/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<span class="gh-input-icon select-arrow">{{> icon-arrow-up}}</span>
<span class="gh-input-icon select-arrow active">{{> icon-arrow-down}}</span>
<select class="gh-input gh-select" name="version" id="version">
<option value="v3">{{ghostVersions.v3.major}} (canary)</option>
<option value="canary">{{ghostVersions.canary.major}} (canary)</option>
<option value="v2" selected>{{ghostVersions.v2.major}} (latest)</option>
<option value="v1">{{ghostVersions.v1.major}}</option>
</select>
Expand Down
4 changes: 2 additions & 2 deletions lib/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const checker = function checkAll(themePath, options) {

if (passedVersion === 'latest') {
version = 'v2';
} else if (passedVersion === 'canary') {
version = 'v3';
} else if (passedVersion === 'v3') {
version = 'canary';
}

return readTheme(themePath)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/specs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = {

if (version === 'latest') {
version = 'v2';
} else if (version === 'canary') {
version = 'v3';
} else if (version === 'v3') {
version = 'canary';
}

debug('Checking against version: ', version);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"major": "2.x",
"docs": "2.1.0"
},
"v3": {
"canary": {
"major": "3.x",
"docs": "3.0.0"
}
Expand Down
12 changes: 6 additions & 6 deletions test/001-deprecations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,11 +855,11 @@ describe('001 Deprecations', function () {
});
});

describe('v3:', function () {
const options = {checkVersion: 'v3'};
describe('canary:', function () {
const options = {checkVersion: 'canary'};

it('[failure] theme is completely invalid', function (done) {
utils.testCheck(thisCheck, '001-deprecations/v3/invalid_all', options).then(function (output) {
utils.testCheck(thisCheck, '001-deprecations/canary/invalid_all', options).then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.fail.should.be.an.Object().with.keys(
Expand Down Expand Up @@ -1229,7 +1229,7 @@ describe('001 Deprecations', function () {
});

it('[failure] theme is invalid', function (done) {
utils.testCheck(thisCheck, '001-deprecations/v3/invalid', options).then(function (output) {
utils.testCheck(thisCheck, '001-deprecations/canary/invalid', options).then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.fail.should.be.an.Object().with.keys(
Expand Down Expand Up @@ -1473,7 +1473,7 @@ describe('001 Deprecations', function () {
});

it('[success] should show no error if no deprecated helpers used', function (done) {
utils.testCheck(thisCheck, '001-deprecations/v3/valid', options).then(function (output) {
utils.testCheck(thisCheck, '001-deprecations/canary/valid', options).then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.fail.should.be.an.Object().which.is.empty();
Expand All @@ -1484,7 +1484,7 @@ describe('001 Deprecations', function () {
});

it('[mixed] should pass and fail when some rules pass and others fail', function (done) {
utils.testCheck(thisCheck, '001-deprecations/v3/mixed', options).then(function (output) {
utils.testCheck(thisCheck, '001-deprecations/canary/mixed', options).then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.fail.should.be.an.Object().with.keys(
Expand Down
4 changes: 2 additions & 2 deletions test/010-package-json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ describe('010 package.json', function () {
});
});

describe('v3:', function () {
const options = {checkVersion: 'v3'};
describe('canary:', function () {
const options = {checkVersion: 'canary'};

it('valid fields', function (done) {
utils.testCheck(thisCheck, '010-packagejson/fields-are-valid', options).then(function (theme) {
Expand Down
4 changes: 2 additions & 2 deletions test/050-koenig-css-classes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe('050 Koenig CSS classes', function () {
});
});

describe('v3:', function () {
const options = {checkVersion: 'v3'};
describe('canary:', function () {
const options = {checkVersion: 'canary'};

it('[failure] should invalidate theme when .css file is missing', function (done) {
utils.testCheck(thisCheck, 'is-empty', options).then(function (output) {
Expand Down
2 changes: 1 addition & 1 deletion test/general.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ describe('Checker', function () {
});

it('checks for a v3 version if passed', function (done) {
checker(themePath('is-empty'), {checkVersion: 'v3'}).then((theme) => {
checker(themePath('is-empty'), {checkVersion: 'canary'}).then((theme) => {
theme.should.be.a.ValidThemeObject();

theme.files.should.eql([
Expand Down

0 comments on commit da51c0a

Please sign in to comment.