本文整理匯總了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))
}
示例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))
}