Skip to content

Commit

Permalink
Merge pull request #66 from jakecraige/addon-update
Browse files Browse the repository at this point in the history
update ember-cli addon implementation
  • Loading branch information
ef4 committed Sep 15, 2014
2 parents 5aaecd3 + 608e411 commit 75d6818
Showing 1 changed file with 34 additions and 41 deletions.
75 changes: 34 additions & 41 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
/* jshint node: true */
'use strict';

var path = require('path');
var fs = require('fs');
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');

function LiquidFire(project) {
this.project = project;
this.name = 'Liquid Fire';
}

function unwatchedTree(dir) {
return {
read: function() { return dir; },
cleanup: function() { }
};
}

LiquidFire.prototype.treeFor = function treeFor(name) {
var treePath = path.join('node_modules', 'liquid-fire');

if (name === 'templates') {
treePath = path.join(treePath, 'app-addon', 'templates');
} else {
treePath = path.join(treePath, name + '-addon');
}
var fs = require('fs');
var path = require('path');

var addon;
module.exports = {
name: 'Liquid Fire',

if (fs.existsSync(treePath)) {
addon = unwatchedTree(treePath);
}
init: function() {
this.treePaths.app = 'app-addon';
this.treePaths.templates = 'app-addon/templates';
this.treePaths.vendor = 'vendor-addon';
},

if (name === 'vendor') {
var src = unwatchedTree(path.dirname(require.resolve('velocity-animate')));
addon = mergeTrees([addon, pickFiles(src, {srcDir: '/', destDir: 'velocity'})]);
}
treeFor: function(name) {
this._requireBuildPackages();

return addon;
};
var treePath = path.join(this.root, this.treePaths[name]);
var tree;

LiquidFire.prototype.included = function included(app) {
this.app = app;
this.app.import('vendor/velocity/jquery.velocity.js');
this.app.import('vendor/liquid-fire/liquid-fire.css');
};
if (fs.existsSync(treePath)) {
tree = this.treeGenerator(treePath);

module.exports = LiquidFire;
if(name === 'vendor') {
var velocityPath = path.dirname(require.resolve('velocity-animate'));
var velocityTree = this.pickFiles(this.treeGenerator(velocityPath), {
srcDir: '/',
destDir: 'velocity'
});

tree = this.mergeTrees([tree, velocityTree]);
}

return tree;
}
},

included: function(app) {
app.import('vendor/velocity/jquery.velocity.js');
app.import('vendor/liquid-fire/liquid-fire.css');
}
};

0 comments on commit 75d6818

Please sign in to comment.