本文整理汇总了Golang中github.com/voxxit/drone/shared/build/buildfile.Buildfile.WriteString方法的典型用法代码示例。如果您正苦于以下问题:Golang Buildfile.WriteString方法的具体用法?Golang Buildfile.WriteString怎么用?Golang Buildfile.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/voxxit/drone/shared/build/buildfile.Buildfile
的用法示例。
在下文中一共展示了Buildfile.WriteString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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))
}