當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。