diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..3c078e9f --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "es2015" + ] +} diff --git a/.editorconfig b/.editorconfig index 55cb6631..af440cbf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,7 +12,7 @@ insert_final_newline = true trim_trailing_whitespace = true -[{package.json,.travis.yml,.eslintrc}] +[{package.json,.travis.yml,.eslintrc,.babelrc}] indent_size = 2 diff --git a/.eslintignore b/.eslintignore index c62b7ed1..8de72900 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ -build/* -node_modules/* -**/vendor/* +**/build/** +**/node_modules/** +**/vendor/** diff --git a/.gitignore b/.gitignore index 5396eb38..f62054c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build local node_modules +npm-debug.log diff --git a/ghu b/ghu new file mode 100755 index 00000000..5d4f4445 --- /dev/null +++ b/ghu @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +node -r babel-core/register ghu.js "$@" diff --git a/ghu.js b/ghu.js new file mode 100644 index 00000000..cd81ed94 --- /dev/null +++ b/ghu.js @@ -0,0 +1,158 @@ +import {resolve, join} from 'path'; +import dateformat from 'dateformat'; +import ghu from 'ghu'; +import { + autoprefixer, babel, cssmin, ife, includeit, jade, jszip, + less, mapfn, newerThan, read, remove, run, uglify, watch, wrap, write +} from 'ghu'; + +const ROOT = resolve(__dirname); +const SRC = join(ROOT, 'src'); +const BUILD = join(ROOT, 'build'); + +const mapper = mapfn.p(SRC, BUILD).s('.less', '.css').s('.jade', ''); + +ghu.defaults('release'); + +ghu.before(runtime => { + runtime.pkg = Object.assign({}, require('./package.json')); + + const res = run.sync(`git rev-list v${runtime.pkg.version}..HEAD`, {silent: true}); + if (res.code === 0) { + const hashes = res.stdout.split(/\r?\n/).filter(x => x); + if (hashes.length) { + const counter = ('000' + hashes.length).substr(-3); + const hash = hashes[0].substr(0, 7); + const stamp = dateformat(Date.now(), 'yyyy-mm-dd-HH-MM-ss'); + runtime.pkg.version += `+${counter}~${hash}~${stamp}`; + } + } + + runtime.comment = `${runtime.pkg.name} v${runtime.pkg.version} - ${runtime.pkg.homepage}`; + runtime.commentJs = `/* ${runtime.comment} */\n`; + runtime.commentHtml = ``; + + console.log(runtime.comment); +}); + +ghu.task('force-production', 'ensure :production flag is set', runtime => { + if (!runtime.args.production) { + runtime.args.production = true; + console.log('forcing production mode'); + } +}); + +ghu.task('clean', 'delete build folder', () => { + return remove(BUILD); +}); + +ghu.task('lint', 'lint all JavaScript files with eslint', () => { + return run('eslint .', {stdio: 'inherit'}); +}); + +ghu.task('build:scripts', runtime => { + return read(`${SRC}/_h5ai/public/js/*.js`) + .then(newerThan(mapper, `${SRC}/_h5ai/public/js/**`)) + .then(includeit()) + // .then(babel({compact: false})) + .then(ife(() => runtime.args.production, uglify())) + .then(wrap(runtime.commentJs)) + .then(write(mapper, {overwrite: true})); +}); + +ghu.task('build:styles', runtime => { + return read(`${SRC}/_h5ai/public/css/*.less`) + .then(newerThan(mapper, `${SRC}/_h5ai/public/css/**`)) + .then(includeit()) + .then(less()) + .then(autoprefixer()) + .then(ife(() => runtime.args.production, cssmin())) + .then(wrap(runtime.commentJs)) + .then(write(mapper, {overwrite: true})); +}); + +ghu.task('build:pages', runtime => { + return read(`${SRC}: **/*.jade, ! **/*.tpl.jade`) + .then(newerThan(mapper, `${SRC}/**/*.tpl.jade`)) + .then(jade({pkg: runtime.pkg})) + .then(wrap('', runtime.commentHtml)) + .then(write(mapper, {overwrite: true})); +}); + +ghu.task('build:copy', runtime => { + const mapperRoot = mapfn.p(ROOT, join(BUILD, '_h5ai')); + + return Promise.all([ + read(`${SRC}/**/conf/*.json`) + .then(newerThan(mapper)) + .then(wrap(runtime.commentJs)) + .then(write(mapper, {overwrite: true, cluster: true})), + + read(`${SRC}: **, ! **/*.js, ! **/*.less, ! **/*.jade, ! **/conf/*.json`) + .then(newerThan(mapper)) + .then(write(mapper, {overwrite: true, cluster: true})), + + read(`${ROOT}/*.md`) + .then(newerThan(mapperRoot)) + .then(write(mapperRoot, {overwrite: true, cluster: true})) + ]); +}); + +ghu.task('build:tests', ['build:scripts', 'build:styles'], 'build the test suite', runtime => { + return Promise.all([ + read(`${ROOT}/test/scripts.js`) + .then(newerThan(`${BUILD}/test/scripts.js`)) + .then(includeit()) + .then(write(`${BUILD}/test/scripts.js`, {overwrite: true})), + + read(`${ROOT}/test/styles.less`) + .then(newerThan(`${BUILD}/test/styles.css`)) + .then(includeit()) + .then(less()) + .then(autoprefixer()) + .then(write(`${BUILD}/test/styles.css`, {overwrite: true})), + + read(`${ROOT}/test/index.html.jade`) + .then(newerThan(`${BUILD}/test/index.html`)) + .then(jade({pkg: runtime.pkg})) + .then(write(`${BUILD}/test/index.html`, {overwrite: true})), + + read(`${BUILD}/_h5ai/public/js/scripts.js`) + .then(newerThan(`${BUILD}/test/h5ai-scripts.js`)) + .then(write(`${BUILD}/test/h5ai-scripts.js`, {overwrite: true})), + + read(`${BUILD}/_h5ai/public/css/styles.css`) + .then(newerThan(`${BUILD}/test/h5ai-styles.css`)) + .then(write(`${BUILD}/test/h5ai-styles.css`, {overwrite: true})) + ]).then(() => { + console.log(`browse to file://${BUILD}/test/index.html to run the test suite`); + }); +}); + +ghu.task('build', ['build:scripts', 'build:styles', 'build:pages', 'build:copy', 'build:tests'], + 'build all updated files, optionally use :production'); + +ghu.task('deploy', ['build'], 'deploy to a specified path with :dest=/some/path', runtime => { + if (typeof runtime.args.dest !== 'string') { + throw new Error('no destination path (e.g. :dest=/some/path)'); + } + console.log(`deploy to ${runtime.args.dest}`); + + const mapperDeploy = mapfn.p(BUILD, resolve(runtime.args.dest)); + + return read(`${BUILD}/_h5ai/**`) + .then(newerThan(mapperDeploy)) + .then(write(mapperDeploy, {overwrite: true, cluster: true})); +}); + +ghu.task('watch', runtime => { + return watch([SRC], () => ghu.run(runtime.sequence.filter(x => x !== 'watch'), runtime.args, true)); +}); + +ghu.task('release', ['force-production', 'clean', 'build'], 'create a zipball', runtime => { + const target = join(BUILD, `${runtime.pkg.name}-${runtime.pkg.version}.zip`); + + return read(`${BUILD}/_h5ai/**`) + .then(jszip({dir: BUILD, level: 9})) + .then(write(target, {overwrite: true})); +}); diff --git a/mkrfile.js b/mkrfile.js deleted file mode 100644 index 6adedd1c..00000000 --- a/mkrfile.js +++ /dev/null @@ -1,243 +0,0 @@ -import fq from 'fquery'; -import dateformat from 'dateformat'; -import {join, resolve} from 'path'; -import webpack from 'webpack'; -import {spawnSync} from 'child_process'; - -const loadPlugins = () => { - const pkg = require('./package.json'); - const deps = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})]; - const plugs = deps.filter(name => name.startsWith('fquery-')); - plugs.forEach(plug => fq.plugin(plug)); -}; -loadPlugins(); - -const root = resolve(__dirname); -const src = join(root, 'src'); -const build = join(root, 'build'); - -function once(fn) { - let getter = () => { - const value = fn(); - getter = () => value; - return value; - }; - return () => getter(); -} - -function run(cmd, {info = true, stdout = true, stderr = true, liberal = false, local = true} = {}) { - const stdio = ['ignore', stdout ? 1 : 'pipe', stderr ? 2 : 'pipe']; - if (info) { - fq.report({type: 'info', method: 'run', message: cmd}); - } - const precmd = local ? 'PATH=./node_modules/.bin:$PATH;' : ''; - const res = spawnSync('sh', ['-c', precmd + cmd], { - cwd: root, - stdio, - encoding: 'utf-8' - }); - if (res.status !== 0 && !liberal) { - fq.report({type: 'err', method: 'run', message: `${cmd} [${res.status}] ${String(res.error)}`}); - } - return res; -} - -const getStamp = once(() => { - const stamp = new Date(); - stamp.human = dateformat(stamp, 'yyyy-mm-dd HH:MM:ss'); - stamp.id = stamp.human.replace(/\D/g, '-'); - stamp.sha1 = fq.getHash(stamp.id); - return stamp; -}); - -const getPackage = once(() => { - const pkg = require('./package.json'); - const res = run(`git rev-list v${pkg.version}..HEAD`, {info: false, stdout: false, stderr: false, liberal: true}); - if (res.status === 0) { - const hashes = fq._.compact(res.stdout.split(/\r?\n/)); - if (hashes.length) { - pkg.version += `+${hashes.length}~${hashes[0].substr(0, 7)}`; - } - } - return pkg; -}); - -const getComment = once(() => { - const pkg = getPackage(); - return `${pkg.name} v${pkg.version} - ${getStamp().human}`; -}); - -const getHeader = once(() => `/* ${getComment()} */\n`); - -function formatWebpackStats(stats, len) { - const json = stats.toJson(); - const align = (s, i) => ` ${s}`.substr(-i); - const cmp = (a, b) => a < b ? -1 : a > b ? 1 : 0; - const sortBy = (arr, selector = x => x) => Array.from(arr).sort((a, b) => cmp(selector(a), selector(b))); - let res = sortBy(json.modules, x => x.size); - if (len) { - res = 'stats\n' + res.slice(-len).map(r => { - return `${align(`[${r.id}]`, 7)}${align(r.size, 10)} ${r.name}`; - }).join('\n'); - res += `\n\n${align(json.modules.length, 7)}${align(json.assets[0].size, 10)} ${json.assets[0].name}`; - } else { - res = `modules: ${json.modules.length}, bytes: ${json.assets[0].size}, bundle: ${json.assets[0].name}`; - } - return res; -} - -module.exports = suite => { - suite.defaults('release'); - - suite.target('clean', [], 'delete build folder').task(() => { - fq(build, {dirs: true}).delete(); - }); - - suite.target('lint', [], 'lint all JavaScript files with eslint').task(() => { - run(`eslint ${src}/_h5ai/public/js`); - }); - - suite.target('build:scripts').task(done => { - const mapSrc = fq.map.p(src, build); - const scriptsChanged = fq(`${src}: _h5ai/public/js/scripts.js`) - .newerThan(mapSrc, fq(`${src}: _h5ai/public/js/**`)).length > 0; - - if (!scriptsChanged) { - done(); - return; - } - - const webpackConfig = { - context: src, - entry: './_h5ai/public/js/scripts.js', - output: { - path: build, - filename: '_h5ai/public/js/scripts.js' - }, - module: { - loaders: [ - { - include: [src], - loader: 'babel', - query: { - cacheDirectory: true - } - } - ] - } - }; - - if (!suite.args.production) { - webpackConfig.output.pathinfo = true; - webpackConfig.devtool = '#inline-source-map'; - } - - webpack(webpackConfig, (err, stats) => { - if (err) { - fq.report({type: 'err', method: 'scripts', message: err}); - } - // console.log(stats.toString({colors: true})); - fq.report({type: 'info', method: 'webpack', message: formatWebpackStats(stats, 10)}); - - fq(`${build}: _h5ai/public/js/scripts.js`) - .if(suite.args.production, function applyuglifyjs() { - this.uglifyjs(); // eslint-disable-line no-invalid-this - }) - .wrap(getHeader()) - .write(mapSrc, true); - done(); - }); - }); - - suite.target('build', [], 'build all updated files, optionally use :uncompressed (e.g. mkr -b build :uncompressed)').task(() => { - const env = {pkg: getPackage()}; - const mapSrc = fq.map.p(src, build).s('.less', '.css').s('.jade', ''); - const mapRoot = fq.map.p(root, join(build, '_h5ai')); - - fq(`${src}: _h5ai/public/js/*.js`) - .newerThan(mapSrc, fq(`${src}: _h5ai/public/js/**`)) - .includeit() - .if(!suite.args.uncompressed, function applyuglifyjs() { - this.uglifyjs(); // eslint-disable-line no-invalid-this - }) - .wrap(getHeader()) - .write(mapSrc, true); - - fq(`${src}: _h5ai/public/css/*.less`) - .newerThan(mapSrc, fq(`${src}: _h5ai/public/css/**`)) - .includeit() - .less() - .autoprefixer() - .if(!suite.args.uncompressed, function applycssmin() { - this.cssmin(); // eslint-disable-line no-invalid-this - }) - .wrap(getHeader()) - .write(mapSrc, true); - - fq(`${src}: **/*.jade, ! **/*.tpl.jade`) - .newerThan(mapSrc) - .jade(env) - .write(mapSrc, true); - - fq(`${src}: **, ! _h5ai/public/js/**, ! _h5ai/public/css/**, ! **/*.jade`) - .newerThan(mapSrc) - .handlebars(env) - .write(mapSrc, true); - - fq(`${root}: *.md`) - .newerThan(mapRoot) - .write(mapRoot, true); - - fq.report({type: 'info', message: getComment()}); - }); - - suite.target('deploy', ['build'], 'deploy to a specified path (e.g. mkr -b deploy :dest=/some/path)').task(() => { - if (!fq._.isString(suite.args.dest)) { - fq.report({type: 'err', message: 'no destination path (e.g. mkr -b deploy :dest=/some/path)'}); - } - - const mapper = fq.map.p(build, resolve(suite.args.dest)); - - fq(`${build}: _h5ai/**`) - .newerThan(mapper) - .write(mapper, true); - }); - - // suite.target('release', ['clean', 'lint', 'build'], 'create a zipball').task(() => { - suite.target('release', ['clean', 'build'], 'create a zipball').task(() => { - const pkg = getPackage(); - const target = join(build, `${pkg.name}-${pkg.version}.zip`); - - fq(`${build}: **`) - .jszip({dir: build, level: 9}) - .write(target, true); - }); - - suite.target('build-test', [], 'build a test suite').task(() => { - fq(`${src}/_h5ai/public/css/styles.less`) - .includeit() - .less() - .autoprefixer() - .write(`${build}/test/h5ai-styles.css`, true); - - fq(`${src}/_h5ai/public/js/scripts.js`) - .includeit() - .write(`${build}/test/h5ai-scripts.js`, true); - - fq(`${root}/test/styles.less`) - .includeit() - .less() - .autoprefixer() - .write(`${build}/test/styles.css`, true); - - fq(`${root}/test/scripts.js`) - .includeit() - .write(`${build}/test/scripts.js`, true); - - fq(`${root}/test/index.html.jade`) - .jade({pkg: getPackage()}) - .write(`${build}/test/index.html`, true); - - fq.report({type: 'info', message: `browse to file://${build}/test/index.html`}); - }); -}; diff --git a/package.json b/package.json index b3ccacb1..5006a17f 100644 --- a/package.json +++ b/package.json @@ -12,29 +12,19 @@ "url": "https://github.com/lrsjng/h5ai.git" }, "scripts": { - "build": "mkr -b release", - "build-test": "mkr -b build-test" + "lint": "eslint .", + "ghu": "node -r babel-core/register ghu.js", + "build": "npm run -s ghu release" }, "devDependencies": { - "babel": "^5.8.23", - "babel-eslint": "^4.1.3", - "babel-loader": "^5.3.2", - "dateformat": "^1.0.11", - "eslint": "^1.7.3", - "fquery": "^0.16.4", - "fquery-autoprefixer": "^0.3.0", - "fquery-cssmin": "^0.3.1", - "fquery-gethash": "^0.3.0", - "fquery-handlebars": "^0.3.0", - "fquery-includeit": "^0.3.0", - "fquery-jade": "^0.6.0", - "fquery-jszip": "^0.5.1", - "fquery-less": "^0.3.0", - "fquery-uglifyjs": "^0.3.0", - "mkr": "^0.10.0", - "webpack": "^1.12.2" + "babel-core": "6.1.2", + "babel-eslint": "4.1.3", + "babel-preset-es2015": "6.1.2", + "dateformat": "1.0.11", + "eslint": "1.7.3", + "ghu": "0.1.1" }, "engines": { - "node": "4.x" + "node": ">=5.0.0" } } diff --git a/src/_h5ai/private/conf/options.json b/src/_h5ai/private/conf/options.json index 84574e67..10cd3a0b 100644 --- a/src/_h5ai/private/conf/options.json +++ b/src/_h5ai/private/conf/options.json @@ -1,10 +1,3 @@ -/* -h5ai {{pkg.version}} -{{pkg.homepage}} - -Options -*/ - { /* Password hash. @@ -29,7 +22,7 @@ Options "resources": { "scripts": [], "styles": [ - "//fonts.googleapis.com/css?family=Ubuntu:300,400,700|Ubuntu+Mono:400,700" + "//fonts.googleapis.com/css?family=Ubuntu:300,400,700%7CUbuntu+Mono:400,700" ] }, diff --git a/src/_h5ai/private/conf/types.json b/src/_h5ai/private/conf/types.json index bac127c0..a558af30 100644 --- a/src/_h5ai/private/conf/types.json +++ b/src/_h5ai/private/conf/types.json @@ -1,10 +1,3 @@ -/* -h5ai {{pkg.version}} -{{pkg.homepage}} - -File types mapped to file extensions -*/ - { "ar": ["*.tar.bz2", "*.crx"], "ar-apk": ["*.apk"], diff --git a/src/_h5ai/private/php/pages/index.php.jade b/src/_h5ai/private/php/pages/index.php.jade index a0349771..4b785a59 100644 --- a/src/_h5ai/private/php/pages/index.php.jade +++ b/src/_h5ai/private/php/pages/index.php.jade @@ -1,10 +1,8 @@ extends ./page.tpl.jade block init - - var title = 'index - powered by h5ai v' + pkg.version + ' (' + pkg.homepage + ')' - var module = 'index' block body - div#fallback diff --git a/src/_h5ai/private/php/pages/info.php.jade b/src/_h5ai/private/php/pages/info.php.jade index ab58e983..b30fabbc 100644 --- a/src/_h5ai/private/php/pages/info.php.jade +++ b/src/_h5ai/private/php/pages/info.php.jade @@ -1,12 +1,10 @@ extends ./page.tpl.jade block init - - var title = 'h5ai info page - v' + pkg.version - var module = 'info' block body - div#content h1#header a(href='#{pkg.homepage}') h5ai diff --git a/src/_h5ai/public/css/vendor/h5bp-pre.less b/src/_h5ai/public/css/vendor/h5bp-pre.less index 7a435d40..6910f8b4 100644 --- a/src/_h5ai/public/css/vendor/h5bp-pre.less +++ b/src/_h5ai/public/css/vendor/h5bp-pre.less @@ -1,4 +1,4 @@ -/*! HTML5 Boilerplate v5.2.0 | MIT License | https://html5boilerplate.com/ */ +/* HTML5 Boilerplate v5.2.0 | MIT License | https://html5boilerplate.com/ */ /* * What follows is the result of much research on cross-browser styling. diff --git a/src/_h5ai/public/css/vendor/normalize.less b/src/_h5ai/public/css/vendor/normalize.less index 5e5e3c89..a16bdf0a 100644 --- a/src/_h5ai/public/css/vendor/normalize.less +++ b/src/_h5ai/public/css/vendor/normalize.less @@ -1,4 +1,4 @@ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +/* normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ /** * 1. Set default font family to sans-serif. diff --git a/src/_h5ai/public/images/themes/comity/txt-js.svg b/src/_h5ai/public/images/themes/comity/txt-js.svg index d924b767..91a3279a 100644 --- a/src/_h5ai/public/images/themes/comity/txt-js.svg +++ b/src/_h5ai/public/images/themes/comity/txt-js.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/src/_h5ai/public/images/themes/comity/txt-less.svg b/src/_h5ai/public/images/themes/comity/txt-less.svg index 516a8086..fd15b02a 100644 --- a/src/_h5ai/public/images/themes/comity/txt-less.svg +++ b/src/_h5ai/public/images/themes/comity/txt-less.svg @@ -1,5 +1,5 @@ - + diff --git a/src/_h5ai/public/images/themes/comity/txt-md.svg b/src/_h5ai/public/images/themes/comity/txt-md.svg index 15ed12fc..a2fba14c 100644 --- a/src/_h5ai/public/images/themes/comity/txt-md.svg +++ b/src/_h5ai/public/images/themes/comity/txt-md.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/src/_h5ai/public/js/inc/boot.js b/src/_h5ai/public/js/lib/boot.js similarity index 100% rename from src/_h5ai/public/js/inc/boot.js rename to src/_h5ai/public/js/lib/boot.js diff --git a/src/_h5ai/public/js/inc/core/event.js b/src/_h5ai/public/js/lib/core/event.js similarity index 100% rename from src/_h5ai/public/js/inc/core/event.js rename to src/_h5ai/public/js/lib/core/event.js diff --git a/src/_h5ai/public/js/inc/core/format.js b/src/_h5ai/public/js/lib/core/format.js similarity index 100% rename from src/_h5ai/public/js/inc/core/format.js rename to src/_h5ai/public/js/lib/core/format.js diff --git a/src/_h5ai/public/js/inc/core/langs.js b/src/_h5ai/public/js/lib/core/langs.js similarity index 100% rename from src/_h5ai/public/js/inc/core/langs.js rename to src/_h5ai/public/js/lib/core/langs.js diff --git a/src/_h5ai/public/js/inc/core/location.js b/src/_h5ai/public/js/lib/core/location.js similarity index 100% rename from src/_h5ai/public/js/inc/core/location.js rename to src/_h5ai/public/js/lib/core/location.js diff --git a/src/_h5ai/public/js/inc/core/modernizr.js b/src/_h5ai/public/js/lib/core/modernizr.js similarity index 100% rename from src/_h5ai/public/js/inc/core/modernizr.js rename to src/_h5ai/public/js/lib/core/modernizr.js diff --git a/src/_h5ai/public/js/inc/core/resource.js b/src/_h5ai/public/js/lib/core/resource.js similarity index 100% rename from src/_h5ai/public/js/inc/core/resource.js rename to src/_h5ai/public/js/lib/core/resource.js diff --git a/src/_h5ai/public/js/inc/core/server.js b/src/_h5ai/public/js/lib/core/server.js similarity index 100% rename from src/_h5ai/public/js/inc/core/server.js rename to src/_h5ai/public/js/lib/core/server.js diff --git a/src/_h5ai/public/js/inc/core/settings.js b/src/_h5ai/public/js/lib/core/settings.js similarity index 100% rename from src/_h5ai/public/js/inc/core/settings.js rename to src/_h5ai/public/js/lib/core/settings.js diff --git a/src/_h5ai/public/js/inc/core/store.js b/src/_h5ai/public/js/lib/core/store.js similarity index 100% rename from src/_h5ai/public/js/inc/core/store.js rename to src/_h5ai/public/js/lib/core/store.js diff --git a/src/_h5ai/public/js/inc/core/types.js b/src/_h5ai/public/js/lib/core/types.js similarity index 100% rename from src/_h5ai/public/js/inc/core/types.js rename to src/_h5ai/public/js/lib/core/types.js diff --git a/src/_h5ai/public/js/inc/core/util.js b/src/_h5ai/public/js/lib/core/util.js similarity index 100% rename from src/_h5ai/public/js/inc/core/util.js rename to src/_h5ai/public/js/lib/core/util.js diff --git a/src/_h5ai/public/js/inc/ext/autorefresh.js b/src/_h5ai/public/js/lib/ext/autorefresh.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/autorefresh.js rename to src/_h5ai/public/js/lib/ext/autorefresh.js diff --git a/src/_h5ai/public/js/inc/ext/contextmenu.js b/src/_h5ai/public/js/lib/ext/contextmenu.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/contextmenu.js rename to src/_h5ai/public/js/lib/ext/contextmenu.js diff --git a/src/_h5ai/public/js/inc/ext/crumb.js b/src/_h5ai/public/js/lib/ext/crumb.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/crumb.js rename to src/_h5ai/public/js/lib/ext/crumb.js diff --git a/src/_h5ai/public/js/inc/ext/custom.js b/src/_h5ai/public/js/lib/ext/custom.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/custom.js rename to src/_h5ai/public/js/lib/ext/custom.js diff --git a/src/_h5ai/public/js/inc/ext/download.js b/src/_h5ai/public/js/lib/ext/download.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/download.js rename to src/_h5ai/public/js/lib/ext/download.js diff --git a/src/_h5ai/public/js/inc/ext/filter.js b/src/_h5ai/public/js/lib/ext/filter.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/filter.js rename to src/_h5ai/public/js/lib/ext/filter.js diff --git a/src/_h5ai/public/js/inc/ext/google-analytics.js b/src/_h5ai/public/js/lib/ext/google-analytics.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/google-analytics.js rename to src/_h5ai/public/js/lib/ext/google-analytics.js diff --git a/src/_h5ai/public/js/inc/ext/info.js b/src/_h5ai/public/js/lib/ext/info.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/info.js rename to src/_h5ai/public/js/lib/ext/info.js diff --git a/src/_h5ai/public/js/inc/ext/l10n.js b/src/_h5ai/public/js/lib/ext/l10n.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/l10n.js rename to src/_h5ai/public/js/lib/ext/l10n.js diff --git a/src/_h5ai/public/js/inc/ext/peer5.js b/src/_h5ai/public/js/lib/ext/peer5.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/peer5.js rename to src/_h5ai/public/js/lib/ext/peer5.js diff --git a/src/_h5ai/public/js/inc/ext/piwik-analytics.js b/src/_h5ai/public/js/lib/ext/piwik-analytics.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/piwik-analytics.js rename to src/_h5ai/public/js/lib/ext/piwik-analytics.js diff --git a/src/_h5ai/public/js/inc/ext/preview-aud.js b/src/_h5ai/public/js/lib/ext/preview-aud.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/preview-aud.js rename to src/_h5ai/public/js/lib/ext/preview-aud.js diff --git a/src/_h5ai/public/js/inc/ext/preview-img.js b/src/_h5ai/public/js/lib/ext/preview-img.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/preview-img.js rename to src/_h5ai/public/js/lib/ext/preview-img.js diff --git a/src/_h5ai/public/js/inc/ext/preview-txt.js b/src/_h5ai/public/js/lib/ext/preview-txt.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/preview-txt.js rename to src/_h5ai/public/js/lib/ext/preview-txt.js diff --git a/src/_h5ai/public/js/inc/ext/preview-vid.js b/src/_h5ai/public/js/lib/ext/preview-vid.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/preview-vid.js rename to src/_h5ai/public/js/lib/ext/preview-vid.js diff --git a/src/_h5ai/public/js/inc/ext/preview.js b/src/_h5ai/public/js/lib/ext/preview.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/preview.js rename to src/_h5ai/public/js/lib/ext/preview.js diff --git a/src/_h5ai/public/js/inc/ext/search.js b/src/_h5ai/public/js/lib/ext/search.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/search.js rename to src/_h5ai/public/js/lib/ext/search.js diff --git a/src/_h5ai/public/js/inc/ext/select.js b/src/_h5ai/public/js/lib/ext/select.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/select.js rename to src/_h5ai/public/js/lib/ext/select.js diff --git a/src/_h5ai/public/js/inc/ext/sort.js b/src/_h5ai/public/js/lib/ext/sort.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/sort.js rename to src/_h5ai/public/js/lib/ext/sort.js diff --git a/src/_h5ai/public/js/inc/ext/thumbnails.js b/src/_h5ai/public/js/lib/ext/thumbnails.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/thumbnails.js rename to src/_h5ai/public/js/lib/ext/thumbnails.js diff --git a/src/_h5ai/public/js/inc/ext/title.js b/src/_h5ai/public/js/lib/ext/title.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/title.js rename to src/_h5ai/public/js/lib/ext/title.js diff --git a/src/_h5ai/public/js/inc/ext/tree.js b/src/_h5ai/public/js/lib/ext/tree.js similarity index 100% rename from src/_h5ai/public/js/inc/ext/tree.js rename to src/_h5ai/public/js/lib/ext/tree.js diff --git a/src/_h5ai/public/js/inc/main/index.js b/src/_h5ai/public/js/lib/main/index.js similarity index 100% rename from src/_h5ai/public/js/inc/main/index.js rename to src/_h5ai/public/js/lib/main/index.js diff --git a/src/_h5ai/public/js/inc/main/info.js b/src/_h5ai/public/js/lib/main/info.js similarity index 100% rename from src/_h5ai/public/js/inc/main/info.js rename to src/_h5ai/public/js/lib/main/info.js diff --git a/src/_h5ai/public/js/inc/model/item.js b/src/_h5ai/public/js/lib/model/item.js similarity index 100% rename from src/_h5ai/public/js/inc/model/item.js rename to src/_h5ai/public/js/lib/model/item.js diff --git a/src/_h5ai/public/js/inc/view/content.js b/src/_h5ai/public/js/lib/view/content.js similarity index 100% rename from src/_h5ai/public/js/inc/view/content.js rename to src/_h5ai/public/js/lib/view/content.js diff --git a/src/_h5ai/public/js/inc/view/mainrow.js b/src/_h5ai/public/js/lib/view/mainrow.js similarity index 100% rename from src/_h5ai/public/js/inc/view/mainrow.js rename to src/_h5ai/public/js/lib/view/mainrow.js diff --git a/src/_h5ai/public/js/inc/view/notification.js b/src/_h5ai/public/js/lib/view/notification.js similarity index 100% rename from src/_h5ai/public/js/inc/view/notification.js rename to src/_h5ai/public/js/lib/view/notification.js diff --git a/src/_h5ai/public/js/inc/view/root.js b/src/_h5ai/public/js/lib/view/root.js similarity index 100% rename from src/_h5ai/public/js/inc/view/root.js rename to src/_h5ai/public/js/lib/view/root.js diff --git a/src/_h5ai/public/js/inc/view/sidebar.js b/src/_h5ai/public/js/lib/view/sidebar.js similarity index 100% rename from src/_h5ai/public/js/inc/view/sidebar.js rename to src/_h5ai/public/js/lib/view/sidebar.js diff --git a/src/_h5ai/public/js/inc/view/topbar.js b/src/_h5ai/public/js/lib/view/topbar.js similarity index 80% rename from src/_h5ai/public/js/inc/view/topbar.js rename to src/_h5ai/public/js/lib/view/topbar.js index a490decd..932ecf73 100644 --- a/src/_h5ai/public/js/inc/view/topbar.js +++ b/src/_h5ai/public/js/lib/view/topbar.js @@ -4,7 +4,7 @@ modulejs.define('view/topbar', ['$', 'view/root'], function ($, root) { '
' + '
' + '
' + - '' + + '' + '
powered
' + '
by h5ai
' + '
' + diff --git a/src/_h5ai/public/js/inc/view/view.js b/src/_h5ai/public/js/lib/view/view.js similarity index 100% rename from src/_h5ai/public/js/inc/view/view.js rename to src/_h5ai/public/js/lib/view/view.js diff --git a/src/_h5ai/public/js/inc/view/viewmode.js b/src/_h5ai/public/js/lib/view/viewmode.js similarity index 100% rename from src/_h5ai/public/js/inc/view/viewmode.js rename to src/_h5ai/public/js/lib/view/viewmode.js diff --git a/src/_h5ai/public/js/scripts.js b/src/_h5ai/public/js/scripts.js index 87fc159a..8375817a 100644 --- a/src/_h5ai/public/js/scripts.js +++ b/src/_h5ai/public/js/scripts.js @@ -25,7 +25,7 @@ modulejs.define('marked', function () { return win.marked; }); modulejs.define('prism', function () { return win.Prism; }); - // @include 'inc/**/*.js' + // @include 'lib/**/*.js' modulejs.require('boot'); }()); diff --git a/test/scripts.js b/test/scripts.js index 3f7c2227..53aa541e 100644 --- a/test/scripts.js +++ b/test/scripts.js @@ -25,7 +25,7 @@ $(function () { describe('integration tests', function () { // @include "tests/integration/*.js" - // @include "tests/integration/*/*.js" + // @-include "tests/integration/*/*.js" }); }); diff --git a/test/styles.less b/test/styles.less index 14a85dc3..5f478833 100644 --- a/test/styles.less +++ b/test/styles.less @@ -40,6 +40,7 @@ font-weight: bold; line-height: 32px; padding: 0 8px; + text-shadow: 0 0 4px @col-text; &.pass { background: @col-pass; diff --git a/test/tests/unit/view/topbar.js b/test/tests/unit/view/topbar.js index 1ece11ef..f76b28d8 100644 --- a/test/tests/unit/view/topbar.js +++ b/test/tests/unit/view/topbar.js @@ -97,13 +97,13 @@ describe('module \'' + ID + '\'', function () { it('#backlink has correct href', function () { this.applyFn(); - assert.strictEqual($('#backlink').attr('href'), 'http://larsjung.de/h5ai/'); + assert.strictEqual($('#backlink').attr('href'), 'https://larsjung.de/h5ai/'); }); it('#backlink has correct title', function () { this.applyFn(); - assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai - http://larsjung.de/h5ai/'); + assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai - https://larsjung.de/h5ai/'); }); it('#backlink has correct text', function () { diff --git a/test/util/mocha.js b/test/util/mocha.js index 64d2816d..158fd2d7 100644 --- a/test/util/mocha.js +++ b/test/util/mocha.js @@ -14,7 +14,6 @@ var $mochaProgress = $mochaBar.find('.progress'); function toggleFailureFilter(ev) { - ev.stopImmediatePropagation(); showOnlyFailures = !showOnlyFailures; @@ -27,8 +26,6 @@ function toggleFailureFilter(ev) { } function addSuiteStats() { - /*jshint validthis: true */ - var $suite = $(this); var tests = $suite.find('.test').length; @@ -65,16 +62,12 @@ function addSuiteStats() { } function fixCodeFormatting() { - /*jshint validthis: true */ - var $code = $(this); $code.text($code.text().trim().replace(/;\n\s*/g, ';\n')); } function onEnd() { - /*jshint validthis: true */ - var runner = this; var failed = runner.stats.failures > 0; var stats = (runner.stats.duration / 1000.0).toFixed(3) + 's'; @@ -91,8 +84,6 @@ function onEnd() { } function onTest() { - /*jshint validthis: true */ - var runner = this; var percent = 100.0 * runner.stats.tests / runner.total; var stats = ((new Date().getTime() - runner.stats.start) / 1000.0).toFixed(3) + 's'; @@ -105,14 +96,12 @@ function onTest() { } function setupMocha() { - window.assert = chai.assert; mocha.setup('bdd'); $(function () { $mochaBar.appendTo('#mocha'); }); } function runMocha() { - mocha.run().on('test', onTest).on('end', onEnd); }