big consolidation
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
import "typings-global";
|
||||
|
||||
import * as plugins from "./smartfile.plugins";
|
||||
import * as SmartfileLocal from "./smartfile.fs";
|
||||
import * as SmartfileFs from "./smartfile.fs";
|
||||
import * as SmartfileInterpreter from "./smartfile.interpreter"
|
||||
import * as SmartfileMemory from "./smartfile.memory";
|
||||
import * as SmartfileRemote from "./smartfile.remote";
|
||||
|
||||
export {Smartfile} from "./smartfile.classes.smartfile";
|
||||
|
||||
export let fs = plugins.fs;
|
||||
export let local = SmartfileLocal;
|
||||
export let fs = SmartfileFs;
|
||||
export let interpreter = SmartfileInterpreter;
|
||||
export let memory = SmartfileMemory;
|
||||
export let remote = SmartfileRemote;
|
||||
export let requireReload = SmartfileLocal.requireReload;
|
||||
export let requireReload = SmartfileFs.requireReload;
|
||||
|
@ -66,8 +66,8 @@ export let toGulpDestSync = function(folderPathArg:string){
|
||||
export let toObjectSync = function(filePathArg,fileTypeArg?) {
|
||||
let fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
|
||||
let fileType;
|
||||
fileTypeArg ? fileType = fileTypeArg : fileType = filetype(filePathArg);
|
||||
return SmartfileInterpreter(fileString,fileType);
|
||||
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileInterpreter.filetype(filePathArg);
|
||||
return SmartfileInterpreter.objectFile(fileString,fileType);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -100,12 +100,6 @@ export let requireReload = function(path:string){
|
||||
return plugins.requireReload(path);
|
||||
};
|
||||
|
||||
export let filetype = function(pathArg:string):string {
|
||||
let extName = plugins.path.extname(pathArg);
|
||||
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
|
||||
export let foldersSync = function(pathArg){
|
||||
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||
|
@ -2,7 +2,13 @@ import "typings-global";
|
||||
|
||||
import plugins = require("./smartfile.plugins");
|
||||
|
||||
export = function(fileStringArg:string, fileTypeArg){
|
||||
export let filetype = (pathArg:string):string => {
|
||||
let extName = plugins.path.extname(pathArg);
|
||||
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
||||
return fileType;
|
||||
};
|
||||
|
||||
export let objectFile = (fileStringArg:string, fileTypeArg) => {
|
||||
switch (fileTypeArg) {
|
||||
case "yml" :
|
||||
case "yaml":
|
||||
|
@ -46,7 +46,7 @@ export let toGulpStream = function(fileArg:string|string[]|plugins.vinyl|plugins
|
||||
* @returns {any|any}
|
||||
*/
|
||||
export let toObject = function(fileStringArg:string,fileTypeArg:string){
|
||||
return SmartfileInterpreter(fileStringArg,fileTypeArg);
|
||||
return SmartfileInterpreter.objectFile(fileStringArg,fileTypeArg);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./smartfile.plugins");
|
||||
import SmartfileInterpreter = require("./smartfile.interpreter");
|
||||
import SmartfileGet = require("./smartfile.get");
|
||||
|
||||
export let toFs = function(from:string,toPath:string) {
|
||||
var done = plugins.q.defer();
|
||||
@ -34,7 +33,7 @@ export let toObject = function(fromArg:string){
|
||||
plugins.request.get(fromArg, function (error, response, bodyString) {
|
||||
let returnObject;
|
||||
if (!error && response.statusCode == 200) {
|
||||
returnObject = SmartfileInterpreter(bodyString,SmartfileGet.filetype(fromArg));
|
||||
returnObject = SmartfileInterpreter.objectFile(bodyString,SmartfileInterpreter.filetype(fromArg));
|
||||
done.resolve(returnObject);
|
||||
} else {
|
||||
console.log('could not get remote file from ' + fromArg);
|
||||
|
Reference in New Issue
Block a user