Permalink
Browse files

refactor package code and simplify parallels env configuration

  • Loading branch information...
futurefear committed Jul 9, 2015
1 parent 48de7eb commit e130c2fc51aeee9815de09a6cded37bad3734884
Showing with 402 additions and 269 deletions.
  1. +5 −1 meteor-app/.meteor/packages
  2. +6 −3 meteor-app/.meteor/versions
  3. +13 −13 meteor-app/client/components/bits/base/bit-utils.js
  4. +1 −1 meteor-app/client/components/bits/base/rendered.js
  5. +1 −1 meteor-app/client/components/bits/sketch/destroyed.js
  6. +8 −8 meteor-app/client/components/bits/sketch/rendered.js
  7. +3 −13 meteor-app/client/components/maps/events.js
  8. +1 −1 meteor-app/client/components/maps/rendered.js
  9. +55 −56 meteor-app/client/components/panels/nav/rendered.js
  10. +1 −1 meteor-app/client/components/panels/panels.js
  11. +5 −14 meteor-app/client/main.js
  12. +5 −5 meteor-app/client/modes/bit.image.preview.js
  13. +9 −9 meteor-app/client/modes/parallel.create.js
  14. +1 −1 meteor-app/packages/infinite-undo/test/unit/commandRegistry-specs.js
  15. +6 −6 meteor-app/packages/parallels-animation/general.js
  16. +6 −6 meteor-app/packages/parallels-animation/image.js
  17. +1 −1 meteor-app/packages/parallels-animation/package.js
  18. +3 −3 meteor-app/packages/parallels-audio/actions.js
  19. +1 −1 meteor-app/packages/parallels-audio/package.js
  20. 0 meteor-app/packages/{parallels-core → parallels-client}/README.md
  21. +26 −26 meteor-app/packages/{parallels-core → parallels-client/lib}/key-bindings.js
  22. +1 −0 meteor-app/packages/parallels-client/lib/main.js
  23. 0 meteor-app/packages/{parallels-core → parallels-client/lib}/markdown-config.js
  24. +7 −0 meteor-app/packages/parallels-client/lib/meteor-reload-config.js
  25. 0 meteor-app/packages/{parallels-core → parallels-client/lib}/vendor/README.md
  26. 0 ...or-app/packages/{parallels-core → parallels-client/lib}/vendor/flocking/flocking-no-jquery.min.js
  27. 0 meteor-app/packages/{parallels-core → parallels-client/lib}/vendor/two/two.min.js
  28. 0 meteor-app/packages/{parallels-core → parallels-client/lib}/vendor/verge/verge.js
  29. +11 −14 meteor-app/packages/{parallels-core → parallels-client}/package.js
  30. +0 −1 meteor-app/packages/parallels-core/log.js
  31. +0 −9 meteor-app/packages/parallels-core/meteor-reload-config.js
  32. +0 −10 meteor-app/packages/parallels-core/namespace.js
  33. 0 meteor-app/packages/parallels-lib/README.md
  34. +6 −2 meteor-app/{ → packages/parallels-lib}/lib/log.js
  35. +17 −0 meteor-app/packages/parallels-lib/lib/utils.js
  36. +5 −0 meteor-app/packages/parallels-lib/namespace.js
  37. +27 −0 meteor-app/packages/parallels-lib/package.js
  38. +46 −0 meteor-app/packages/parallels-lib/test/unit/stringToBoolean_tests.js
  39. 0 meteor-app/packages/parallels-server/README.md
  40. +1 −0 meteor-app/packages/parallels-server/lib/startup.js
  41. +23 −0 meteor-app/packages/parallels-server/package.js
  42. 0 meteor-app/packages/parallels-settings/README.md
  43. +6 −0 meteor-app/packages/parallels-settings/client.js
  44. +5 −0 meteor-app/packages/parallels-settings/namespace.js
  45. +30 −0 meteor-app/packages/parallels-settings/package.js
  46. +15 −0 meteor-app/packages/parallels-settings/server.js
  47. +14 −0 meteor-app/packages/parallels-settings/test/integration/env_tests.coffee
  48. +16 −16 meteor-app/server/bitsCollectionUpdates.js
  49. +1 −1 meteor-app/server/changeStateMethods.js
  50. +1 −1 meteor-app/server/createParallel.js
  51. +4 −4 meteor-app/server/neo4j.js
  52. +0 −38 meteor-app/server/settings.js
  53. +3 −2 package.json
  54. +5 −0 test-env.js
  55. +1 −1 test-scripts/bin/run_meteor_package_units.sh
@@ -7,7 +7,6 @@
meteor-platform
insecure
iron:router
parallels-core
parallels-animation
parallels-audio
lifeinchords:teoria
@@ -33,3 +32,8 @@ msavin:mongol
angelcabo:mousetrap
mquandalle:autofocus
browser-policy
parallels-settings
peerlibrary:classy-test
parallels-lib
parallels-client
parallels-server
@@ -5,7 +5,6 @@ angelcabo:infinite-undo@0.0.1
angelcabo:meteor-gsap@1.16.0
angelcabo:mousetrap@1.0.0
autoupdate@1.2.1
awatson1978:mousetrap@1.0.2
babrahams:editable-json@0.4.3
base64@1.0.3
binary-heap@1.0.3
@@ -73,7 +72,11 @@ ovcharik:howler@1.1.26
parallels-animation@0.0.1
parallels-audio@0.0.1
parallels-canvas-manager@0.0.1
parallels-core@0.0.1
parallels-client@0.0.1
parallels-lib@0.0.1
parallels-server@0.0.1
parallels-settings@0.0.1
peerlibrary:classy-test@0.2.17
practicalmeteor:chai@1.9.2_3
practicalmeteor:loglevel@1.2.0_1
raix:ui-dropped-event@0.0.7
@@ -88,10 +91,10 @@ spacebars@1.0.6
spacebars-compiler@1.0.6
stevezhu:lodash@3.9.3
templating@1.1.1
tinytest@1.0.5
tracker@1.0.7
ui@1.0.6
underscore@1.0.3
url@1.0.4
webapp@1.2.0
webapp-hashing@1.0.3
xolvio:inverter@0.2.0
@@ -1,5 +1,5 @@
makeBitDraggable = function makeBitDraggable($bitElement){
var timeline = new TimelineMax();
// // Needs to happen after position set, or else positions
@@ -14,7 +14,7 @@ makeBitDraggable = function makeBitDraggable($bitElement){
// var x = this.endX;
// var y = this.endY;
// log.debug(event.type, " : dragStart: ", x, " : ", y, " : ", this.getDirection("start"), " : ");
// Parallels.log.debug(event.type, " : dragStart: ", x, " : ", y, " : ", this.getDirection("start"), " : ");
Parallels.Audio.player.play('fx-cinq-drop');
},
@@ -26,21 +26,21 @@ makeBitDraggable = function makeBitDraggable($bitElement){
// TODO: ensure this happens only when in Draggable and mouse is held down
// and not on regular taps/clicks of bit
timeline.to($bitElement, 0.20, {
scale: 1.05,
boxShadow: "rgba(0, 0, 0, 0.2) 0 16px 32px 0",
ease: Expo.easeOut
timeline.to($bitElement, 0.20, {
scale: 1.05,
boxShadow: "rgba(0, 0, 0, 0.2) 0 16px 32px 0",
ease: Expo.easeOut
});
},
onRelease: function(event){
timeline.to(
$bitElement,
0.1,
{
scale: 1,
boxShadow: "0",
ease: Expo.easeOut
$bitElement,
0.1,
{
scale: 1,
boxShadow: "0",
ease: Expo.easeOut
}
);
},
@@ -67,4 +67,4 @@ makeBitDraggable = function makeBitDraggable($bitElement){
});
return draggable;
};
};
@@ -7,7 +7,7 @@ Template.bit.onRendered(function (){
makeBitDraggable($bitElement);
// When a Bit position is updated during a concurrent session (by someone else)
// move the bit to it's new position on all other sessions/clients
Tracker.autorun(function() {
@@ -1,4 +1,4 @@
Template.sketchBit.onDestroyed(function () {
log.debug("bit:sketch:destroy");
Parallels.log.debug("bit:sketch:destroy");
Session.set('bitHoveringId', null);
});
@@ -26,7 +26,7 @@ Template.sketchBit.onRendered(function () {
}
var sketchBit = new SketchBit($bitElement, this.data, npApiPlugin);
var draggable = makeBitDraggable($bitElement);
// track the sketch bit's coordinates and opacity from mongo for concurrent session editing
@@ -55,16 +55,16 @@ Template.sketchBit.onRendered(function () {
var mousetrap = new Mousetrap(template.firstNode);
mousetrap.bind('c', function () {
log.debug("pressed 'c' key");
Parallels.log.debug("pressed 'c' key");
if (sketchBit.isFocused()) {
log.debug("clearing bit:sketch canvas on ", sketchBit._id);
Parallels.log.debug("clearing bit:sketch canvas on ", sketchBit._id);
Parallels.Audio.player.play('fx-pep');
sketchBit.ploma.clear();
}
});
mousetrap.bind('mod+z', function (event) {
log.debug("pressed 'command/ctrl + z'");
Parallels.log.debug("pressed 'command/ctrl + z'");
if (sketchBit.isFocused()) {
// remove the most recent stroke
@@ -78,12 +78,12 @@ Template.sketchBit.onRendered(function () {
});
mousetrap.bind('up', function (event) {
log.debug("pressed 'up' key");
Parallels.log.debug("pressed 'up' key");
event.preventDefault();
Parallels.Audio.player.play('fx-pep');
var opacity = Number(template.firstNode.style.opacity);
log.debug("bit:sketch:opacity = ", opacity);
Parallels.log.debug("bit:sketch:opacity = ", opacity);
if (opacity < 1) {
template.firstNode.style.opacity = opacity + 0.10;
@@ -97,12 +97,12 @@ Template.sketchBit.onRendered(function () {
});
mousetrap.bind('down', function (event) {
log.debug("pressed 'down' key");
Parallels.log.debug("pressed 'down' key");
event.preventDefault();
Parallels.Audio.player.play('fx-pep');
var opacity = Number(template.firstNode.style.opacity);
log.debug("bit:sketch:opacity = ", opacity);
Parallels.log.debug("bit:sketch:opacity = ", opacity);
if (opacity > 0.10) {
template.firstNode.style.opacity = (opacity - 0.10);
@@ -33,9 +33,7 @@ var createImageBit = function (file, downloadUrl, event, uploadKey, index) {
img.src = u;
};
var uploader;
Parallels.Handlers.register('map.events', {
Template.map.events({
'mousemove .map': function (event) {
pointerPosition = {
@@ -54,9 +52,9 @@ Parallels.Handlers.register('map.events', {
var fileUploads = _.map(droppedFiles, function (file, index) {
var uploadKey = Math.random().toString(36).slice(2);
var slingshotUploader = new Slingshot.Upload(uploader);
var slingshotUploader = new Slingshot.Upload(Parallels.settings.get('PARALLELS_FILE_UPLOADER'));
slingshotUploader.send(file, function (error) {
if (error) log.debug({dateTimeStamp: Date.now(), action: 'Image Upload', message: error.message});
if (error) Parallels.log.debug({dateTimeStamp: Date.now(), action: 'Image Upload', message: error.message});
});
Parallels.FileUploads[uploadKey] = slingshotUploader;
createImageBit(file, slingshotUploader.url(true), event, uploadKey, index);
@@ -82,11 +80,3 @@ Parallels.Handlers.register('map.events', {
});
}
});
Template.map.onCreated(function () {
Meteor.call('getSetting', 'uploader', function (err, uploaderSetting) {
uploader = uploaderSetting;
});
});
Template.map.events(Parallels.Handlers.get('map.events'));
@@ -33,7 +33,7 @@ Template.map.onRendered(function () {
function timelineRemoveDone(mapElement) {
$(mapElement).remove();
log.debug("bit:remove:uihook : timeline animate done. removed bit.");
Parallels.log.debug("bit:remove:uihook : timeline animate done. removed bit.");
}
var timelineRemove = new TimelineMax({
@@ -1,62 +1,61 @@
Template.navPanel.rendered = function() {
Meteor.call('getSetting', 'displayIntroAnimation', function (err, displayIntroAnimation) {
if (displayIntroAnimation) {
var timelineSequence = new TimelineMax({ paused: true });
// Greensock .call is similar to its .add,
// except .call lets us pass params to our function
timelineSequence
.add(timelineMenu())
.call(
Parallels.Animation.General.shimmer,
[
{ $elements: $(".map .bit") }
],
"-=0.5")
.play();
// TODO: extract into Animation class
// adapted from: http://codepen.io/vdaguenet/pen/raXBKp
function timelineMenu () {
var menu = $(".nav-panel");
var viewportWidth = verge.viewportW();
var viewportHeight = verge.viewportH();
var timeline = new TimelineMax();
var topToBottomLine = $('.wipe.top-to-bottom .line');
var maskTop = $('.wipe.top-to-bottom .mask.top');
var maskBottom = $('.wipe.top-to-bottom .mask.bottom');
var sideToSideLine = $('.wipe.side-to-side .line');
var maskLeft = $('.wipe.load.side-to-side .mask.left');
var maskRight = $('.wipe.load.side-to-side .mask.right');
TweenMax.set($('.wipe.load.side-to-side'), { alpha: 0 });
timeline.fromTo(topToBottomLine, 0.4, { x: viewportWidth }, { x: 0, ease: Circ.easeIn }, 0);
timeline.fromTo(maskTop, 0.4, { y: 0 }, { y: -viewportHeight / 2, ease: Expo.easeOut, delay: 0.1 }, 0.4);
timeline.fromTo(maskBottom, 0.4, { y: 0 }, { y: viewportHeight / 2, ease: Expo.easeOut, delay: 0.1 }, 0.4);
timeline.set($('.wipe.load.top-to-bottom'), { alpha: 0, display: "none" });
timeline.set($('.wipe.load.side-to-side'), { alpha: 1, display: "block"});
timeline.fromTo(sideToSideLine, 0.4, { y: -viewportHeight}, {y: 0, ease: Circ.easeIn});
timeline.fromTo(maskRight, 0.4, { x: 0 }, {x: viewportWidth / 2, ease: Expo.easeOut, delay: 0.1 }, 1.2); // 2.5
timeline.fromTo(maskLeft, 0.4, { x: 0 }, {x: -viewportWidth / 2, ease: Expo.easeOut, delay: 0.1 }, 1.2);
timeline.set($('.wipe.load.side-to-side'), { alpha: 0, display: "none" });
timeline.to(menu, 1, { top: "0", ease:Elastic.easeOut });
return timeline;
}
var displayIntro = Parallels.settings.get('PARALLELS_DISPLAY_INTRO_ANIMATION');
if (Parallels.utils.stringToBoolean(displayIntro)) {
var timelineSequence = new TimelineMax({ paused: true });
// Greensock .call is similar to its .add,
// except .call lets us pass params to our function
timelineSequence
.add(timelineMenu())
.call(
Parallels.Animation.General.shimmer,
[
{ $elements: $(".map .bit") }
],
"-=0.5")
.play();
// TODO: extract into Animation class
// adapted from: http://codepen.io/vdaguenet/pen/raXBKp
function timelineMenu () {
var menu = $(".nav-panel");
var viewportWidth = verge.viewportW();
var viewportHeight = verge.viewportH();
var timeline = new TimelineMax();
var topToBottomLine = $('.wipe.top-to-bottom .line');
var maskTop = $('.wipe.top-to-bottom .mask.top');
var maskBottom = $('.wipe.top-to-bottom .mask.bottom');
var sideToSideLine = $('.wipe.side-to-side .line');
var maskLeft = $('.wipe.load.side-to-side .mask.left');
var maskRight = $('.wipe.load.side-to-side .mask.right');
TweenMax.set($('.wipe.load.side-to-side'), { alpha: 0 });
timeline.fromTo(topToBottomLine, 0.4, { x: viewportWidth }, { x: 0, ease: Circ.easeIn }, 0);
timeline.fromTo(maskTop, 0.4, { y: 0 }, { y: -viewportHeight / 2, ease: Expo.easeOut, delay: 0.1 }, 0.4);
timeline.fromTo(maskBottom, 0.4, { y: 0 }, { y: viewportHeight / 2, ease: Expo.easeOut, delay: 0.1 }, 0.4);
timeline.set($('.wipe.load.top-to-bottom'), { alpha: 0, display: "none" });
timeline.set($('.wipe.load.side-to-side'), { alpha: 1, display: "block"});
timeline.fromTo(sideToSideLine, 0.4, { y: -viewportHeight}, {y: 0, ease: Circ.easeIn});
timeline.fromTo(maskRight, 0.4, { x: 0 }, {x: viewportWidth / 2, ease: Expo.easeOut, delay: 0.1 }, 1.2); // 2.5
timeline.fromTo(maskLeft, 0.4, { x: 0 }, {x: -viewportWidth / 2, ease: Expo.easeOut, delay: 0.1 }, 1.2);
timeline.set($('.wipe.load.side-to-side'), { alpha: 0, display: "none" });
timeline.to(menu, 1, { top: "0", ease:Elastic.easeOut });
return timeline;
}
else {
$('.wipe.load').hide();
}
});
}
else {
$('.wipe.load').hide();
}
};
@@ -88,7 +88,7 @@ Parallels.Panels = {
if (Session.equals('isShortcutsDisplayed', true)){
// prepare to close
log.debug("_toggleShortcutsPanel: close");
Parallels.log.debug("_toggleShortcutsPanel: close");
left = "-15em";
bindings = _unbindShortcutEvents;
@@ -1,6 +1,6 @@
Meteor.startup(function () {
log.debug("Meteor.startup begin.");
Parallels.log.debug("Meteor.startup begin.");
// we enable the core *actions, ie
// bit operations: Examples: bit:create, bit:delete, etc.
@@ -13,24 +13,15 @@ Meteor.startup(function () {
Parallels.Keys.bindEsc();
Parallels.Keys.bindShortcuts();
// TODO: extract out into Utility? or Config?
// get settings
Meteor.call('getSetting', 'isAudioEnabled', function (err, isAudioEnabled) {
if (isAudioEnabled) {
Session.set('isAudioEnabled', true);
}
else {
Session.set('isAudioEnabled', false);
}
});
var isAudioEnabled = Parallels.settings.get('PARALLELS_IS_AUDIO_ENABLED');
Session.set('isAudioEnabled', Parallels.utils.stringToBoolean(isAudioEnabled));
Tracker.autorun(function () {
log.debug(Bits.find().count() + ' bits, via Tracker:autorun');
Parallels.log.debug(Bits.find().count() + ' bits, via Tracker:autorun');
});
Tracker.autorun(function () {
log.debug('Session:bitHoveringId is now: ', Session.get("bitHoveringId"), ', via Tracker:autorun');
Parallels.log.debug('Session:bitHoveringId is now: ', Session.get("bitHoveringId"), ', via Tracker:autorun');
});
var center = Utilities.getViewportCenter();
Oops, something went wrong.

0 comments on commit e130c2f

Please sign in to comment.