diff --git a/docs/classes/converter.bucketnodeconverter.html b/docs/classes/converter.bucketnodeconverter.html
index d3b8c10..5168e66 100644
--- a/docs/classes/converter.bucketnodeconverter.html
+++ b/docs/classes/converter.bucketnodeconverter.html
@@ -128,7 +128,7 @@
constructor
@@ -144,7 +144,7 @@ Private _log
_log: Logger
@@ -162,7 +162,7 @@ convert
Parameters
@@ -189,7 +189,7 @@ isEligible
Parameters
diff --git a/docs/classes/converter.cartridgenodeconverter.html b/docs/classes/converter.cartridgenodeconverter.html
index 1a33fc9..f2e9544 100644
--- a/docs/classes/converter.cartridgenodeconverter.html
+++ b/docs/classes/converter.cartridgenodeconverter.html
@@ -128,7 +128,7 @@ constructor
@@ -144,7 +144,7 @@ Private _log
_log: Logger
@@ -162,7 +162,7 @@ convert
Parameters
@@ -189,7 +189,7 @@ isEligible
Parameters
diff --git a/docs/classes/converter.filetotreeconverter.html b/docs/classes/converter.filetotreeconverter.html
index ace0695..0d8110b 100644
--- a/docs/classes/converter.filetotreeconverter.html
+++ b/docs/classes/converter.filetotreeconverter.html
@@ -125,7 +125,7 @@ constructor
Parameters
@@ -147,7 +147,7 @@ Private _log
_log: Logger
@@ -157,7 +157,7 @@ Private _options
@@ -167,7 +167,7 @@ Private _resultingTree
_resultingTree: SockoNodeInterface
@@ -177,7 +177,7 @@
Private _convertTree
convert
constructor
Returns SocketNodeConverter
@@ -144,7 +144,7 @@Private _log
convert
Parameters
@@ -189,7 +189,7 @@isEligible
Parameters
diff --git a/docs/classes/converter.treetofileconverter.html b/docs/classes/converter.treetofileconverter.html index 7386c99..7750ca1 100644 --- a/docs/classes/converter.treetofileconverter.html +++ b/docs/classes/converter.treetofileconverter.html @@ -125,7 +125,7 @@constructor
Private _log
Private _options
Private _convert
Private _processDirectory<
@@ -252,7 +252,7 @@
@@ -289,7 +289,7 @@
diff --git a/docs/classes/errors.abstracterror.html b/docs/classes/errors.abstracterror.html
index 4c23f5e..1be06f2 100644
--- a/docs/classes/errors.abstracterror.html
+++ b/docs/classes/errors.abstracterror.html
@@ -140,7 +140,7 @@
diff --git a/docs/classes/errors.bucketpatterndidnotmatcherror.html b/docs/classes/errors.bucketpatterndidnotmatcherror.html
index e3793b6..30348b9 100644
--- a/docs/classes/errors.bucketpatterndidnotmatcherror.html
+++ b/docs/classes/errors.bucketpatterndidnotmatcherror.html
@@ -123,7 +123,7 @@
@@ -175,7 +175,7 @@
@@ -205,7 +205,7 @@
@@ -215,7 +215,7 @@ _outputPath: string
@@ -225,7 +225,7 @@
Private _processFile
convert
constructor
constructor
Parameters
diff --git a/docs/classes/errors.invalidbucketpatternerror.html b/docs/classes/errors.invalidbucketpatternerror.html index 1cbe8ec..e2bc11e 100644 --- a/docs/classes/errors.invalidbucketpatternerror.html +++ b/docs/classes/errors.invalidbucketpatternerror.html @@ -123,7 +123,7 @@constructor
Parameters
diff --git a/docs/classes/errors.invalidcartridgecollectorpatternerror.html b/docs/classes/errors.invalidcartridgecollectorpatternerror.html index 6662e6a..4ccc40e 100644 --- a/docs/classes/errors.invalidcartridgecollectorpatternerror.html +++ b/docs/classes/errors.invalidcartridgecollectorpatternerror.html @@ -123,7 +123,7 @@constructor
Parameters
diff --git a/docs/classes/errors.invalidcartridgepatternerror.html b/docs/classes/errors.invalidcartridgepatternerror.html index fe11c41..0e82c64 100644 --- a/docs/classes/errors.invalidcartridgepatternerror.html +++ b/docs/classes/errors.invalidcartridgepatternerror.html @@ -123,7 +123,7 @@constructor
Parameters
diff --git a/docs/classes/errors.unknownpatterntypeerror.html b/docs/classes/errors.unknownpatterntypeerror.html index 8af80f2..3bf03af 100644 --- a/docs/classes/errors.unknownpatterntypeerror.html +++ b/docs/classes/errors.unknownpatterntypeerror.html @@ -123,7 +123,7 @@constructor
Parameters
diff --git a/docs/classes/flavours.abstractflavourfactory.html b/docs/classes/flavours.abstractflavourfactory.html index fb1feec..58050af 100644 --- a/docs/classes/flavours.abstractflavourfactory.html +++ b/docs/classes/flavours.abstractflavourfactory.html @@ -130,7 +130,7 @@Private _createInternal
@@ -152,7 +152,7 @@
@@ -149,7 +149,7 @@
create
Returns FlavourInterface
diff --git a/docs/classes/flavours.flavour.html b/docs/classes/flavours.flavour.html index 71bbb63..49b2892 100644 --- a/docs/classes/flavours.flavour.html +++ b/docs/classes/flavours.flavour.html @@ -139,7 +139,7 @@Private _cartridgeGroup_cartridgeGroupName: string
Private _collectorExample<
_collectorExample: string
@@ -159,7 +159,7 @@
Private _collectorMax
_collectorMaxDepthGroupName: string
@@ -169,7 +169,7 @@
Private _collectorPattern<
_collectorPattern: RegExp
@@ -179,7 +179,7 @@
Private _collectorPattern<
_collectorPatternGroupName: string
@@ -189,7 +189,7 @@
Private _collectorPattern<
_collectorPatternTypeGroupName: string
@@ -199,7 +199,7 @@ _description: string
@@ -209,7 +209,7 @@ _example: string
@@ -219,7 +219,7 @@
Private _description
Private _example
Private _globPatternF
_globPatternFlag: string
@@ -229,7 +229,7 @@ _name: string
@@ -239,7 +239,7 @@ _pattern: RegExp
@@ -249,7 +249,7 @@
Private _name
Private _pattern
Private _regExpPatter
_regExpPatternFlag: string
@@ -267,7 +267,7 @@
cartridgeGroupName
Returns string
@@ -275,7 +275,7 @@Returns string
Parameters
@@ -299,7 +299,7 @@collectorExample
Returns string
@@ -307,7 +307,7 @@Returns string
Parameters
@@ -331,7 +331,7 @@collectorMaxDepthGroupName
Returns string
@@ -339,7 +339,7 @@Returns string
Parameters
@@ -363,7 +363,7 @@collectorPattern
Returns RegExp
@@ -371,7 +371,7 @@Returns RegExp
Parameters
@@ -395,7 +395,7 @@collectorPatternGroupName
Returns string
@@ -403,7 +403,7 @@Returns string
Parameters
@@ -427,7 +427,7 @@collectorPatternTypeGroupName
Returns string
@@ -435,7 +435,7 @@Returns string
Parameters
@@ -459,7 +459,7 @@description
Returns string
@@ -467,7 +467,7 @@Returns string
Parameters
@@ -491,7 +491,7 @@example
Returns string
@@ -499,7 +499,7 @@Returns string
Parameters
@@ -523,7 +523,7 @@globPatternFlag
Returns string
@@ -531,7 +531,7 @@Returns string
Parameters
@@ -555,7 +555,7 @@name
Returns string
@@ -563,7 +563,7 @@Returns string
Parameters
@@ -587,7 +587,7 @@pattern
Returns RegExp
@@ -595,7 +595,7 @@Returns RegExp
Parameters
@@ -619,7 +619,7 @@regExpPatternFlag
Returns string
@@ -627,7 +627,7 @@Returns string
Parameters
diff --git a/docs/classes/flavours.hashflavourfactory.html b/docs/classes/flavours.hashflavourfactory.html index edf997d..cb1a841 100644 --- a/docs/classes/flavours.hashflavourfactory.html +++ b/docs/classes/flavours.hashflavourfactory.html @@ -116,7 +116,7 @@Protected _createInterna
Returns FlavourInterface
@@ -134,7 +134,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/flavours.jsonflavourfactory.html b/docs/classes/flavours.jsonflavourfactory.html index ba086cf..5a4508e 100644 --- a/docs/classes/flavours.jsonflavourfactory.html +++ b/docs/classes/flavours.jsonflavourfactory.html @@ -116,7 +116,7 @@Protected _createInterna
Returns FlavourInterface
@@ -134,7 +134,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/flavours.multilineslashflavourfactory.html b/docs/classes/flavours.multilineslashflavourfactory.html index cc63f5a..ce414a5 100644 --- a/docs/classes/flavours.multilineslashflavourfactory.html +++ b/docs/classes/flavours.multilineslashflavourfactory.html @@ -118,7 +118,7 @@Protected _createInterna
Returns FlavourInterface
@@ -136,7 +136,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/flavours.nativeflavourfactory.html b/docs/classes/flavours.nativeflavourfactory.html index 178611c..ea31c7d 100644 --- a/docs/classes/flavours.nativeflavourfactory.html +++ b/docs/classes/flavours.nativeflavourfactory.html @@ -116,7 +116,7 @@Protected _createInterna
Returns FlavourInterface
@@ -134,7 +134,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/flavours.slashflavourfactory.html b/docs/classes/flavours.slashflavourfactory.html index c23e04a..3ac9805 100644 --- a/docs/classes/flavours.slashflavourfactory.html +++ b/docs/classes/flavours.slashflavourfactory.html @@ -116,7 +116,7 @@Protected _createInterna
Returns FlavourInterface
@@ -134,7 +134,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/flavours.xmlflavourfactory.html b/docs/classes/flavours.xmlflavourfactory.html index 583cc86..3a0577c 100644 --- a/docs/classes/flavours.xmlflavourfactory.html +++ b/docs/classes/flavours.xmlflavourfactory.html @@ -116,7 +116,7 @@Protected _createInterna
Returns FlavourInterface
@@ -134,7 +134,7 @@create
Returns FlavourInterface
diff --git a/docs/classes/options.bucketpattern.html b/docs/classes/options.bucketpattern.html index 058fefc..365bf59 100644 --- a/docs/classes/options.bucketpattern.html +++ b/docs/classes/options.bucketpattern.html @@ -127,7 +127,7 @@Private _globPatternF
_globPatternFlag: string
@@ -137,7 +137,7 @@
Private _maxDepthGrou
_maxDepthGroupName: string
@@ -147,7 +147,7 @@ _pattern: RegExp
@@ -157,7 +157,7 @@
Private _pattern
Private _patternGroup
_patternGroupName: string
@@ -167,7 +167,7 @@
Private _patternTypeG
_patternTypeGroupName: string
@@ -177,7 +177,7 @@
Private _regExpPatter
_regExpPatternFlag: string
@@ -195,7 +195,7 @@
globPatternFlag
Returns string
@@ -203,7 +203,7 @@Returns string
Parameters
@@ -227,7 +227,7 @@maxDepthGroupName
Returns string
@@ -235,7 +235,7 @@Returns string
Parameters
@@ -259,7 +259,7 @@pattern
Returns RegExp
@@ -267,7 +267,7 @@Returns RegExp
Parameters
@@ -291,7 +291,7 @@patternGroupName
Returns string
@@ -299,7 +299,7 @@Returns string
Parameters
@@ -323,7 +323,7 @@patternTypeGroupName
Returns string
@@ -331,7 +331,7 @@Returns string
Parameters
@@ -355,7 +355,7 @@regExpPatternFlag
Returns string
@@ -363,7 +363,7 @@Returns string
diff --git a/docs/classes/options.converteroptions.html b/docs/classes/options.converteroptions.html
index 2f4ea79..c1cd45a 100644
--- a/docs/classes/options.converteroptions.html
+++ b/docs/classes/options.converteroptions.html
@@ -135,7 +135,7 @@
@@ -155,7 +155,7 @@
Parameters
diff --git a/docs/classes/options.bucketpatternfactory.html b/docs/classes/options.bucketpatternfactory.html index 225dffa..2130a1d 100644 --- a/docs/classes/options.bucketpatternfactory.html +++ b/docs/classes/options.bucketpatternfactory.html @@ -109,7 +109,7 @@create
Private _bucketNodeNa
_bucketNodeName: string
@@ -145,7 +145,7 @@ Pattern: BucketPatternInterface
Private _bucketPattern
_bucketPrivate _cartridgeFlavours
_cartridgeFlavours: Array<FlavourInterface>
@@ -165,7 +165,7 @@
Private _cartridgeNode_cartridgeNodeExtension: string
Private _checkBeforeO
_checkBeforeOverwrite: boolean
@@ -185,7 +185,7 @@
Private _hashingAlgorithm<
_hashingAlgorithm: string
@@ -195,7 +195,7 @@ Encoding: string
Private _inputEncoding
_inputPrivate _outputEncoding_outputEncoding: string
Private _outputPath
Private _socketNodeEx
_socketNodeExtension: string
@@ -243,7 +243,7 @@
bucketNodeName
Returns string
@@ -251,7 +251,7 @@Returns string
Parameters
@@ -275,7 +275,7 @@bucketPattern
Returns BucketPatternInterface
@@ -283,7 +283,7 @@Returns
Parameters
@@ -307,7 +307,7 @@cartridgeFlavours
Returns Array<FlavourInterface>
@@ -315,7 +315,7 @@Returns Array
Parameters
@@ -339,7 +339,7 @@cartridgeNodeExtension
Returns string
@@ -347,7 +347,7 @@Returns string
Parameters
@@ -371,7 +371,7 @@checkBeforeOverwrite
Returns boolean
@@ -379,7 +379,7 @@Returns boolean
Parameters
@@ -403,7 +403,7 @@hashingAlgorithm
Returns string
@@ -411,7 +411,7 @@Returns string
Parameters
@@ -435,7 +435,7 @@inputEncoding
Returns string
@@ -443,7 +443,7 @@Returns string
Parameters
@@ -467,7 +467,7 @@outputEncoding
Returns string
@@ -475,7 +475,7 @@Returns string
Parameters
@@ -499,7 +499,7 @@outputPath
Returns string
@@ -507,7 +507,7 @@Returns string
Parameters
@@ -531,7 +531,7 @@socketNodeExtension
Returns string
@@ -539,7 +539,7 @@Returns string
@@ -149,7 +149,7 @@
diff --git a/docs/interfaces/flavours.flavourinterface.html b/docs/interfaces/flavours.flavourinterface.html
index e55e5e9..2dbaedd 100644
--- a/docs/interfaces/flavours.flavourinterface.html
+++ b/docs/interfaces/flavours.flavourinterface.html
@@ -122,7 +122,7 @@ cartridgeGroupName: string
@@ -137,7 +137,7 @@ collectorExample: string
@@ -152,7 +152,7 @@ collectorMaxDepthGroupName: string
@@ -167,7 +167,7 @@ collectorPattern: RegExp
@@ -184,7 +184,7 @@ collectorPatternGroupName: string
@@ -199,7 +199,7 @@ collectorPatternTypeGroupName: string
@@ -214,7 +214,7 @@ description: string
@@ -229,7 +229,7 @@ example: string
@@ -244,7 +244,7 @@ globPatternFlag: string
@@ -259,7 +259,7 @@ name: string
@@ -274,7 +274,7 @@ pattern: RegExp
@@ -290,7 +290,7 @@ regExpPatternFlag: string
diff --git a/docs/interfaces/options.bucketpatterninterface.html b/docs/interfaces/options.bucketpatterninterface.html
index fbe00d2..a2b6159 100644
--- a/docs/interfaces/options.bucketpatterninterface.html
+++ b/docs/interfaces/options.bucketpatterninterface.html
@@ -116,7 +116,7 @@ globPatternFlag: string
@@ -131,7 +131,7 @@ maxDepthGroupName: string
@@ -146,7 +146,7 @@ pattern: RegExp
@@ -162,7 +162,7 @@ patternGroupName: string
@@ -177,7 +177,7 @@ patternTypeGroupName: string
@@ -192,7 +192,7 @@ regExpPatternFlag: string
diff --git a/docs/interfaces/options.converteroptionsinterface.html b/docs/interfaces/options.converteroptionsinterface.html
index 23d08d0..e8ee3e4 100644
--- a/docs/interfaces/options.converteroptionsinterface.html
+++ b/docs/interfaces/options.converteroptionsinterface.html
@@ -120,7 +120,7 @@ bucketNodeName: string
@@ -135,7 +135,7 @@ bucketPattern: BucketPatternInterface
@@ -153,7 +153,7 @@ cartridgeFlavours: Array<FlavourInterface>
@@ -169,7 +169,7 @@ cartridgeNodeExtension: string
@@ -184,7 +184,7 @@ checkBeforeOverwrite: boolean
@@ -200,7 +200,7 @@ hashingAlgorithm: string
@@ -215,7 +215,7 @@ inputEncoding: string
@@ -230,7 +230,7 @@ outputEncoding: string
@@ -245,7 +245,7 @@ outputPath: string
@@ -260,7 +260,7 @@ socketNodeExtension: string
diff --git a/lib/converter/SocketNodeConverter.ts b/lib/converter/SocketNodeConverter.ts
index 54f2206..817966c 100644
--- a/lib/converter/SocketNodeConverter.ts
+++ b/lib/converter/SocketNodeConverter.ts
@@ -1,7 +1,7 @@
import { NodeConverterInterface } from './NodeConverterInterface'
import { ConverterOptionsInterface } from '../options/ConverterOptionsInterface'
import { FileNode } from 'file-hierarchy'
-import { CartridgeSlotBuilder, SocketNodeBuilder, SockoNodeInterface } from 'socko-api'
+import { CartridgeSlotBuilder, CartridgeSlotInterface, SocketNodeBuilder, SockoNodeInterface } from 'socko-api'
import { UnknownPatternTypeError } from '../errors/UnknownPatternTypeError'
import * as fs from 'fs'
import * as XRegExp from 'xregexp'
@@ -50,82 +50,112 @@ export class SocketNodeConverter implements NodeConverterInterface {
content => {
this._log.debug('Searching for cartridge slots in all supported flavours')
+ let cartridgeSlots: Array = []
+
for (let flavour of options.cartridgeFlavours) {
- XRegExp.forEach(
- content,
- flavour.pattern,
- (match: any, index) => {
- this._log.debug(`Found slot with ${flavour.name} flavour at index ${index}`)
-
- if (!match.hasOwnProperty(flavour.cartridgeGroupName)) {
- return Bluebird.reject(new InvalidCartridgePatternError(flavour.cartridgeGroupName))
+ let match: any
+
+ this._log.debug('Searching for cartridge slots in all suported flavours')
+
+ match = XRegExp.exec(content, flavour.pattern)
+ while (match) {
+ this._log.debug(`Found slot with ${flavour.name} flavour at index ${match.index}`)
+
+ if (!match.hasOwnProperty(flavour.cartridgeGroupName)) {
+ return Bluebird.reject(new InvalidCartridgePatternError(flavour.cartridgeGroupName))
+ }
+
+ this._log.debug('Checking, if there are other slots behind this one.')
+
+ for (let cartridgeSlot of cartridgeSlots) {
+ if (cartridgeSlot.index > match.index) {
+ cartridgeSlot.index -= match[0].length
}
+ }
+
+ cartridgeSlots.push(
+ new CartridgeSlotBuilder()
+ .withCartridgeName(match[flavour.cartridgeGroupName])
+ .withIndex(match.index)
+ .build()
+ )
+
+ // rewrite indices of cartridge slots with higher indices
+
+ content = XRegExp.replace(content, flavour.pattern, '')
+
+ match = XRegExp.exec(content, flavour.pattern)
+ }
+
+ this._log.debug('Searching for cartridge collector slots in all suported flavours')
+
+ match = XRegExp.exec(content, flavour.collectorPattern)
+ while (match) {
+ this._log.debug(`Found collector slot with ${flavour.name} flavour at index ${match.index}`)
+
+ this._log.debug('Sanity-checking match')
- socketNodeBuilder.withCartridgeSlot(
- new CartridgeSlotBuilder()
- .withCartridgeName(match[flavour.cartridgeGroupName])
- .withIndex(match.index)
- .build()
+ if (!match.hasOwnProperty(flavour.collectorPatternTypeGroupName)) {
+ return Bluebird.reject(
+ new InvalidCartridgeCollectorPatternError(flavour.collectorPatternTypeGroupName)
)
}
- )
- this._log.debug('Removing cartridge descriptors from content')
- content = XRegExp.replace(content, flavour.pattern, '')
+ if (!match.hasOwnProperty(flavour.collectorMaxDepthGroupName)) {
+ return Bluebird.reject(
+ new InvalidCartridgeCollectorPatternError(flavour.collectorMaxDepthGroupName)
+ )
+ }
- this._log.debug('Searching for cartridge collector in all suported flavours')
- XRegExp.forEach(
- content,
- flavour.collectorPattern,
- (match: any, index) => {
- this._log.debug(`Found collector slot with ${flavour.name} flavour at index ${index}`)
+ if (!match.hasOwnProperty(flavour.collectorPatternGroupName)) {
+ return Bluebird.reject(
+ new InvalidCartridgeCollectorPatternError(flavour.collectorPatternGroupName)
+ )
+ }
- this._log.debug('Sanity-checking match')
+ let pattern: RegExp | string
+ if (match[flavour.collectorPatternTypeGroupName] === flavour.regExpPatternFlag) {
+ this._log.debug('This is a RegExp pattern')
+ pattern = new RegExp(match[flavour.collectorPatternGroupName])
+ } else if (match[flavour.collectorPatternTypeGroupName] === flavour.globPatternFlag) {
+ this._log.debug('This is a glob pattern')
+ pattern = match[flavour.collectorPatternGroupName]
+ } else {
+ return Bluebird.reject(new UnknownPatternTypeError(match[flavour.collectorPatternTypeGroupName]))
+ }
- if (!match.hasOwnProperty(flavour.collectorPatternTypeGroupName)) {
- return Bluebird.reject(
- new InvalidCartridgeCollectorPatternError(flavour.collectorPatternTypeGroupName)
- )
- }
+ this._log.debug('Checking, if there are other slots behind this one.')
- if (!match.hasOwnProperty(flavour.collectorMaxDepthGroupName)) {
- return Bluebird.reject(
- new InvalidCartridgeCollectorPatternError(flavour.collectorMaxDepthGroupName)
- )
+ for (let cartridgeSlot of cartridgeSlots) {
+ if (cartridgeSlot.index > match.index) {
+ cartridgeSlot.index -= match[0].length
}
+ }
- if (!match.hasOwnProperty(flavour.collectorPatternGroupName)) {
- return Bluebird.reject(
- new InvalidCartridgeCollectorPatternError(flavour.collectorPatternGroupName)
- )
- }
+ cartridgeSlots.push(
+ new CartridgeSlotBuilder()
+ .withIndex(match.index)
+ .withIsCollector(true)
+ .withMaxDepth(parseInt(match[flavour.collectorMaxDepthGroupName], 10))
+ .withCartridgePattern(pattern)
+ .build()
+ )
- let pattern: RegExp | string
- if (match[flavour.collectorPatternTypeGroupName] === flavour.regExpPatternFlag) {
- this._log.debug('This is a RegExp pattern')
- pattern = new RegExp(match[flavour.collectorPatternGroupName])
- } else if (match[flavour.collectorPatternTypeGroupName] === flavour.globPatternFlag) {
- this._log.debug('This is a glob pattern')
- pattern = match[flavour.collectorPatternGroupName]
- } else {
- return Bluebird.reject(new UnknownPatternTypeError(match[flavour.collectorPatternTypeGroupName]))
- }
+ content = XRegExp.replace(content, flavour.collectorPattern, '')
- socketNodeBuilder.withCartridgeSlot(
- new CartridgeSlotBuilder()
- .withIndex(match.index)
- .withIsCollector(true)
- .withMaxDepth(parseInt(match[flavour.collectorMaxDepthGroupName], 10))
- .withCartridgePattern(pattern)
- .build()
- )
- }
- )
+ match = XRegExp.exec(content, flavour.collectorPattern)
+ }
- this._log.debug('Removing cartridge collector descriptors from content')
- content = XRegExp.replace(content, flavour.collectorPattern, '')
}
+ for (let cartridgeSlot of cartridgeSlots) {
+ socketNodeBuilder.withCartridgeSlot(cartridgeSlot)
+ }
+
+ socketNodeBuilder.withReadContent(() => {
+ return Bluebird.resolve(content)
+ })
+
return Bluebird.resolve(socketNodeBuilder.build())
}
)
diff --git a/package.json b/package.json
index 73c6770..7f4f9a1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "socko-converter-file",
- "version": "0.2.0",
+ "version": "0.3.0",
"description": "Converting file hierarchies to SOCKO! nodes",
"keywords": [
"socko",
diff --git a/test/FileToTreeConverterTest.ts b/test/FileToTreeConverterTest.ts
index 7fb6d59..452bb37 100644
--- a/test/FileToTreeConverterTest.ts
+++ b/test/FileToTreeConverterTest.ts
@@ -2,7 +2,7 @@ import 'mocha'
import { FileToTreeConverter } from '../lib/converter/FileToTreeConverter'
import { FileNode, ScanOptions } from 'file-hierarchy'
import * as path from 'path'
-import { BucketNodeInterface, OutputNode, SocketNodeInterface, SockoNodeType, SockoNodeInterface } from 'socko-api'
+import { BucketNodeInterface, SocketNodeInterface, SockoNodeInterface, SockoNodeType } from 'socko-api'
import chai = require('chai')
import chaiAsPromised = require('chai-as-promised')
import Bluebird = require('bluebird')
@@ -81,22 +81,21 @@ describe('FileToTreeConverter', function (): void {
54,
63,
70,
+ 96,
+ 105,
+ 124,
+ 135,
+ 144,
151,
- 172,
- 190,
- 211,
- 223,
- 239,
- 478,
- 500,
- 519,
- 541,
- 554,
- 571
+ 176,
+ 185,
+ 204,
+ 215,
+ 224,
+ 231
]
let sortedSlots = slots.sort((a, b) => { return a.index - b.index })
-
sortedSlots.forEach((slot, index) => {
chai.expect(slot.index).to.equal(slotIndices[index])
})
@@ -114,6 +113,9 @@ describe('FileToTreeConverter', function (): void {
).readContent(),
testCartridgeContent: (
value.getChildByName('testCartridge.txt') as SockoNodeInterface
+ ).readContent(),
+ testSocketNodeContent: (
+ value.getChildByName('testSocket.txt') as SocketNodeInterface
).readContent()
}
)
@@ -127,6 +129,74 @@ describe('FileToTreeConverter', function (): void {
chai.expect(
value.testCartridgeContent.toString('UTF-8')
).to.equal('CARTRIDGECONTENT')
+ chai.expect(
+ value.testSocketNodeContent
+ ).to.equal(`CARTRIDGES
+
+HASH:
+
+
+JSON:
+
+
+MULTILINESLASH:
+
+
+NATIVE:
+
+
+SLASH:
+
+
+XML:
+
+
+COLLECTORSREGEXP
+
+HASH:
+
+
+JSON:
+
+
+
+MULTILINESLASH:
+
+
+
+NATIVE:
+
+
+
+SLASH:
+
+
+XML:
+
+
+COLLECTORSGLOB:
+
+HASH:
+
+
+JSON:
+
+
+
+MULTILINESLASH:
+
+
+
+NATIVE:
+
+
+
+SLASH:
+
+
+XML:
+`
+ )
}
)
})
Parameters
diff --git a/docs/classes/options.converteroptionsfactory.html b/docs/classes/options.converteroptionsfactory.html index 16f69ee..e60c765 100644 --- a/docs/classes/options.converteroptionsfactory.html +++ b/docs/classes/options.converteroptionsfactory.html @@ -109,7 +109,7 @@create
Returns ConverterOptionsInterface
diff --git a/docs/interfaces/converter.nodeconverterinterface.html b/docs/interfaces/converter.nodeconverterinterface.html index a4fdd9d..6e18b55 100644 --- a/docs/interfaces/converter.nodeconverterinterface.html +++ b/docs/interfaces/converter.nodeconverterinterface.html @@ -118,7 +118,7 @@convert
isEligible
cartridgeGroupName
collectorExample
collectorMaxDepthGroupName
collectorPattern
collectorPatternGroupName
collectorPatternTypeGroupName
description
example
globPatternFlag
name
pattern
regExpPatternFlag
globPatternFlag
maxDepthGroupName
pattern
patternGroupName
patternTypeGroupName
regExpPatternFlag
bucketNodeName
bucketPattern
cartridgeFlavours
cartridgeNodeExtension
checkBeforeOverwrite
hashingAlgorithm
inputEncoding
outputEncoding
outputPath
socketNodeExtension