Beispiel #1
0
func NewRepo(r *site.Repo) *Repo {
	issueRe := regexp.MustCompile(`(` + strings.Join(r.Aliases, "|") + `)#([1-9][0-9]*)`)
	issueRe.Longest()
	pullRe := regexp.MustCompile(`(` + strings.Join(r.Aliases, "|") + `)!([1-9][0-9]*)`)
	pullRe.Longest()
	commitRe := regexp.MustCompile(`\b[0-9a-f]{8,40}\b`)
	commitRe.Longest()
	return &Repo{
		Name:     r.Name,
		Prefix:   r.Prefix,
		Path:     r.Path,
		IssueRe:  issueRe,
		PullRe:   pullRe,
		CommitRe: commitRe,
		Client:   *client.NewClient(nil, r.Token),
	}
}
Beispiel #2
0
func client(c *integram.Context) *api.Client {

	client := api.NewClient(c.User.OAuthHTTPClient(), "")
	client.SetBaseURL(c.ServiceBaseURL.String() + apiSuffixURL)
	return client
}