Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
klembot committed Nov 16, 2016
2 parents b118f6c + 20c0472 commit d36def2
Show file tree
Hide file tree
Showing 54 changed files with 976 additions and 1,302 deletions.
26 changes: 19 additions & 7 deletions grunt/nw.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
var wrench = require('wrench');
var chmodr = require('chmodr');

module.exports = function(grunt) {
// nwjs generates NW.js apps.
/* nwjs generates NW.js apps. */

var options = {
buildDir: 'build/nwjs/',
cacheDir: 'nwbuilder-cache/',
version: '0.17.4',
version: '0.18.7',
macIcns: 'src/common/img/logo.icns',
winIco: 'src/common/img/logo.ico'
}
Expand Down Expand Up @@ -40,17 +40,29 @@ module.exports = function(grunt) {
}
});

// nwjs:osxcleanup corrects a permissions problem on OS X versions of the NW.js app.
/*
nwjs:osxcleanup corrects a permissions problem on OS X versions of the
NW.js app.
*/

grunt.registerTask('nwjs:osxcleanup', function() {
wrench.chmodSyncRecursive('build/nwjs/Twine/osx64/Twine.app', 0755);
chmodr.sync('build/nwjs/Twine/osx64/Twine.app', 0755);
});

// nw builds NW.js apps from the contents of build/standalone.
/*
nw builds NW.js apps from the contents of build/standalone.
*/

['osx','win','linux'].forEach(plat => {
grunt.registerTask('nw:' + plat, ['build:release', 'nwjs:' + plat,
plat == 'osx' ? 'nwjs:osxcleanup' : '']);
});
grunt.registerTask('nw', ['build:release', 'nwjs:osx', 'nwjs:osxcleanup', 'nwjs:win64', 'nwjs:win32', 'nwjs:linux']);
grunt.registerTask('nw', [
'build:release',
'nwjs:osx',
'nwjs:osxcleanup',
'nwjs:win64',
'nwjs:win32',
'nwjs:linux'
]);
};
32 changes: 10 additions & 22 deletions grunt/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function(grunt) {
// eslint checks JavaScript files for potential problems.
/* eslint checks JavaScript files for potential problems. */

grunt.config.merge({
eslint: {
Expand All @@ -10,7 +10,7 @@ module.exports = function(grunt) {
}
});

// jscs checks JavaScript files for style issues.
/* jscs checks JavaScript files for style issues. */

grunt.config.merge({
jscs: {
Expand All @@ -24,42 +24,30 @@ module.exports = function(grunt) {
}
});

// lint lints everything.
/* lint lints everything. */

grunt.registerTask('lint', ['eslint', 'jscs']);

// mocha runs browser-based tests.
// --grep only runs tests matching a regular expression.
// --bail stops testing on any failure.
/* mochify runs unit tests. */

grunt.config.merge({
mochaTest: {
selenium: {
src: ['./tests/selenium/*.js'],
options: {
bail: grunt.option('bail'),
grep: grunt.option('grep'),
slow: 5000
}
}
},
mochify: {
spec: {
src: ['./src/**/*.spec.js'],
options: {
phantomjs: grunt.option('phantomjs') || 'phantomjs',
reporter: 'dot',
// This contrivance is required in order to force grunt-mochify to call
// mochify with multiple --transform values (which it normally cannot).
/*
This contrivance is required in order to force grunt-mochify to call
mochify with multiple --transform values (which it normally cannot).
*/
transform: 'stringify --transform [ babelify --presets babel-preset-es2015 ]'.split(' ')
}
}
}
});

// test tests everything.
/* test tests everything. */

grunt.registerTask('test', ['test:unit', 'test:selenium']);
grunt.registerTask('test:selenium', ['mochaTest:selenium']);
grunt.registerTask('test:unit', ['mochify:unit']);
grunt.registerTask('test', ['mochify:spec']);
};
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Twine",
"version": "2.1.0b2",
"version": "2.1.0b3",
"author": "Chris Klimas <[email protected]>",
"description": "a GUI for creating nonlinear stories",
"license": "GPL-3.0",
Expand All @@ -21,8 +21,8 @@
"blob-polyfill": "^1.0.20150320",
"browser-saveas": "^1.0.0",
"codemirror": "^5.5.0",
"dom-event-special": "^0.1.7",
"core-js": "^2.4.0",
"dom-event-special": "^0.1.7",
"fastclick": "^1.0.6",
"font-awesome": "^4.3.0",
"jed": "^1.1.0",
Expand All @@ -32,6 +32,7 @@
"osenv": "^0.1.3",
"scroll-to-element": "^2.0.0",
"segseg": "^0.2.2",
"semver-utils": "^1.1.1",
"svg.js": "^1.0.1",
"tether-drop": "^1.4.2",
"tiny-uuid": "^1.0.0",
Expand All @@ -43,33 +44,32 @@
"devDependencies": {
"babel-preset-es2015": "^6.6.0",
"babelify": "^7.2.0",
"browserify": "^11.0.0",
"browserify": "^11.2.0",
"browserify-shim": "^3.8.10",
"chai": "^3.5.0",
"chmodr": "^1.0.2",
"ejsify": "^1.0.0",
"envify": "^3.4.0",
"grunt": "^0.4.5",
"grunt-browserify": "^4.0.1",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.8.1",
"grunt-contrib-less": "^1.2.0",
"grunt-contrib-watch": "^0.6.1",
"grunt": "^1.0.0",
"grunt-browserify": "^5.0.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-less": "^1.4.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^19.0.0",
"grunt-jscs": "^2.7.0",
"grunt-jscs": "^3.0.1",
"grunt-jsdoc": "^1.0.0",
"grunt-mocha-test": "^0.12.7",
"grunt-mochify": "^0.3.0",
"grunt-nw-builder": "^2.0.0",
"grunt-nw-builder": "^3.1.0",
"grunt-po2json": "^0.3.0",
"grunt-template": "^0.2.3",
"jit-grunt": "^0.9.1",
"grunt-template": "^1.0.0",
"jit-grunt": "^0.10.0",
"less-plugin-autoprefix": "^1.5.1",
"less-plugin-clean-css": "^1.5.1",
"selenium-webdriver": "^2.52.0",
"sinon": "^1.17.5",
"stringify": "^5.1.0",
"uglifyify": "^3.0.1",
"watchify": "^3.3.0",
"wrench": "^1.5.8"
"watchify": "^3.7.0"
}
}
5 changes: 3 additions & 2 deletions src/common/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';
const Vue = require('vue');
const ui = require('../../ui');
const { repairFormats } = require('../../data/actions');
const { repairFormats, repairStories } = require('../../data/actions');
const store = require('../../data/store');

module.exports = Vue.extend({
Expand All @@ -12,6 +12,7 @@ module.exports = Vue.extend({
ready() {
ui.init();
this.repairFormats();
this.repairStories();
document.body.classList.add(`theme-${this.themePref}`);
},

Expand All @@ -23,7 +24,7 @@ module.exports = Vue.extend({
},

vuex: {
actions: { repairFormats },
actions: { repairFormats, repairStories },
getters: {
themePref: state => state.pref.appTheme
}
Expand Down
77 changes: 42 additions & 35 deletions src/common/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// The router managing the app's views.
/* The router managing the app's views. */

let Vue = require('vue');
const VueRouter = require('vue-router');
Expand All @@ -16,7 +16,7 @@ Vue.use(VueRouter);
let TwineRouter = new VueRouter();

TwineRouter.map({
// We connect routes with no params directly to a component.
/* We connect routes with no params directly to a component. */

'/locale': {
component: LocaleView
Expand All @@ -26,8 +26,10 @@ TwineRouter.map({
component: WelcomeView
},

// For routes that take data objects, we create shim components which provide
// appropriate props to the components that do the actual work.
/*
For routes that take data objects, we create shim components which provide
appropriate props to the components that do the actual work.
*/

'/stories': {
component: {
Expand Down Expand Up @@ -57,8 +59,10 @@ TwineRouter.map({
},
},

// These routes require special handling, because we tear down our UI when
// they activate.
/*
These routes require special handling, because we tear down our UI when
they activate.
*/

'/stories/:id/play': {
component: {
Expand All @@ -68,12 +72,11 @@ TwineRouter.map({
story => story.id === this.$route.params.id
);

const formatName = story.storyFormat || state.pref.defaultFormat;
const format = state.storyFormat.formats.find(
format => format.name === formatName
);

loadFormat(this.$store, formatName).then(() => {
loadFormat(
this.$store,
story.storyFormat,
story.storyFormatVersion
).then(format => {
replaceUI(publishStoryWithFormat(
state.appInfo,
story,
Expand All @@ -91,11 +94,12 @@ TwineRouter.map({
const story = state.story.stories.find(
story => story.id === this.$route.params.id
);
const format = state.storyFormat.formats.find(
format => format.name === state.pref.proofingFormat
);

loadFormat(this.$store, format.name).then(() => {
loadFormat(
this.$store,
story.storyFormat,
story.storyFormatVersion
).then(format => {
replaceUI(publishStoryWithFormat(
state.appInfo,
story,
Expand All @@ -113,12 +117,12 @@ TwineRouter.map({
const story = state.story.stories.find(
story => story.id === this.$route.params.id
);
const formatName = story.storyFormat || state.pref.defaultFormat;
const format = state.storyFormat.formats.find(
format => format.name === formatName
);

loadFormat(this.$store, formatName).then(() => {
loadFormat(
this.$store,
story.storyFormat,
story.storyFormatVersion
).then(format => {
replaceUI(publishStoryWithFormat(
state.appInfo,
story,
Expand All @@ -137,12 +141,12 @@ TwineRouter.map({
const story = state.story.stories.find(
story => story.id === this.$route.params.storyId
);
const formatName = story.storyFormat || state.pref.defaultFormat;
const format = state.storyFormat.formats.find(
format => format.name === formatName
);

loadFormat(this.$store, formatName).then(() => {
loadFormat(
this.$store,
story.storyFormat,
story.storyFormatName
).then(format => {
replaceUI(publishStoryWithFormat(
state.appInfo,
story,
Expand All @@ -156,16 +160,18 @@ TwineRouter.map({
}
});

// By default, show the story list.
/* By default, show the story list. */

TwineRouter.redirect({
'*': '/stories'
});

TwineRouter.beforeEach((transition) => {
// If we are moving from an edit view to a list view, give the list view
// the story that we were previously editing, so that it can display a
// zooming transition back to the story.
TwineRouter.beforeEach(transition => {
/*
If we are moving from an edit view to a list view, give the list view the
story that we were previously editing, so that it can display a zooming
transition back to the story.
*/

if (transition.from.path && transition.to.path === '/stories') {
const editingId =
Expand All @@ -176,10 +182,11 @@ TwineRouter.beforeEach((transition) => {
}
}

// If the user has never used the app before, point them to the welcome
// view first. This has to come below any other logic, as calling
// transition.next() or redirect() will stop any other logic in the
// function.
/*
If the user has never used the app before, point them to the welcome view
first. This has to come below any other logic, as calling transition.next()
or redirect() will stop any other logic in the function.
*/

const welcomeSeen = store.state.pref.welcomeSeen;

Expand Down
Loading

0 comments on commit d36def2

Please sign in to comment.