-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from jakecraige/addon-update
update ember-cli addon implementation
- Loading branch information
Showing
1 changed file
with
34 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
}; |