Compare commits

...

5 Commits

Author SHA1 Message Date
5ff7f8c3ac 4.0.3 2016-06-23 18:42:42 +02:00
0c49bbd4b2 4.0.2 2016-06-23 18:41:52 +02:00
f2e2a22a57 add gitlab-ci.yml 2016-06-23 18:41:45 +02:00
6ae30110f8 4.0.1 2016-06-23 18:39:06 +02:00
7b4626586c rename some actions 2016-06-23 18:39:02 +02:00
7 changed files with 118 additions and 29 deletions

36
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,36 @@
image: hosttoday/ht-docker-node:npmts
stages:
- test
- release
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker

View File

@ -1,7 +1,19 @@
import "typings-global";
/**
* copies a file from A to B on the local disk
*/
export declare let copy: (fromArg: string, toArg: string) => any;
/**
* copies a file SYNCHRONOUSLY from A to B on the local disk
*/
export declare let copySync: (fromArg: string, toArg: string) => boolean;
/**
* removes a file or folder from local disk
*/
export declare let remove: (pathArg: string) => any;
/**
* removes a file SYNCHRONOUSLY from local disk
*/
export declare let removeSync: (pathArg: string) => boolean;
export declare let toFS: (options: {
from: string;
@ -40,8 +52,14 @@ export declare let toVinylSync: (filePathArg: any, options?: {}) => any;
* @returns {any}
*/
export declare let requireReload: (path: string) => any;
export declare let foldersSync: (pathArg: any) => any;
export declare let folders: (pathArg: string) => any;
/**
* lists Folders in a directory on local disk
*/
export declare let listFolders: (pathArg: string) => any;
/**
* lists Folders SYNCHRONOUSLY in a directory on local disk
*/
export declare let listFoldersSync: (pathArg: any) => any;
/**
*
* @param filePath

32
dist/smartfile.fs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "smartfile",
"version": "4.0.0",
"version": "4.0.3",
"description": "offers smart ways to work with files in nodejs",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

File diff suppressed because one or more lines are too long

View File

@ -23,15 +23,15 @@ describe("smartfile".yellow,function(){
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
});
});
describe(".foldersSync()",function(){
describe(".listFoldersSync()",function(){
it("should get the file type from a string",function(){
smartfile.fs.foldersSync("./test/").should.containDeep([ "testfolder"]);
smartfile.fs.foldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
smartfile.fs.listFoldersSync("./test/").should.containDeep([ "testfolder"]);
smartfile.fs.listFoldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
});
});
describe(".folders()",function(){
describe(".listFolders()",function(){
it("should get the file type from a string",function(done){
smartfile.fs.folders("./test/")
smartfile.fs.listFolders("./test/")
.then(function(folderArrayArg){
folderArrayArg.should.containDeep([ "testfolder"]);
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);

View File

@ -7,6 +7,9 @@ import SmartfileInterpreter = require("./smartfile.interpreter");
============================ FS ACTIONS =========================
===============================================================*/
/**
* copies a file from A to B on the local disk
*/
export let copy = function(fromArg:string, toArg:string){
var done = plugins.q.defer();
plugins.fs.copy(fromArg,toArg,{},function(){
@ -15,11 +18,17 @@ export let copy = function(fromArg:string, toArg:string){
return done.promise;
};
/**
* copies a file SYNCHRONOUSLY from A to B on the local disk
*/
export let copySync = function(fromArg:string,toArg:string):boolean{
plugins.fs.copySync(fromArg,toArg);
return true;
};
/**
* removes a file or folder from local disk
*/
export let remove = function(pathArg:string){
var done = plugins.q.defer();
plugins.fs.remove(pathArg,function(){
@ -28,6 +37,9 @@ export let remove = function(pathArg:string){
return done.promise;
};
/**
* removes a file SYNCHRONOUSLY from local disk
*/
export let removeSync = function(pathArg:string):boolean{
plugins.fs.removeSync(pathArg);
return true;
@ -100,13 +112,10 @@ export let requireReload = function(path:string){
return plugins.requireReload(path);
};
export let foldersSync = function(pathArg){
return plugins.fs.readdirSync(pathArg).filter(function(file) {
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
});
};
export let folders = function(pathArg:string){
/**
* lists Folders in a directory on local disk
*/
export let listFolders = function(pathArg:string){
let done = plugins.q.defer();
let folderArray = plugins.fs.readdirSync(pathArg).filter(function(file) {
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
@ -115,6 +124,14 @@ export let folders = function(pathArg:string){
return done.promise;
};
/**
* lists Folders SYNCHRONOUSLY in a directory on local disk
*/
export let listFoldersSync = function(pathArg){
return plugins.fs.readdirSync(pathArg).filter(function(file) {
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
});
};
/**
*