-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: Writing test for Theme.generate
- Loading branch information
Showing
17 changed files
with
704 additions
and
87 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
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
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
This file was deleted.
Oops, something went wrong.
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,16 +1,38 @@ | ||
var Pattern = require('../../box/pattern'); | ||
var common = require('../../plugins/processor/common'); | ||
|
||
var rHiddenFile = /^_|\/_/; | ||
exports.process = function(file){ | ||
var Asset = this.model('Asset'); | ||
var id = file.source.substring(this.base_dir.length); | ||
var path = file.params.path; | ||
var doc = Asset.findById(id); | ||
|
||
exports.process = function(data){ | ||
// | ||
if (file.type === 'delete'){ | ||
if (doc){ | ||
return doc.remove(); | ||
} else { | ||
return; | ||
} | ||
} | ||
|
||
if (doc){ | ||
doc.path = path; | ||
doc.modified = file.type === 'update'; | ||
|
||
return doc.save(); | ||
} else { | ||
return Asset.insert({ | ||
_id: id, | ||
path: path | ||
}); | ||
} | ||
}; | ||
|
||
exports.pattern = new Pattern(function(path){ | ||
if (path.substring(0, 6) !== 'source') return; | ||
if (path.substring(0, 7) !== 'source/') return false; | ||
|
||
path = path.substring(7); | ||
if (rHiddenFile.test(path)) return; | ||
if (common.isHiddenFile(path) || common.isTmpFile(path)) return false; | ||
|
||
return {path: path}; | ||
}); |
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,7 +1,17 @@ | ||
var Pattern = require('../../box/pattern'); | ||
var pathFn = require('path'); | ||
|
||
exports.process = function(data){ | ||
// | ||
exports.process = function(file){ | ||
var path = file.params.path; | ||
|
||
if (file.type === 'delete'){ | ||
file.box.removeView(path); | ||
return; | ||
} | ||
|
||
return file.read().then(function(result){ | ||
file.box.setView(path, result); | ||
}); | ||
}; | ||
|
||
exports.pattern = new Pattern('layout/*path'); |
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
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
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
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
Oops, something went wrong.