yeoman-environment
Advanced tools
Comparing version 1.3.0 to 1.4.0
'use strict'; | ||
var util = require('util'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
@@ -11,3 +12,3 @@ var events = require('events'); | ||
var memFs = require('mem-fs'); | ||
var debug = require('debug')('generators:environment'); | ||
var debug = require('debug')('yeoman:environment'); | ||
var Store = require('./store'); | ||
@@ -153,3 +154,3 @@ var resolver = require('./resolver'); | ||
* @param {String} namespace - Namespace under which register the generator (optional) | ||
* @return {this} | ||
* @return {String} namespace - Namespace assigned to the registered generator | ||
*/ | ||
@@ -235,3 +236,3 @@ | ||
* @param {String} namespace | ||
* @return {Generator} - the generator registered under the namespace | ||
* @return {Generator|null} - the generator registered under the namespace | ||
*/ | ||
@@ -247,6 +248,21 @@ | ||
this.store.get(this.alias(namespace)) || | ||
this.get(namespace.split(':').slice(0, -1).join(':')); | ||
this.get(namespace.split(':').slice(0, -1).join(':')) || | ||
this.getByPath(namespace); | ||
}; | ||
/** | ||
* Get a generator by path instead of namespace. | ||
* @param {String} path | ||
* @return {Generator|null} - the generator found at the location | ||
*/ | ||
Environment.prototype.getByPath = function (path) { | ||
if (fs.existsSync(path)) { | ||
var namespace = this.namespace(path); | ||
this.register(path, namespace); | ||
return this.get(namespace); | ||
} | ||
}; | ||
/** | ||
* Create is the Generator factory. It takes a namespace to lookup and optional | ||
@@ -253,0 +269,0 @@ * hash of options, that lets you define `arguments` and `options` to |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var globby = require('globby'); | ||
var debug = require('debug')('generators:environment'); | ||
var debug = require('debug')('yeoman:environment'); | ||
@@ -9,0 +9,0 @@ var win32 = process.platform === 'win32'; |
{ | ||
"name": "yeoman-environment", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Handles the lifecyle and bootstrapping of generators in a specific environment", | ||
"license": "BSD-2-Clause", | ||
"homepage": "http://yeoman.io", | ||
"author": "Yeoman", | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "lib/environment.js", | ||
@@ -20,17 +24,10 @@ "keywords": [ | ||
], | ||
"homepage": "http://yeoman.io", | ||
"author": "Yeoman", | ||
"license": "BSD-2-Clause", | ||
"repository": "yeoman/environment", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "make tests", | ||
"test": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"doc": "jsdoc -c ./jsdoc.json ./readme.md", | ||
"benchmark": "matcha benchmark/**", | ||
"prepublish": "nsp audit-package" | ||
"prepublish": "gulp prepublish" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"dependencies": { | ||
@@ -41,3 +38,3 @@ "chalk": "^1.0.0", | ||
"escape-string-regexp": "^1.0.2", | ||
"globby": "^3.0.1", | ||
"globby": "^4.0.0", | ||
"grouped-queue": "^0.3.0", | ||
@@ -52,21 +49,21 @@ "inquirer": "^0.11.0", | ||
"devDependencies": { | ||
"coveralls": "^2.11.2", | ||
"coveralls": "^2.11.6", | ||
"gulp": "^3.6.0", | ||
"gulp-coveralls": "^0.1.3", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-coveralls": "^0.1.0", | ||
"gulp-eslint": "^1.0.0", | ||
"gulp-exclude-gitignore": "^1.0.0", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-jscs": "^3.0.0", | ||
"gulp-jshint": "^1.5.3", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-util": "^3.0.3", | ||
"istanbul": "^0.4.0", | ||
"gulp-nsp": "^2.1.0", | ||
"gulp-plumber": "^1.0.0", | ||
"istanbul": "^0.4.1", | ||
"jsdoc": "^3.3.0-alpha9", | ||
"jshint": "^2.6.0", | ||
"jshint-stylish": "^2.0.1", | ||
"matcha": "^0.6.0", | ||
"mocha": "^2.1.0", | ||
"nsp": "*", | ||
"mocha": "^2.3.4", | ||
"shelljs": "^0.5.0", | ||
"sinon": "^1.9.1", | ||
"yeoman-generator": "^0.20.1" | ||
"yeoman-assert": "^2.1.1", | ||
"yeoman-generator": "^0.22.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Yeoman Environment [![Build Status](https://travis-ci.org/yeoman/generator.svg?branch=master)](https://travis-ci.org/yeoman/environment) [![Coverage Status](https://coveralls.io/repos/yeoman/environment/badge.svg?branch=master&service=github)](https://coveralls.io/github/yeoman/environment?branch=master) | ||
# Yeoman Environment [![npm](https://badge.fury.io/js/yeoman-environment.svg)](http://badge.fury.io/js/yeoman-environment) [![Build Status](https://travis-ci.org/yeoman/generator.svg?branch=master)](https://travis-ci.org/yeoman/environment) [![Coverage Status](https://coveralls.io/repos/yeoman/environment/badge.svg?branch=master&service=github)](https://coveralls.io/github/yeoman/environment?branch=master) | ||
@@ -7,3 +7,2 @@ > Handles the lifecycle and bootstrapping of generators in a specific environment | ||
## Install | ||
@@ -18,2 +17,4 @@ | ||
Full documentation available at http://yeoman.io/authoring/integrating-yeoman.html | ||
```js | ||
@@ -20,0 +21,0 @@ var yeoman = require('yeoman-environment'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31390
889
37
8
+ Addedglob@6.0.4(transitive)
+ Addedglobby@4.1.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
- Removedglob@5.0.15(transitive)
- Removedglobby@3.0.1(transitive)
- Removedpinkie@1.0.0(transitive)
- Removedpinkie-promise@1.0.0(transitive)
Updatedglobby@^4.0.0