当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript log.subhead方法代码示例

本文整理汇总了TypeScript中grunt.log.subhead方法的典型用法代码示例。如果您正苦于以下问题:TypeScript log.subhead方法的具体用法?TypeScript log.subhead怎么用?TypeScript log.subhead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grunt.log的用法示例。


在下文中一共展示了log.subhead方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: convertToSockoTrees

  /**
   * Converts the `FileTree`s to `SockoTree`s
   * @return {Bluebird<void>}
   */
  private convertToSockoTrees (): Bluebird<void> {
    grunt.log.subhead('Converting file trees to socko trees')

    let inputConverterOptions = new ConverterOptionsFactory().create()
    let inputConverter = new FileToTreeConverter(inputConverterOptions)

    let hierarchyConverterOptions = new ConverterOptionsFactory().create()
    let hierarchyConverter = new FileToTreeConverter(hierarchyConverterOptions)

    return Bluebird.props({
      input: inputConverter.convert(this._trees.fileInput),
      hierarchy: hierarchyConverter.convert(this._trees.fileHierarchy)
    })
      .then(
        trees => {
          this._trees.sockoHierarchy = trees.hierarchy
          this._trees.sockoInput = trees.input
          return this._trees.sockoHierarchy.getNodeByPath(`:_root:${this._options.node}`, ':')
        }
      )
      .then(
        node => {
          this._trees.sockoNode = node as SockoNodeInterface
          return Bluebird.resolve()
        }
      )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:31,代码来源:SockoRunner.ts

示例2: runSocko

  /**
   * Calls socko to generate the output node
   * @return {Bluebird<SockoNodeInterface>} the output node
   */
  private runSocko (): Bluebird<SockoNodeInterface> {
    grunt.log.subhead('Running socko')

    let processorOptions = new ProcessorOptionsFactory().create()
    if (this._options.ignores && this._options.ignores.length > 0) {
      let ignoreObject = new Map<string, string>()

      for (let ignoreOption of this._options.ignores) {
        let ignoreSplit = ignoreOption.split(/=/)

        if (ignoreSplit.length === 1) {
          ignoreSplit.unshift('*')
        }

        ignoreObject.set(ignoreSplit[1], ignoreSplit[0])
      }

      processorOptions.processCartridgeNode = node => {
        if (ignoreObject.has(node.name)) {
          if (ignoreObject.get(node.name) === '*') {
            return Bluebird.resolve(new SkippedNodeBuilder().build())
          } else {
            return node.getPath(':')
              .then(
                value => {
                  if (`${ignoreObject.get(node.name)}:${node.name}` === value) {
                    return Bluebird.resolve(new SkippedNodeBuilder().build())
                  } else {
                    return Bluebird.resolve(node)
                  }
                }
              )
          }
        } else {
          return Bluebird.resolve(node)
        }
      }
    }
    if (this._options.renames && this._options.renames.length > 0) {
      let renameObject = new Map<string, string>()

      for (let renameOption of this._options.renames) {
        let splitRenameOption = renameOption.split(/:/)
        renameObject.set(splitRenameOption[0], splitRenameOption[1])
      }
      processorOptions.processResultTreeNode = node => {
        if (renameObject.has(node.name)) {
          node.name = renameObject.get(node.name)
        }
        return Bluebird.resolve(node)
      }
    }
    processorOptions.allowEmptyCartridgeSlots = this._options.ignoreMissing

    return new SockoProcessor().process(
      this._trees.sockoInput,
      this._trees.sockoNode,
      processorOptions
    )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:64,代码来源:SockoRunner.ts

示例3: convertToFileTrees

  /**
   * Converts the directories to `FileTree`
   * @return {Bluebird<void>}
   */
  private convertToFileTrees (): Bluebird<void> {
    grunt.log.subhead('Converting fileInput and fileHierarchy directories to tree.')
    grunt.log.verbose.writeln('Ignoring fileHierarchy path in fileInput path and vice versa while doing so.')

    let inputScanOptions = new ScanOptions(this._paths.input)
    if (this._paths.hierarchy.startsWith(this._paths.input)) {
      inputScanOptions.filter = (filterPath, entry) => {
        return Bluebird.resolve(!path.join(filterPath, entry).endsWith(this._paths.hierarchy))
      }
    }

    let hierarchyScanOptions = new ScanOptions(this._paths.hierarchy)

    if (this._paths.input.startsWith(this._paths.hierarchy)) {
      hierarchyScanOptions.filter = (filterPath, entry) => {
        return Bluebird.resolve(!path.join(filterPath, entry).endsWith(this._paths.input))
      }
    }

    return Bluebird.props({
      input: new FileNode().scan(inputScanOptions),
      hierarchy: new FileNode().scan(hierarchyScanOptions)
    })
      .then(
        trees => {
          this._trees.fileHierarchy = trees.hierarchy
          this._trees.fileInput = trees.input
          return Bluebird.resolve()
        }
      )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:35,代码来源:SockoRunner.ts

示例4: convertFromOutputNode

  /**
   * Converts the output node to a directory with files
   * @param {SockoNodeInterface} outputNode the output node to generate
   * @return {Bluebird<void>}
   */
  private convertFromOutputNode (outputNode: SockoNodeInterface): Bluebird<void> {
    grunt.log.subhead('Converting output tree to directory')

    let converterOptions = new ConverterOptionsFactory().create()
    converterOptions.checkBeforeOverwrite = this._options.skipIdenticalSockets
    converterOptions.outputPath = this._paths.output

    return new TreeToFileConverter(converterOptions).convert(outputNode)
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:14,代码来源:SockoRunner.ts

示例5: checkAccess

  /**
   * Checks access to all needed directories
   * @return {Bluebird<void>}
   */
  private checkAccess (): Bluebird<void> {

    grunt.log.subhead('Checking valid access to specified paths')

    let input = this._options.input
    let output = this._options.output
    let hierarchy: string

    if (!this._options.hierarchy) {
      hierarchy = path.join(this._options.input, '_socko')
    } else {
      hierarchy = this._options.hierarchy
    }

    let nodePath = path.join(hierarchy, ...this._options.node.split(':'))

    let canAccess = Bluebird.promisify<void, fs.PathLike, number | undefined>(fs.access)

    return Bluebird.all(
      [
        canAccess(input, fs.constants.R_OK),
        canAccess(hierarchy, fs.constants.R_OK),
        canAccess(nodePath, fs.constants.R_OK)
      ]
    )
      .catch(
        (error: any) => {
          return error.code === 'ENOENT'
        },
        (error: any) => {
          return Bluebird.reject(
            new Error(`Can not find directory ${error.path}. Please check your command line arguments.`)
          )
        }
      )
      .catch(
        (error: any) => {
          return error.code === 'EACCES'
        },
        (error: any) => {
          return Bluebird.reject(
            new Error(`Can not access directory ${error.path}. Please check your command line arguments.`)
          )
        }
      )
      .then(
        () => {
          return canAccess(output, fs.constants.W_OK)
        }
      )
      .catch(
        (error: any) => {
          return error.code === 'ENOENT'
        },
        () => {
          return Bluebird.resolve()
        }
      )
      .catch(
        (error: any) => {
          return error.code === 'EACCES'
        },
        (error: any) => {
          return Bluebird.reject(
            new Error(`Can not access directory ${error.path}. Please check your command line arguments.`)
          )
        }
      )
      .then(
        () => {
          this._paths.hierarchy = hierarchy
          this._paths.input = input
          this._paths.output = output
          return Bluebird.resolve()
        }
      )
  }
开发者ID:dploeger,项目名称:grunt-socko,代码行数:81,代码来源:SockoRunner.ts


注:本文中的grunt.log.subhead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。