aboutsummaryrefslogtreecommitdiff
path: root/node_modules/gulp-rename
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/gulp-rename
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/gulp-rename')
-rw-r--r--node_modules/gulp-rename/README.md55
-rw-r--r--node_modules/gulp-rename/index.js65
-rw-r--r--node_modules/gulp-rename/package.json115
3 files changed, 235 insertions, 0 deletions
diff --git a/node_modules/gulp-rename/README.md b/node_modules/gulp-rename/README.md
new file mode 100644
index 000000000..b45c3664f
--- /dev/null
+++ b/node_modules/gulp-rename/README.md
@@ -0,0 +1,55 @@
+# gulp-rename
+
+gulp-rename is a [gulp](https://github.com/wearefractal/gulp) plugin to rename files easily.
+
+[![NPM](https://nodei.co/npm/gulp-rename.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/gulp-rename/)
+
+[![build status](https://secure.travis-ci.org/hparra/gulp-rename.svg)](http://travis-ci.org/hparra/gulp-rename)
+[![devDependency Status](https://david-dm.org/hparra/gulp-rename/dev-status.svg)](https://david-dm.org/hparra/gulp-rename#info=devDependencies)
+
+## Usage
+
+gulp-rename provides simple file renaming methods.
+
+```javascript
+var rename = require("gulp-rename");
+
+// rename via string
+gulp.src("./src/main/text/hello.txt")
+ .pipe(rename("main/text/ciao/goodbye.md"))
+ .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md
+
+// rename via function
+gulp.src("./src/**/hello.txt")
+ .pipe(rename(function (path) {
+ path.dirname += "/ciao";
+ path.basename += "-goodbye";
+ path.extname = ".md"
+ }))
+ .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md
+
+// rename via hash
+gulp.src("./src/main/text/hello.txt", { base: process.cwd() })
+ .pipe(rename({
+ dirname: "main/text/ciao",
+ basename: "aloha",
+ prefix: "bonjour-",
+ suffix: "-hola",
+ extname: ".md"
+ }))
+ .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
+```
+
+**See test/rename.spec.js for more examples and test/path-parsing.spec.js for hairy details.**
+
+## Notes
+
+* `dirname` is the relative path from the base directory set by `gulp.src` to the filename.
+ * `gulp.src()` uses glob-stream which sets the base to the parent of the first directory glob (`*`, `**`, [], or extglob). `dirname` is the remaining directories or `./` if none. glob-stream versions >= 3.1.0 (used by gulp >= 3.2.2) accept a `base` option, which can be used to explicitly set the base.
+ * `gulp.dest()` renames the directories between `process.cwd()` and `dirname` (i.e. the base relative to CWD). Use `dirname` to rename the directories matched by the glob or descendents of the base of option.
+* `basename` is the filename without the extension like path.basename(filename, path.extname(filename)).
+* `extname` is the file extension including the '.' like path.extname(filename).
+
+## License
+
+[MIT License](http://en.wikipedia.org/wiki/MIT_License)
diff --git a/node_modules/gulp-rename/index.js b/node_modules/gulp-rename/index.js
new file mode 100644
index 000000000..77f812d41
--- /dev/null
+++ b/node_modules/gulp-rename/index.js
@@ -0,0 +1,65 @@
+'use strict';
+
+var Stream = require('stream');
+var Path = require('path');
+
+function gulpRename(obj) {
+
+ var stream = new Stream.Transform({objectMode: true});
+
+ function parsePath(path) {
+ var extname = Path.extname(path);
+ return {
+ dirname: Path.dirname(path),
+ basename: Path.basename(path, extname),
+ extname: extname
+ };
+ }
+
+ stream._transform = function(file, unused, callback) {
+
+ var parsedPath = parsePath(file.relative);
+ var path;
+
+ var type = typeof obj;
+
+ if (type === 'string' && obj !== '') {
+
+ path = obj;
+
+ } else if (type === 'function') {
+
+ obj(parsedPath);
+ path = Path.join(parsedPath.dirname, parsedPath.basename + parsedPath.extname);
+
+ } else if (type === 'object' && obj !== undefined && obj !== null) {
+
+ var dirname = 'dirname' in obj ? obj.dirname : parsedPath.dirname,
+ prefix = obj.prefix || '',
+ suffix = obj.suffix || '',
+ basename = 'basename' in obj ? obj.basename : parsedPath.basename,
+ extname = 'extname' in obj ? obj.extname : parsedPath.extname;
+
+ path = Path.join(dirname, prefix + basename + suffix + extname);
+
+ } else {
+
+ callback(new Error('Unsupported renaming parameter type supplied'), undefined);
+ return;
+
+ }
+
+ file.path = Path.join(file.base, path);
+
+ // Rename sourcemap if present
+ if (file.sourceMap) {
+ file.sourceMap.file = file.relative;
+ }
+
+ callback(null, file);
+ };
+
+ return stream;
+}
+
+module.exports = gulpRename;
diff --git a/node_modules/gulp-rename/package.json b/node_modules/gulp-rename/package.json
new file mode 100644
index 000000000..04e8f80c8
--- /dev/null
+++ b/node_modules/gulp-rename/package.json
@@ -0,0 +1,115 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "gulp-rename@^1.2.2",
+ "scope": null,
+ "escapedName": "gulp-rename",
+ "name": "gulp-rename",
+ "rawSpec": "^1.2.2",
+ "spec": ">=1.2.2 <2.0.0",
+ "type": "range"
+ },
+ "/home/dold/repos/taler/wallet-webex"
+ ]
+ ],
+ "_from": "gulp-rename@>=1.2.2 <2.0.0",
+ "_id": "gulp-rename@1.2.2",
+ "_inCache": true,
+ "_location": "/gulp-rename",
+ "_npmUser": {
+ "name": "fractal",
+ "email": "contact@wearefractal.com"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "gulp-rename@^1.2.2",
+ "scope": null,
+ "escapedName": "gulp-rename",
+ "name": "gulp-rename",
+ "rawSpec": "^1.2.2",
+ "spec": ">=1.2.2 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "#DEV:/"
+ ],
+ "_resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.2.tgz",
+ "_shasum": "3ad4428763f05e2764dec1c67d868db275687817",
+ "_shrinkwrap": null,
+ "_spec": "gulp-rename@^1.2.2",
+ "_where": "/home/dold/repos/taler/wallet-webex",
+ "author": {
+ "name": "Hector Guillermo Parra Alvarez",
+ "email": "hector@hectorparra.com",
+ "url": "https://github.com/hparra"
+ },
+ "bugs": {
+ "url": "https://github.com/hparra/gulp-rename/issues"
+ },
+ "dependencies": {},
+ "description": "Rename files",
+ "devDependencies": {
+ "gulp": ">=3.0.0",
+ "gulp-sourcemaps": "^1.5.0",
+ "gulp-util": "^3.0.4",
+ "jshint": "^2.6.3",
+ "map-stream": ">=0.0.4",
+ "mocha": ">=1.15.0",
+ "should": ">=2.1.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "3ad4428763f05e2764dec1c67d868db275687817",
+ "tarball": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.2.tgz"
+ },
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">=1.2.10"
+ },
+ "files": [
+ "index.js"
+ ],
+ "gitHead": "e1fb4e41dd107b38e96f1156fcbee70ebcf16fb6",
+ "homepage": "https://github.com/hparra/gulp-rename",
+ "keywords": [
+ "gulpplugin"
+ ],
+ "licenses": [
+ {
+ "type": "MIT"
+ }
+ ],
+ "main": "./index.js",
+ "maintainers": [
+ {
+ "name": "hparra",
+ "email": "hector@hectorparra.com"
+ },
+ {
+ "name": "contra",
+ "email": "contra@wearefractal.com"
+ },
+ {
+ "name": "shinnn",
+ "email": "snnskwtnb@gmail.com"
+ },
+ {
+ "name": "fractal",
+ "email": "contact@wearefractal.com"
+ }
+ ],
+ "name": "gulp-rename",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/hparra/gulp-rename.git"
+ },
+ "scripts": {
+ "pretest": "jshint index.js test/",
+ "test": "mocha"
+ },
+ "version": "1.2.2"
+}