mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Properly scope Config to the wtf package and remove it as a dependency from everywhere else
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package jenkins
|
||||
|
||||
type View struct {
|
||||
Class string `json:"_class"`
|
||||
Description string `json:"description"`
|
||||
Jobs []Job `json:"jobs"`
|
||||
Name string `json:"name"`
|
||||
Property []string `json:"property"`
|
||||
url string `json:"url"`
|
||||
Class string `json:"_class"`
|
||||
Description string `json:"description"`
|
||||
Jobs []Job `json:"jobs"`
|
||||
Name string `json:"name"`
|
||||
Property []string `json:"property"`
|
||||
url string `json:"url"`
|
||||
}
|
||||
|
||||
@@ -2,14 +2,10 @@ package jenkins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
}
|
||||
@@ -29,8 +25,11 @@ func (widget *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
view, err := Create(Config.UString("wtf.mods.jenkins.url"),
|
||||
Config.UString("wtf.mods.jenkins.user"), os.Getenv("WTF_JENKINS_API_KEY"))
|
||||
view, err := Create(
|
||||
wtf.Config.UString("wtf.mods.jenkins.url"),
|
||||
wtf.Config.UString("wtf.mods.jenkins.user"),
|
||||
os.Getenv("WTF_JENKINS_API_KEY"),
|
||||
)
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
widget.View.Clear()
|
||||
@@ -54,7 +53,7 @@ func (widget *Widget) Refresh() {
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) contentFrom(view *View) string {
|
||||
str := fmt.Sprintf(" [red]%s[white]\n", view.Name);
|
||||
str := fmt.Sprintf(" [red]%s[white]\n", view.Name)
|
||||
|
||||
for _, job := range view.Jobs {
|
||||
str = str + fmt.Sprintf(
|
||||
|
||||
Reference in New Issue
Block a user