Example #1
0
func convoxClient() (*client.Client, error) {
	if !viper.IsSet("convox.host") || !viper.IsSet("convox.password") {
		return nil, fmt.Errorf("must set 'convox.host' and 'convox.password' in $HOME/.ranch.yaml")
	}

	host := viper.GetString("convox.host")
	password := viper.GetString("convox.password")
	version := "20151211151200"
	return client.New(host, password, version), nil
}
Example #2
0
func ecruClient() (*gorequest.SuperAgent, error) {
	if !viper.IsSet("convox.password") {
		return nil, fmt.Errorf("must set 'convox.password' in $HOME/.ranch.yaml")
	}

	request := jsonClient().
		SetBasicAuth(viper.GetString("convox.password"), "x-auth-token")

	return request, nil
}
Example #3
0
func whichLicense() string {
	// if explicitly flagged, use that
	if userLicense != "" {
		return matchLicense(userLicense)
	}

	// if already present in the project, use that
	// TODO: Inspect project for existing license

	// default to viper's setting

	return matchLicense(viper.GetString("license"))
}
Example #4
0
func ranchClient() *gorequest.SuperAgent {
	authToken := viper.GetString("token")
	return jsonClient().
		SetBasicAuth(authToken, "x-auth-token")
}
Example #5
0
func ranchUrl(pathname string) string {
	u, _ := url.Parse(viper.GetString("endpoint"))
	u.Path = path.Join(u.Path, pathname)
	return u.String()
}
Example #6
0
func copyrightLine() string {
	author := viper.GetString("author")
	year := time.Now().Format("2006")

	return "Copyright © " + year + " " + author
}