Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MVC-Loader][Binary] Fixed a route-building bug for index controller …
…(//action). Improved and extended the greppy binary.
- Loading branch information
Showing
7 changed files
with
195 additions
and
43 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Context helper | ||
* | ||
* @module greppy/cli/helper/context | ||
* @author Hermann Mayer <hermann.mayer92@gmail.com> | ||
*/ | ||
|
||
var helper = {}; | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
helper.getContextsByArgs = function(contexts) | ||
{ | ||
var appPath = path.normalize(process.cwd() + '/'); | ||
var registeredContexts = []; | ||
|
||
// Find all contexts | ||
fs.readdirSync(appPath + 'app/context/').forEach(function(file) { | ||
|
||
if (!file.match(/\.js$/gi)) { | ||
return; | ||
} | ||
|
||
registeredContexts.push(path.basename(file, '.js')); | ||
}); | ||
|
||
contexts.forEach(function(context) { | ||
|
||
if (-1 === registeredContexts.indexOf(context)) { | ||
console.log(new String('Context ' + context.green.bold + ' does not exist.').white); | ||
console.log(); | ||
console.log(new String('Available contexts are: ' + registeredContexts.join(', ').green.bold).white); | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
if (0 === contexts.length) { | ||
contexts = registeredContexts; | ||
} | ||
|
||
return contexts; | ||
} | ||
|
||
module.exports = helper; | ||
|
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