Skip to content

Commit a9f12ec

Browse files
committed
Implement tools.List
1 parent 9e998a5 commit a9f12ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+896
-322
lines changed

Gopkg.lock

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
required = ["goa.design/goa/codegen/generator"]
2828

2929
[[constraint]]
30-
name = "github.com/Sirupsen/logrus"
30+
name = "github.com/sirupsen/logrus"
3131
version = "1.2.0"
3232

3333
[[constraint]]

bufferflow_default.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
log "github.com/Sirupsen/logrus"
4+
log "github.com/sirupsen/logrus"
55
)
66

77
type BufferflowDefault struct {

bufferflow_timed.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"time"
66

7-
log "github.com/Sirupsen/logrus"
7+
log "github.com/sirupsen/logrus"
88
)
99

1010
type BufferflowTimed struct {

bufferflow_timedraw.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"time"
66

7-
log "github.com/Sirupsen/logrus"
7+
log "github.com/sirupsen/logrus"
88
)
99

1010
type BufferflowTimedRaw struct {

certificates.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"text/template"
2525
"time"
2626

27-
log "github.com/Sirupsen/logrus"
2827
"github.com/gin-gonic/gin"
28+
log "github.com/sirupsen/logrus"
2929
)
3030

3131
var (

conn.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
"os"
1919
"path/filepath"
2020

21-
log "github.com/Sirupsen/logrus"
2221
"github.com/arduino/arduino-create-agent/upload"
2322
"github.com/arduino/arduino-create-agent/utilities"
2423
"github.com/gin-gonic/gin"
2524
socketio "github.com/googollee/go-socket.io"
25+
log "github.com/sirupsen/logrus"
2626
)
2727

2828
type connection struct {

discovery.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
"strings"
3434
"time"
3535

36-
log "github.com/Sirupsen/logrus"
3736
"github.com/oleksandr/bonjour"
37+
log "github.com/sirupsen/logrus"
3838
)
3939

4040
const timeoutConst = 2

hub.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"strconv"
1313
"strings"
1414

15-
log "github.com/Sirupsen/logrus"
1615
"github.com/arduino/arduino-create-agent/upload"
1716
"github.com/kardianos/osext"
17+
log "github.com/sirupsen/logrus"
1818
)
1919

2020
type hub struct {

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import (
1515
"text/template"
1616
"time"
1717

18-
log "github.com/Sirupsen/logrus"
1918
"github.com/arduino/arduino-create-agent/tools"
2019
"github.com/arduino/arduino-create-agent/utilities"
2120
"github.com/arduino/arduino-create-agent/v2"
2221
"github.com/gin-gonic/gin"
2322
"github.com/go-ini/ini"
2423
cors "github.com/itsjamie/gin-cors"
2524
"github.com/kardianos/osext"
25+
log "github.com/sirupsen/logrus"
2626
//"github.com/sanbornm/go-selfupdate/selfupdate" #included in update.go to change heavily
2727
)
2828

seriallist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"regexp"
88
"strings"
99

10-
log "github.com/Sirupsen/logrus"
10+
log "github.com/sirupsen/logrus"
1111
"go.bug.st/serial.v1/enumerator"
1212
)
1313

serialport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99
"unicode/utf8"
1010

11-
log "github.com/Sirupsen/logrus"
11+
log "github.com/sirupsen/logrus"
1212
serial "go.bug.st/serial.v1"
1313
)
1414

trayicon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ import (
3535
"path/filepath"
3636
"runtime"
3737

38-
log "github.com/Sirupsen/logrus"
3938
"github.com/arduino/arduino-create-agent/icon"
4039
"github.com/facchinm/systray"
4140
"github.com/go-ini/ini"
4241
"github.com/kardianos/osext"
42+
log "github.com/sirupsen/logrus"
4343
"github.com/skratchdot/open-golang/open"
4444
"go.bug.st/serial.v1"
4545
)

updater/updater.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"runtime"
1515
"time"
1616

17-
log "github.com/Sirupsen/logrus"
18-
"gopkg.in/inconshreveable/go-update.v0"
1917
"github.com/kr/binarydist"
18+
log "github.com/sirupsen/logrus"
19+
"gopkg.in/inconshreveable/go-update.v0"
2020

2121
"github.com/kardianos/osext"
2222
)

upload/upload_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"strings"
66
"testing"
77

8-
"github.com/Sirupsen/logrus"
98
"github.com/arduino/arduino-create-agent/upload"
109
homedir "github.com/mitchellh/go-homedir"
10+
"github.com/sirupsen/logrus"
1111
)
1212

1313
type mockTools struct{}

v2/http.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"net/http"
66

7-
"github.com/Sirupsen/logrus"
87
toolssvr "github.com/arduino/arduino-create-agent/gen/http/tools/server"
98
toolssvc "github.com/arduino/arduino-create-agent/gen/tools"
109
"github.com/arduino/arduino-create-agent/v2/tools"
10+
"github.com/sirupsen/logrus"
1111
goahttp "goa.design/goa/http"
1212
"goa.design/goa/http/middleware"
1313
)
@@ -17,10 +17,13 @@ func Server() http.Handler {
1717

1818
// Instantiate logger
1919
logger := logrus.New()
20+
logger.SetLevel(logrus.DebugLevel)
2021
logAdapter := LogAdapter{Logger: logger}
2122

2223
// Mount tools
23-
toolsSvc := tools.Tools{}
24+
toolsSvc := tools.Tools{
25+
Log: logger,
26+
}
2427
toolsEndpoints := toolssvc.NewEndpoints(&toolsSvc)
2528

2629
toolsServer := toolssvr.New(toolsEndpoints, mux, goahttp.RequestDecoder, goahttp.ResponseEncoder, errorHandler(logger))

v2/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"fmt"
66

7-
"github.com/Sirupsen/logrus"
7+
"github.com/sirupsen/logrus"
88
)
99

1010
type LogAdapter struct {

v2/tools/tools.go

+42-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,54 @@ package tools
22

33
import (
44
"context"
5+
"io/ioutil"
6+
"os/user"
7+
"path/filepath"
58

69
"github.com/arduino/arduino-create-agent/gen/tools"
10+
"github.com/sirupsen/logrus"
711
)
812

913
type Tools struct {
14+
Log *logrus.Logger
1015
}
1116

1217
func (c *Tools) List(ctx context.Context) (tools.ToolCollection, error) {
13-
return tools.ToolCollection{}, nil
18+
res := tools.ToolCollection{}
19+
20+
// Find packagers
21+
usr, _ := user.Current()
22+
path := filepath.Join(usr.HomeDir, ".arduino-create")
23+
packagers, err := ioutil.ReadDir(path)
24+
if err != nil {
25+
return nil, err
26+
}
27+
28+
for _, packager := range packagers {
29+
if !packager.IsDir() {
30+
continue
31+
}
32+
// Find tools
33+
toolss, err := ioutil.ReadDir(filepath.Join(path, packager.Name()))
34+
if err != nil {
35+
return nil, err
36+
}
37+
for _, tool := range toolss {
38+
// Find versions
39+
versions, err := ioutil.ReadDir(filepath.Join(path, packager.Name(), tool.Name()))
40+
if err != nil {
41+
return nil, err
42+
}
43+
44+
for _, version := range versions {
45+
res = append(res, &tools.Tool{
46+
Packager: packager.Name(),
47+
Name: tool.Name(),
48+
Version: version.Name(),
49+
})
50+
}
51+
}
52+
}
53+
54+
return res, nil
1455
}

vendor/gopkg.in/yaml.v2/.travis.yml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)