diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 00000000..a8a93901 --- /dev/null +++ b/assets/index.html @@ -0,0 +1,63 @@ + + + + + Making beautiful apps a breeze. · @fabric/maki + + + + + + +
+ +
+
+ +

@fabric/maki

+

Making beautiful apps a breeze.

+
+
+
+
+ + + +
+
+
+ +
+

Preparing content...

+

The application is compiling your document. Unless you've enabled JavaScript or are using the Fabric Browser, this message should not remain visible for long.

+
+
+
+
+
+ + + +
+
+
+
+
+ +
+ + + + +
+ + \ No newline at end of file diff --git a/package.json b/package.json index 7b9ebc62..af0b6397 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "soundtrack.io", - "version": "0.0.0", + "version": "0.2.0-develop", "description": "soundtrack.io is a collaborative online jukebox.", "main": "soundtrack.js", "scripts": { @@ -12,12 +12,14 @@ "author": "Eric Martindale", "license": "MIT", "dependencies": { + "@fabric/core": "FabricLabs/fabric#fabric-0.1.0-develop", "async": "~0.2.9", "body-parser": "^1.11.0", "connect-redis": "^2.2.0", "escape-html": "^1.0.3", "express": "^4.11.2", "express-session": "^1.10.2", + "fabric": "github:martindale/fabric#resources", "flashify": "~0.1.2", "heapdump": "^0.3.5", "jade": "~0.32.0", diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 00000000..a398400c --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,19 @@ +'use strict'; + +const config = require('../config'); + +const SPA = require('@fabric/http/types/spa'); +const Compiler = require('@fabric/http/types/compiler'); + +async function main () { + let spa = new SPA(config); + let compiler = new Compiler({ + document: spa + }); + + compiler.compileTo('assets/index.html'); + + process.exit(); +} + +main(); diff --git a/scripts/server.js b/scripts/server.js new file mode 100644 index 00000000..e69de29b diff --git a/test/Soundtrack.integration.js b/test/Soundtrack.integration.js index be37f8b3..61b2ade6 100644 --- a/test/Soundtrack.integration.js +++ b/test/Soundtrack.integration.js @@ -1,13 +1,33 @@ -var assert = require('assert'); +'use strict'; -before(function() { - var app = require('../soundtrack'); +const assert = require('assert'); + +const Oracle = require('fabric').Oracle; +const Remote = require('fabric').Remote; + +const Soundtrack = require('../lib/soundtrack'); +const soundtrack = new Soundtrack({}); + +const remote = new Remote({ + host: 'localhost:9200', + secure: false }); describe('Soundtrack', function() { - describe('web server', function() { - it('should run', function() { - assert('ok'); + /*describe('web server', function() { + it('should run', function(done) { + app.start(function() { + app.stop(); + done(); + }); + }); + });*/ + + describe('Resources', function () { + it('should retrieve Rooms', async function () { + var rooms = await remote._GET('/rooms'); + console.log('rooms: ', rooms.toString()); + assert.ok(rooms); }); }); }); diff --git a/types/soundtrack.js b/types/soundtrack.js new file mode 100644 index 00000000..d6044a2f --- /dev/null +++ b/types/soundtrack.js @@ -0,0 +1,44 @@ +'use strict'; + +const package = require('../package'); +const Fabric = require('@fabric/core'); + +class Soundtrack extends Fabric.Service { + constructor (settings = {}) { + this.settings = Object.assign({ + name: 'soundtrack', + version: package.version + }, settings); + + this.documents = new Fabric.Collection(); + this.rooms = new Fabric.Collection(); + + this.swarm = new Fabric.Swarm(); + this.worker = new Fabric.Worker(); + + this.state = {}; + } + + async _getState () { + return { + documents: await this.documents.list(), + rooms: await this.documents.list() + } + } + + async stop () { + this.status = 'stopping'; + await this.swarm.stop(); + await this.worker.stop(); + this.status = 'stopped'; + } + + async start () { + this.status = 'starting'; + await this.worker.start(); + await this.swarm.start(); + this.status = 'started'; + } +} + +module.exports = Soundtrack; \ No newline at end of file diff --git a/views/layout.jade b/views/layout.jade index e22adc67..8c2297fb 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -123,7 +123,9 @@ html(lang="en-US", ng-app="soundtrack-io") .container.module .messages - .alert.alert-info Please disable gesture requirement for media playback! This service will not play audio in the background until you do. + if (room) + .alert.alert-info #{room.description} + if (typeof(flash) != 'undefined') if (typeof(flash.error) != 'undefined') for error in flash.error