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


Golang Buildfile.WriteString方法代码示例

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


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

示例1: Write

func (n *NPM) Write(f *buildfile.Buildfile) {
	// If the yaml doesn't provide a token we should attempt to use the global defaults.
	if len(n.Token) == 0 {
		n.Token = *DefaultToken
	}

	if len(n.Registry) == 0 {
		n.Registry = *DefaultRegistry
	}

	// Setup the npm credentials
	f.WriteCmdSilent(fmt.Sprintf(CmdLogin, n.Registry, n.Token))

	if len(n.Folder) == 0 {
		n.Folder = "."
	}

	f.WriteString(fmt.Sprintf(CmdPublish, n.Folder, n.Tag, n.Folder))
}
开发者ID:Clever,项目名称:drone,代码行数:19,代码来源:npm.go

示例2: Write

func (n *NPM) Write(f *buildfile.Buildfile) {
	// If the yaml doesn't provide a username or password
	// we should attempt to use the global defaults.
	if len(n.Email) == 0 ||
		len(n.Username) == 0 ||
		len(n.Password) == 0 {
		n.Username = *DefaultUser
		n.Password = *DefaultPass
		n.Email = *DefaultEmail
	}

	// If the yaml doesn't provide a username or password,
	// and there was not global configuration defined, EXIT.
	if len(n.Email) == 0 ||
		len(n.Username) == 0 ||
		len(n.Password) == 0 {
		return
	}

	// Setup the npm credentials
	f.WriteCmdSilent(fmt.Sprintf(CmdLogin, n.Username, n.Password, n.Email))

	// Setup custom npm registry
	if len(n.Registry) != 0 {
		f.WriteCmd(fmt.Sprintf(CmdSetRegistry, n.Registry))
	}

	// Set npm to always authenticate
	if n.AlwaysAuth {
		f.WriteCmd(CmdAlwaysAuth)
	}

	if len(n.Folder) == 0 {
		n.Folder = "."
	}

	f.WriteString(fmt.Sprintf(CmdPublish, n.Folder, n.Tag, n.Folder))
}
开发者ID:zankard,项目名称:drone,代码行数:38,代码来源:npm.go


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