Skip to content

Commit

Permalink
Merge pull request #5 from Picolab/core-v0.19.x
Browse files Browse the repository at this point in the history
Core v0.19.x
  • Loading branch information
farskipper authored Feb 21, 2017
2 parents 21369de + 8a2d7de commit ad5ce7b
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 688 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"extends": "eslint:recommended",
"rules": {
"indent": "off",
"indent": ["error", 4],
"no-console": "off",
"quotes": ["error", "double"],
"no-trailing-spaces": "error",
Expand Down
13 changes: 1 addition & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
language: node_js
node_js:
- "7"
- "6"
- "4"

#Build settings for node-fibers
env:
- CXX=g++-4.8

#Build settings for node-fibers
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
},
"dependencies": {
"body-parser": "^1.15.2",
"contra": "^1.9.4",
"express": "^4.14.0",
"home-dir": "^1.0.0",
"krl-compiler": "^0.20.0",
"krl-compiler": "^0.26.3",
"leveldown": "^1.4.6",
"lodash": "^4.11.2",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"pico-engine-core": "^0.15.6"
"pico-engine-core": "^0.20.1",
"request": "^2.79.0"
}
}
39 changes: 0 additions & 39 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,17 @@
<link rel="icon" type="image/png" href="pico-logo-transparent-48x48.png">
<title>Pico Bootstrap</title>
<script src="js/jquery-3.1.0.min.js" type="text/javascript"></script>
<script src="js/index.js" type="text/javascript"></script>
<style type="text/css">
h1.title {
display: inline-block;
font-family: Arial, sans-serif;
margin: 0 0 0 120px;
padding-top: 18px;
}
a.logo img {
vertical-align: top;
}
a.logo {
cursor: pointer;
}
#review {
display: none;
}
#review.problem {
display: block;
}
#done {
display: none;
}
#done.okay {
display: block;
}
</style>
</head>
<body>
<a class="logo" href="http://picolabs.io"><img src="logo.png" alt="logo"></a>
<h1 class="title">Pico Bootstrap</h1>
<div id="operations">
<h2>Operations log</h2>
<pre></pre>
</div>
<div id="review">
<h3>Review operations log</h3>
<p>
Check the operations log, above.
Any problems will appear as
"*Problem..."
Please report any problems.
</p>
</div>
<div id="done">
<h2>Done</h2>
<p>
The bootstrap is now complete.
</p>
<h3>Managing Picos</h3>
<p>
Visit the <a href="mypicos.html" target="mypicos">My Picos</a>
Expand Down Expand Up @@ -84,6 +46,5 @@ <h2>Reset database</h2>
each time you
clear the database.
</p>
</div>
</body>
</html>
115 changes: 0 additions & 115 deletions public/js/index.js

This file was deleted.

58 changes: 15 additions & 43 deletions public/js/mypicos.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,53 +224,25 @@ $.getJSON("/api/db-dump", function(db_dump){
}
log("Loading ruleset source code");
log("URL: "+url);
$.get(url,function(k){
if (k && k.length > 0) {
log("Length: "+k.length);
$.getJSON("/api/ruleset/compile",{"src":k},function(rc){
if (rc.code) {
var rid = rc.code.split(/"/)[3];
log("Registering: "+rid);
$.getJSON("/api/ruleset/register-and-enable",{"src":k},function(rr){
if (rr && rr.ok) {
log(rid+" registered and enabled");
log("Installing: "+rid);
$.getJSON("/api/ruleset/install/"+rid,function(ri){
if (ri && ri.ok) {
log(rid+" installed");
log("Adding "+rid+" to pico: "+eci);
$.getJSON(
"/sky/event/"+eci+"/add-ruleset/pico/new_ruleset"
+"?rid="+rid,
function(ra){
if (ra && ra.directives) {
log(rid+" added to pico");
callback();
} else {
logProblem("adding "+rid);
}
});
} else {
logProblem("installing "+rid);
}
}).fail(function() {
logProblem("installing "+rid+": failed to compile");
});
} else {
logProblem("registering "+rid);
}
});
} else {
logProblem("failed to validate");
if (rc.error) {
log(rc.error);
$.getJSON("/api/ruleset/register",{"url": url},function(rr){
if (rr && rr.ok) {
log(rr.rid+" registered");
log("Adding "+rr.rid+" to pico: "+eci);
$.getJSON(
"/sky/event/"+eci+"/add-ruleset/pico/new_ruleset"
+"?rid="+rr.rid,
function(ra){
if (ra && ra.directives) {
log(rr.rid+" added to pico");
callback();
} else {
logProblem("adding "+rr.rid);
}
}
});
} else {
logProblem("getting "+rid);
logProblem("registering");
}
},"text");
});
};
e.preventDefault();
var args = formToJSON(this);
Expand Down
12 changes: 2 additions & 10 deletions public/js/ruleset.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,9 @@ $.getJSON("/api/db-dump", function(db_dump){
return;
}
var rid = rc.code.split(/"/)[3];
$.getJSON("/api/ruleset/register-and-enable",{"src":src},function(rr){
$.getJSON("/api/ruleset/register",{"src":src},function(rr){
if (rr && rr.ok) {
$.getJSON("/api/ruleset/install/"+rid,function(ri){
if (ri && ri.ok) {
location.reload();
} else {
$feedback.html("Problem installing "+rid);
}
}).fail(function() {
$feedback.html("Problem installing "+rid+": failed to compile");
});
location.reload();
} else {
$feedback.html("Problem registering "+rid);
}
Expand Down
7 changes: 3 additions & 4 deletions public/js/student.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ $(document).ready(function() {
callback(own_eci);
} else {
log("Finding owner pico");
$.getJSON("/api/owner-channel", function(owner){
if (owner.channel) {
for (var k in owner.channel) { own_eci = k; break; }
log("Owner pico id is "+get(owner.channel,[own_eci,"pico_id"]));
$.getJSON("/api/owner-eci", function(owner){
if (owner.ok && owner.eci) {
own_eci = owner.eci;
$("#own_eci").val(own_eci);
callback(own_eci);
} else {
Expand Down
Loading

0 comments on commit ad5ce7b

Please sign in to comment.