Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Every contribution is welcome, even in this early stage!

1. Clone this repository (or a fork of it).
2. Run `npm install` after first cloning or every time new dependencies are added in [package.json](package.json) in order to install the needed Node dependencies. (You can identify missing dependencies when the error "Cannot find module" is given.)
3. To start the server locally at [localhost:5000](http://localhost:5000/), run `node index.js` (or `heroku local`, which lets you use environment variables in the `.env` file).
3. To start the server locally at [localhost:5000](http://localhost:5000/), run `node main.js` (or `heroku local`, which lets you use environment variables in the `.env` file).
2 changes: 2 additions & 0 deletions index.js → main.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/node

const express = require('express');
const app = express();
const fs = require('fs');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"engines": {
"node": "6.10.0"
},
"main": "index.js",
"main": "main.js",
"scripts": {
"start": "node index.js"
"start": "node main.js"
},
"dependencies": {
"express": "4.14.1"
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures_valid.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/node

const fs = require('fs');
const path = require('path');
const colors = require('colors');
Expand Down
4 changes: 3 additions & 1 deletion tests/http_status.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/node

const fs = require('fs');
const path = require('path');
const http = require('http');
Expand Down Expand Up @@ -46,7 +48,7 @@ for (const cat in register.categories) {
// start server
const serverProcess = require('child_process').execFile(
'node',
[path.join(__dirname, '..', 'index.js')]
[path.join(__dirname, '..', 'main.js')]
);
serverProcess.stdout.on('data', chunk => {
console.log('Server message (stdout):');
Expand Down
2 changes: 2 additions & 0 deletions tests/register_correct.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/node

const fs = require('fs');
const path = require('path');
const colors = require('colors');
Expand Down
2 changes: 1 addition & 1 deletion views/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function(options) {

str += '<p><abbr title="Open Fixture Library">OFL</abbr> tries to solve those problems by collecting fixture definitions and making them downloadable in various formats. Everybody can <a href="https://github.com/FloEdelmann/open-fixture-library">contribute</a> and help to improve!</p>';

str += '<p>The project is still in a very early status, but you can still check out the progress on <a href="https://github.com/FloEdelmann/open-fixture-library">GitHub</a> and also already report issues or feature requests or even contribute some code. Thanks!</p>';
str += '<p>The project is still in a very early state, but you can still check out the progress on <a href="https://github.com/FloEdelmann/open-fixture-library">GitHub</a> and also already report issues or feature requests or even contribute some code. Thanks!</p>';

str += require('../partials/footer')(options);

Expand Down
54 changes: 51 additions & 3 deletions views/pages/single_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ module.exports = function(options) {
const {manufacturers, man, fix} = options;
const manufacturer = manufacturers[man];

options.title = `${man} ${fix} - Open Fixture Library`;

const fixture = JSON.parse(fs.readFileSync(path.join(options.baseDir, 'fixtures', man, fix + '.json'), 'utf-8'));

options.title = `${manufacturer.name} ${fixture.name} - Open Fixture Library`;

let str = require('../partials/header')(options);

str += `<h1><a href="/${man}"><data data-key="manufacturer">${manufacturer.name}</data></a> <data data-key="name">${fixture.name}</data> <code><data data-key="shortName">${_(fixture.shortName)}</data></code></h1>`;

str += '<section class="fixture-meta">';
str += ` <span class="last-modify-date">Last modified: <date>${fixture.meta.lastModifyDate}</date></span>`;
str += ` <span class="create-date">Created: <date>${fixture.meta.createDate}</date></span>`;
str += ` <span class="authors">Authors: <data>${fixture.meta.authors.join(', ')}</data></span>`;
str += ` <span class="revisions"><a href="http://github.com/FloEdelmann/open-fixture-library/commits/master/fixtures/${man}/${fix}.json">Revisions</a></span>`;
str += '</section>';

str += `<section class="fixture-info">`;

str += '<section class="categories">';
Expand All @@ -38,6 +45,7 @@ module.exports = function(options) {
str += `</details>`;

fixture.modes.forEach(mode => {
str += '<section class="mode">';
str += `<h2>${mode.name} <code>${_(mode.shortName)}</code></h2>`;

if (mode.physical) {
Expand All @@ -58,15 +66,55 @@ module.exports = function(options) {
let channel = fixture.availableChannels[ch];

str += `<li data-index="${i}">`;
str += `<details class="channel">`;
str += `<details class="channel" data-channel="${ch}">`;
str += `<summary>${channel.name || ch}</summary>`;
str += handleChannel(channel);
str += `</details>`;
str += `</li>`;
});
str += `</ol>`;
str += `</section>`;
});

str += '<section class="multi-byte-channels">';
str += '<h2>Multi-byte channels</h2>';
if (fixture.multiByteChannels) {
str += '<ul>';
fixture.multiByteChannels.forEach(multiByteChannel => {
str += '<li>';
str += multiByteChannel.map(channel => {
const name = fixture.availableChannels[channel].name || channel;
return `<data class="channel" data-channel="${channel}">${name}</data>`;
}).join(', ');
str += `</li>`;
});
str += '</ul>';
}
else {
str += '<p>None</p>';
}
str += `</section>`;

str += '<section class="heads">';
str += '<h2>Heads</h2>';
if (fixture.heads) {
str += '<ul>';
for (const head in fixture.heads) {
str += '<li>';
str += `<strong>${head}:</strong> `;
str += fixture.heads[head].map(channel => {
const name = fixture.availableChannels[channel].name || channel;
return `<data class="channel" data-channel="${channel}">${name}</data>`;
}).join(', ');
str += `</li>`;
}
str += '</ul>';
}
else {
str += '<p>None</p>';
}
str += `</section>`;

str += `</section>`;


Expand Down
2 changes: 1 addition & 1 deletion views/pages/single_manufacturer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function(options) {
const {manufacturers, register, man} = options;
const manufacturer = manufacturers[man];

options.title = man + ' - Open Fixture Library';
options.title = manufacturer.name + ' - Open Fixture Library';


let str = require('../partials/header')(options);
Expand Down