This commit is contained in:
2016-09-17 23:11:44 +02:00
parent eeab2cf0cd
commit d732d1ba97
14 changed files with 67 additions and 52 deletions

View File

@ -12,7 +12,7 @@ export declare let fileExistsSync: (filePath: any) => boolean;
* @param filePath
* @returns {any}
*/
export declare let fileExists: (filePath: any) => plugins.Q.Promise<{}>;
export declare let fileExists: (filePath: any) => plugins.q.Promise<{}>;
/**
* Checks if given path points to an existing directory
*/
@ -24,7 +24,7 @@ export declare let isFile: (pathArg: any) => boolean;
/**
* ensures that a directory is in place
*/
export declare let ensureDir: (dirPathArg: string) => plugins.Q.Promise<{}>;
export declare let ensureDir: (dirPathArg: string) => plugins.q.Promise<{}>;
/**
* ensures that a directory is in place
*/
@ -32,7 +32,7 @@ export declare let ensureDirSync: (dirPathArg: string) => void;
/**
* copies a file from A to B on the local disk
*/
export declare let copy: (fromArg: string, toArg: string) => plugins.Q.Promise<{}>;
export declare let copy: (fromArg: string, toArg: string) => plugins.q.Promise<{}>;
/**
* copies a file SYNCHRONOUSLY from A to B on the local disk
*/
@ -40,7 +40,7 @@ export declare let copySync: (fromArg: string, toArg: string) => boolean;
/**
* removes a file or folder from local disk
*/
export declare let remove: (pathArg: string) => plugins.Q.Promise<{}>;
export declare let remove: (pathArg: string) => plugins.q.Promise<{}>;
/**
* removes a file SYNCHRONOUSLY from local disk
*/
@ -82,7 +82,7 @@ export declare let requireReload: (path: string) => any;
* lists Folders in a directory on local disk
* @returns Promise
*/
export declare let listFolders: (pathArg: string, regexFilter?: RegExp) => plugins.Q.Promise<{}>;
export declare let listFolders: (pathArg: string, regexFilter?: RegExp) => plugins.q.Promise<{}>;
/**
* lists Folders SYNCHRONOUSLY in a directory on local disk
* @returns an array with the folder names as strings
@ -92,7 +92,7 @@ export declare let listFoldersSync: (pathArg: string, regexFilter?: RegExp) => s
* lists Files in a directory on local disk
* @returns Promise
*/
export declare let listFiles: (pathArg: string, regexFilter?: RegExp) => plugins.Q.Promise<{}>;
export declare let listFiles: (pathArg: string, regexFilter?: RegExp) => plugins.q.Promise<{}>;
/**
* lists Files SYNCHRONOUSLY in a directory on local disk
* @returns an array with the folder names as strings
@ -100,12 +100,17 @@ export declare let listFiles: (pathArg: string, regexFilter?: RegExp) => plugins
export declare let listFilesSync: (pathArg: string, regexFilter?: RegExp) => string[];
/**
* lists all items (folders AND files) in a directory on local disk
* @returns Promise
* @returns Promise<string[]>
*/
export declare let listAllItems: (pathArg: string, regexFilter?: RegExp) => plugins.Q.Promise<{}>;
export declare let listAllItems: (pathArg: string, regexFilter?: RegExp) => plugins.q.Promise<string[]>;
/**
* lists all items (folders AND files) SYNCHRONOUSLY in a directory on local disk
* lists all items (folders AND files) in a directory on local disk
* @returns an array with the folder names as strings
* @executes SYNC
*/
export declare let listAllItemsSync: (pathArg: string, regexFilter?: RegExp) => string[];
export declare let listFileTree: (dirPath: string, miniMatchFilter: string) => plugins.Q.Promise<{}>;
/**
* lists a file tree using a miniMatch filter
* @returns Promise<string[]> string array with the absolute paths of all matching files
*/
export declare let listFileTree: (dirPath: string, miniMatchFilter: string) => plugins.q.Promise<string[]>;

27
dist/smartfile.fs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -46,5 +46,5 @@ export declare let toStringSync: (fileArg: any) => any;
* @param fileNameArg
* @param fileBaseArg
*/
export declare let toFs: (fileContentArg: any, filePathArg: any) => plugins.Q.Promise<{}>;
export declare let toFs: (fileContentArg: any, filePathArg: any) => plugins.q.Promise<{}>;
export declare let toFsSync: (fileArg: any, filePathArg: string) => void;

View File

@ -90,7 +90,7 @@ exports.toStringSync = function (fileArg) {
* @param fileBaseArg
*/
exports.toFs = function (fileContentArg, filePathArg) {
let done = plugins.Q.defer();
let done = plugins.q.defer();
//function checks to abort if needed
if (!fileContentArg || !filePathArg)
throw new Error("expected valid arguments");

View File

@ -8,7 +8,7 @@ export declare let g: {
remoteSrc: any;
};
export import path = require("path");
export import Q = require("q");
export import q = require("q");
export declare let vinyl: any;
export declare let vinylFile: any;
export declare let yaml: any;

View File

@ -9,7 +9,7 @@ exports.g = {
remoteSrc: require("gulp-remote-src")
};
exports.path = require("path");
exports.Q = require("q");
exports.q = require("q");
exports.vinyl = require("vinyl");
exports.vinylFile = require("vinyl-file");
exports.yaml = require("js-yaml");

View File

@ -1,7 +1,7 @@
/// <reference types="q" />
import "typings-global";
import plugins = require("./smartfile.plugins");
export declare let toFs: (from: string, toPath: string) => plugins.Q.Promise<{}>;
export declare let toFs: (from: string, toPath: string) => plugins.q.Promise<{}>;
/**
*
* @param filePathArg
@ -13,10 +13,10 @@ export declare let toGulpStreamSync: (filePathArg: string, baseArg: string) => a
* @param fromArg
* @returns {any}
*/
export declare let toObject: (fromArg: string) => plugins.Q.Promise<{}>;
export declare let toObject: (fromArg: string) => plugins.q.Promise<{}>;
/**
*
* @param fromArg
* @returns {any}
*/
export declare let toString: (fromArg: string) => plugins.Q.Promise<{}>;
export declare let toString: (fromArg: string) => plugins.q.Promise<{}>;

View File

@ -3,7 +3,7 @@ require("typings-global");
const plugins = require("./smartfile.plugins");
const SmartfileInterpreter = require("./smartfile.interpreter");
exports.toFs = function (from, toPath) {
var done = plugins.Q.defer();
var done = plugins.q.defer();
var stream = plugins.request(from).pipe(plugins.fsExtra.createWriteStream(toPath));
stream.on('finish', function () {
done.resolve(toPath);
@ -27,7 +27,7 @@ exports.toGulpStreamSync = function (filePathArg, baseArg) {
* @returns {any}
*/
exports.toObject = function (fromArg) {
let done = plugins.Q.defer();
let done = plugins.q.defer();
plugins.request.get(fromArg, function (error, response, bodyString) {
let returnObject;
if (!error && response.statusCode == 200) {
@ -49,7 +49,7 @@ exports.toObject = function (fromArg) {
* @returns {any}
*/
exports.toString = (fromArg) => {
let done = plugins.Q.defer();
let done = plugins.q.defer();
plugins.request.get(fromArg, function (error, response, bodyString) {
if (!error && response.statusCode == 200) {
done.resolve(bodyString);