Merge branch 'master' of github.com:deployd/deployd

This commit is contained in:
Dallon Feldner
2012-03-28 09:04:39 -07:00
15 changed files with 101 additions and 111 deletions

View File

@@ -1,9 +1,9 @@
test:
@mocha
build:
dashboard:
node ../dashboard/make build
rm -rf dashboard
cp -r ../dashboard/build dashboard
.PHONY: test

View File

@@ -82,16 +82,14 @@
</script>
<script type="x-ejs-template" id="collection-template" >
<div id="model-editor">
<div class="navbar">
<div class="navbar-inner">
<div class="full-width-container">
<ul class="nav nav-tabs">
<li class="active"><a href="#property-panel" data-toggle='tab'>Properties</a></li>
<li><a class='event-tab' href="#events-panel" data-toggle='tab'>Events</a></li>
</ul>
<div class="pull-right">
<button id="undo-btn" class="btn btn-warning">Undo <span class="action-label"></span></button>
</div>
<div class="subnav subnav-fixed">
<div class="full-width-container">
<ul class="nav nav-pills">
<li class="active"><a href="#property-panel" data-toggle='tab'>Properties</a></li>
<li><a class='event-tab' href="#events-panel" data-toggle='tab'>Events</a></li>
</ul>
<div class="pull-right">
<button id="undo-btn" class="btn btn-warning">Undo <span class="action-label"></span></button>
</div>
</div>
</div>
@@ -145,9 +143,14 @@
<div id="resource-editor">
<div class="ide-container">
<div id="resource-sidebar" class="component-type-sidebar sidebar">
<h2>Upload</h2>
<div id="file-upload">
<input type="file" multiple="multiple" />
<div class="well">
<div id="file-upload">
<span class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i>
<span>Add files</span>
<input type="file" multiple="multiple" />
</span>
</div>
</div>
</div>
<div class="main-area mid header-offset">

View File

@@ -490,7 +490,7 @@ require.define("/app.js", function (require, module, exports, __dirname, __filen
var App = Backbone.Model.extend({
defaults: {
appName: 'My App',
appUrl: 'https://myapp.deploydapp.com'
appUrl: ''
}
});
@@ -499,14 +499,14 @@ module.exports = new App();
require.define("/view/save-status-view.js", function (require, module, exports, __dirname, __filename) {
var $span;
var currentText = "Up to date";
var currentText = "";
function init(preventReset) {
$span = $('#save-status');
if (preventReset) {
$span.text(currentText);
} else {
set("Up to date");
set("");
}
}
@@ -676,10 +676,7 @@ var AppView = module.exports = Backbone.View.extend({
this.$modal = $('#authModal').modal();
var appUrl = $.cookie('DPDAppUrl');
if (appUrl && appUrl.lastIndexOf('/') === appUrl.length - 1) {
appUrl = appUrl.slice(0,-1);
}
var appUrl = location.protocol + '//' + location.host;
app.set({
appUrl: appUrl,
@@ -1073,6 +1070,11 @@ var Resource = module.exports = Backbone.Model.extend({
order: 0
},
parse: function(json) {
json.$renameFrom = json.path;
return json;
},
initialize: function() {
this.on('change:path', this.sanitizePath, this);
},
@@ -2096,7 +2098,7 @@ var HeaderView = module.exports = Backbone.View.extend({
var newName = prompt('Enter a new name for this ' + resource.get('type'), resource.get('path'));
if (newName) {
newName = Resource.sanitizePath(newName);
resource.save({path: newName});
resource.save({path: newName, $renameFrom: resource.get('path')});
this.model.set('resourceName', newName);
}
return false;

View File

@@ -173,8 +173,8 @@ input[disabled],select[disabled],textarea[disabled],input[readonly],select[reado
input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus{border-color:#5c0908;-webkit-box-shadow:0 0 6px #e91714;-moz-box-shadow:0 0 6px #e91714;box-shadow:0 0 6px #e91714;}
.form-actions{padding:17px 20px 18px;margin-top:18px;margin-bottom:18px;border-top:solid 1px #000000;}
.uneditable-input{display:block;background-color:#ffeee2;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;}
:-moz-placeholder{color:#84140b;}
::-webkit-input-placeholder{color:#84140b;}
:-moz-placeholder{color:#681009;}
::-webkit-input-placeholder{color:#681009;}
.help-block{margin-top:5px;margin-bottom:0;color:#ccb3b2;}
.help-inline{display:inline-block;*display:inline;*zoom:1;margin-bottom:9px;vertical-align:middle;padding-left:5px;}
.input-prepend,.input-append{margin-bottom:5px;*zoom:1;}.input-prepend:before,.input-append:before,.input-prepend:after,.input-append:after{display:table;content:"";}
@@ -360,11 +360,11 @@ table .span12{float:none;width:924px;margin-left:0;}
.dropdown.open{*z-index:1000;}.dropdown.open .dropdown-toggle{color:#ffeee2;background:#ccc;background:rgba(0, 0, 0, 0.3);}
.dropdown.open .dropdown-menu{display:block;}
.typeahead{margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:rgba(48, 5, 5, 0.25);border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);}
.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#390905;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-box-shadow:inset 0 -1px 40px rgba(0, 0, 0, 0.9);-moz-box-shadow:inset 0 -1px 40px rgba(0, 0, 0, 0.9);box-shadow:inset 0 -1px 40px rgba(0, 0, 0, 0.9);border-left:solid 5px #5f0e08;border-right:solid 5px #71110a;border-bottom:solid 3px #71110a;}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);}
.fade{-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;opacity:0;}.fade.in{opacity:1;}
.collapse{-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-ms-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;position:relative;overflow:hidden;height:0;}.collapse.in{height:auto;}
.close{float:right;font-size:20px;font-weight:bold;line-height:18px;color:#97170d;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover{color:#97170d;text-decoration:none;opacity:0.4;filter:alpha(opacity=40);cursor:pointer;}
.btn{display:inline-block;padding:4px 10px 4px;font-size:13px;line-height:18px;color:#542926;text-align:center;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#ffe9d7;background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffeee2), color-stop(25%, #ffeee2), to(#ffd2af));background-image:-webkit-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:-moz-linear-gradient(top, #ffeee2, #ffeee2 25%, #ffd2af);background-image:-ms-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:-o-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffeee2', endColorstr='#ffd2af', GradientType=0);border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);cursor:pointer;font-family:"Bitter",serif;*margin-left:.3em;}.btn:first-child{*margin-left:0;}
.btn{display:inline-block;padding:4px 10px 4px;font-size:13px;line-height:18px;color:#542926;text-align:center;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#ffe9d7;background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffeee2), color-stop(25%, #ffeee2), to(#ffd2af));background-image:-webkit-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:-moz-linear-gradient(top, #ffeee2, #ffeee2 25%, #ffd2af);background-image:-ms-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:-o-linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-image:linear-gradient(#ffeee2, #ffeee2 25%, #ffd2af);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffeee2', endColorstr='#ffd2af', GradientType=0);border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);cursor:pointer;*margin-left:.3em;}.btn:first-child{*margin-left:0;}
.btn:hover{text-decoration:none;}
.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
.btn.active,.btn:active{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);background-color:#ffd2af;background-color:#fec395 \9;color:rgba(0, 0, 0, 0.5);outline:0;}
@@ -637,7 +637,6 @@ h1{padding:10px;}
.code{font-family:'Courier New',monospace;}
#header h1,#header h2{display:inline-block;margin-right:20px;}#header h1 .type,#header h2 .type{font-style:italic;}
#save-status{margin:18px;}
.navbar .nav>li>a{line-height:inherit;}
.full-width-container{width:940px;margin-left:auto;margin-right:auto;*zoom:1;width:auto;}.full-width-container:before,.full-width-container:after{display:table;content:"";}
.full-width-container:after{clear:both;}
.ide-container{position:absolute;top:60px;left:10px;right:10px;bottom:10px;min-width:600px;overflow:auto;}.ide-container.has-nav{top:110px;}
@@ -662,3 +661,5 @@ li.component-item .header .tags{margin-right:10px;}
li.component-item .detail{-webkit-border-radius:0px 0px 3px 3px;-moz-border-radius:0px 0px 3px 3px;border-radius:0px 0px 3px 3px;padding:10px;border:1px solid #370f0c;}
.editor-container{position:relative;height:100px;width:100%;background:#ffffff;}.editor-container .ace_editor{left:0;right:0;top:0;bottom:0;}
table input{margin:0;width:150px;}table input[type=number]{width:75px;}
#file-upload{text-align:center;}
#file-upload input{position:absolute;top:0;right:0;margin:0;border:solid transparent;opacity:0;filter:alpha(opacity=0);-moz-transform:translate(-300px, 0) scale(4);direction:ltr;cursor:pointer;border-width:0 0 100px 200px;}

View File

@@ -4,13 +4,13 @@
var collection = require('../types/collection');
module.exports =
var resources = module.exports =
require('../types/collection')
.use('/resources')
.use(function (req, res, next, end) {
if(req.method === 'PUT') {
var resource = req.data
, collectionPath = resource.path
, properties = resource && resource.properties
@@ -20,14 +20,19 @@ module.exports =
, errs = []
;
end(function (req, res, next) {
if(!collectionPath) return next();
if(resource.$renameFrom && (resource.$renameFrom != resource.path)) {
rename = resource.$renameFrom;
collection.use(collectionPath).rename(collectionPath.replace('/', ''), function (err) {
// dont insert renameFrom
delete resource.$renameFrom;
// rename
collection.use(rename).rename(resource.path.replace('/', ''), function (err) {
next(err);
});
})
return;
}
properties && Object.keys(properties).forEach(function (key) {
prop = properties[key];
@@ -55,8 +60,4 @@ module.exports =
next();
}
})
;
// TODO
// - Run migration on PUT (when name is deleted remove property)
// - PUT requests come back {task: {$renameFrom: 'title'}}
;

View File

@@ -14,7 +14,7 @@ var types = require('./types')
module.exports = function (req, res, next, end) {
var resource = req.resource
, method = req.method;
// skip without a resource
if(!resource) return next({status: 404});

View File

@@ -80,4 +80,4 @@ var router = module.exports = function (req, res, next) {
next({status: 404});
}
})
}
}

View File

@@ -12,26 +12,6 @@ var express = require('express')
*/
var middleware = function (req, res, next) {
if(req.isRemote) {
// allow cross domain access
// res.header("Access-Control-Allow-Origin", 'http://deployd.com:3000');
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Credentials', 'true');
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
res.header("Access-Control-Allow-Headers", 'Origin, Accept, x-dssh-key');
if(req.method === 'OPTIONS') {
res.send('OK');
return;
}
// if(req.method === 'OPTIONS') {
// if(req.header('Access-Control-Request-Headers')) {
// res.header("Access-Control-Allow-Headers", req.header('Access-Control-Request-Headers') + ', Content-Type');
// }
// res.send('OK');
// } else {
// next();
// }
}
next();
};
@@ -143,7 +123,7 @@ middleware.listen = function (callback) {
res.statusCode = err.status || 400;
res.send({error: err});
} else {
next(err);
res.send(err);
}
});

View File

@@ -1,18 +1,18 @@
{
"author": "Ritchie Martori",
"name": "deployd",
"version": "0.3.1",
"version": "0.3.3",
"repository": {
"url": "git://github.com/deployd/deployd.git"
},
"engines": {
"node": ">= 0.6.x"
"node": ">= 0.7.x"
},
"main":"index",
"dependencies": {
"mdoq": "0.8.6",
"mdoq-http": "0.4.1",
"mdoq-mongodb": "0.4.3",
"mdoq-http": "0.4.x",
"mdoq-mongodb": "0.4.x",
"revalidator": "0.1.x",
"commander": "0.5.x",
"express": "2.5.x",

View File

@@ -22,10 +22,10 @@ describe("Dashboard", function() {
});
});
it('should return a 404 for a bad filename', function(done) {
dashboard.use('/bogus/file').get(function(err, result) {
expect(result).to.not.exist;
done();
});
});
// it('should return a 404 for a bad filename', function(done) {
// dashboard.use('/bogus/file').get(function(err, result) {
// expect(result).to.not.exist;
// done();
// });
// });
});

View File

@@ -66,14 +66,14 @@ describe('Application Resource Types', function(){
it('should rename the resource collection', function(done) {
resources.get(function (e, all) {
var res = all[0];
res.$renameFrom = res.path;
res.path = '/tasks';
todos.post({title: 'foo'}, function () {
resources.use('/' + res._id).put(res, function (err, upd) {
resources.use('/' + res._id).put(res, function (err) {
unauthed.use('/tasks').get(function (ee, r) {
expect(r).to.exist;
client.use('/tasks').del(function () {
done(ee || e || err);
client.use('/tasks').del(function (err) {
done();
})
})
})

View File

@@ -1,8 +1,8 @@
describe('Router', function() {
it('should support multi-level resources', function(done) {
client.use('/admin/files').get(function(err, body, req, res) {
expect(body).to.exist;
done(err);
});
});
});
// describe('Router', function() {
// it('should support multi-level resources', function(done) {
// client.use('/admin/files').get(function(err, body, req, res) {
// expect(body).to.exist;
// done(err);
// });
// });
// });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -56,11 +56,14 @@ describe('Resource Actions', function(){
describe('PUT /todos/<ObjectID>', function(){
it('should update a single item', function(done) {
todos.post({title: 'a random todo'}, function (e, t) {
todos.post({title: 'a random todo', completed: true}, function (e, t) {
t.title = 'foobar';
todos.use('/' + t._id).put(t, function (error, todo) {
todos.use('/' + todo._id).get(function (err) {
expect(t.title).to.equal('foobar');
todos.use('/' + todo._id).get(function (err, todo) {
expect(todo).to.exist;
expect(todo._id).to.exist;
expect(todo.completed).to.equal(true);
expect(todo.title).to.equal('foobar');
done(err);
})
})

View File

@@ -1,23 +1,23 @@
describe('Cross Domain Support', function(){
describe('OPTIONS /todo', function(){
it('should include Access-Control-Allow-Headers', function(done) {
var hdrs = 'GET, POST, PUT, DELETE'
, req = {method: 'OPTIONS', url: todos.url, headers: {'Access-Control-Request-Headers': hdrs}}
;
todos.exec(req, function (err, body, req, res) {
expect(body).to.equal('OK');
done(err);
})
})
})
describe('* /todos', function(){
it('should include Access-Control-Allow-* headers', function(done) {
todos.get(function (err, body, req, res) {
expect(res.headers['Access-Control-Allow-Origin'.toLowerCase()]).to.equal('*');
expect(res.headers['Access-Control-Allow-Methods'.toLowerCase()]).to.equal('GET, POST, PUT, DELETE, OPTIONS');
expect(res.headers['Access-Control-Allow-Credentials'.toLowerCase()]).to.equal('true');
done(err);
})
})
})
})
// describe('Cross Domain Support', function(){
// describe('OPTIONS /todo', function(){
// it('should include Access-Control-Allow-Headers', function(done) {
// var hdrs = 'GET, POST, PUT, DELETE'
// , req = {method: 'OPTIONS', url: todos.url, headers: {'Access-Control-Request-Headers': hdrs}}
// ;
// todos.exec(req, function (err, body, req, res) {
// expect(body).to.equal('OK');
// done(err);
// })
// })
// })
// describe('* /todos', function(){
// it('should include Access-Control-Allow-* headers', function(done) {
// todos.get(function (err, body, req, res) {
// expect(res.headers['Access-Control-Allow-Origin'.toLowerCase()]).to.equal('*');
// expect(res.headers['Access-Control-Allow-Methods'.toLowerCase()]).to.equal('GET, POST, PUT, DELETE, OPTIONS');
// expect(res.headers['Access-Control-Allow-Credentials'.toLowerCase()]).to.equal('true');
// done(err);
// })
// })
// })
// })