Skip to content

Commit

Permalink
Update deps to allow multi-dynamic middlwares
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Jan 27, 2015
1 parent 60ffd2b commit 26776ff
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion example.proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bs.use(cp);
//bs.use(client);

bs({
proxy: "swoon.static",
proxy: "localhost:8080",
open: false,
//tunnel: true
port: 4000
Expand Down
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ module.exports.hooks = {
/**
* Client JS is added to each connected client
*/
"client:js": require("fs").readFileSync(__dirname + config.defaults.clientJs),
"server:middleware": function () {
return [
require("./lib/plugins/remote-debug/remote-debug").throttleMiddleware()
]
}
"client:js": require("fs").readFileSync(__dirname + config.defaults.clientJs)
};

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/client-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function enableElement (clients, ui, bs) {
return function (file) {

var item = ui.getOptionIn([CLIENT_FILES_OPT, file.name]).toJS();

if (item.active) {
return;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/plugins/remote-debug/remote-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module.exports = {

weinre.init(ui);

//timeout = 4000;

ui.socket.on("connection", function (client) {
client.on("cp:weinre:toggle", weinre.toggleWeinre.bind(null, ui.socket, ui.clients, ui, bs));
client.on("cp:clientfile:enable", enableClientFile.bind(null, ui));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"devDependencies": {
"angular-mocks": "^1.3.8",
"async": "^0.9.0",
"browser-sync": "git://github.com/shakyshane/browser-sync#v2-rc2.9",
"browser-sync": "git://github.com/shakyshane/browser-sync#v2-rc3.2",
"bs-html-injector": "^1.2.1",
"chai": "^1.9.1",
"crossbow": "^0.2.0",
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,5 @@ <h4>Subheading</h4>
</div>
</div> <!-- /container -->

<script type='text/javascript' id="__bs_script__">//<![CDATA[
document.write("<script async src='//HOST:3000/browser-sync/browser-sync-client.1.9.0.js'><\/script>".replace(/HOST/g, location.hostname).replace(/PORT/g, location.port));
//]]></script>

</body>
</html>
34 changes: 34 additions & 0 deletions test/server/remote-debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*jshint -W079 */
var browserSync = require("browser-sync");
var ui = require("../../index");
var request = require("request");

describe.only("Remote debug", function () {

var bsInstance, uiInstance;
this.timeout(10000);
before(function (done) {

browserSync.use(ui);

var config = {
online: false,
open: false,
server: "test/fixtures"
};

bsInstance = browserSync(config, function (err, bs) {
uiInstance = bs.pluginManager.getReturnValues("UI")[0].value;
done();
}).instance;
});
after(function () {
bsInstance.cleanup();
});
it("should init", function (done) {

request(bsInstance.options.getIn(["urls", "local"]) + "/shane", function (err, res, body) {
done();
});
});
});

0 comments on commit 26776ff

Please sign in to comment.