Skip to content

Commit

Permalink
Merge pull request #41 from prometheus/beorn7/vendoring
Browse files Browse the repository at this point in the history
Vendor resources needed during runtime.
  • Loading branch information
beorn7 committed May 29, 2015
2 parents ac89737 + 2880f2b commit 7cd0cb6
Show file tree
Hide file tree
Showing 17 changed files with 395 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ include Makefile.COMMON

$(BINARY): bindata.go

bindata.go: $(GOPATH)/bin/go-bindata resources/*
$(GOPATH)/bin/go-bindata resources/
bindata.go: $(GOPATH)/bin/go-bindata $(shell find resources -type f)
$(GOPATH)/bin/go-bindata -prefix=resources resources/...

# Target to unconditionally compile the debug bindata.
.PHONY: bindata-debug
bindata-debug: $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -debug resources/
$(GOPATH)/bin/go-bindata -debug -prefix=resources resources/...

# Target to unconditionally compile the embedded bindata.
.PHONY: bindata-embed
bindata-embed: $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata resources/
$(GOPATH)/bin/go-bindata -prefix=resources resources/...

$(GOPATH)/bin/go-bindata:
$(GO) get github.com/jteeuwen/go-bindata/...
13 changes: 13 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@ Copyright 2014-2015 The Prometheus Authors

This product includes software developed at
SoundCloud Ltd. (http://soundcloud.com/).


The following components are included in this product:

jQuery
https://jquery.org
Copyright jQuery Foundation and other contributors
Licensed under the MIT License

Bootstrap
http://getbootstrap.com
Copyright 2011-2014 Twitter, Inc.
Licensed under the MIT License
2 changes: 1 addition & 1 deletion handler/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Status(
return strconv.FormatFloat(*f, 'f', -1, 64)
},
})
tpl, err := assetFunc("resources/template.html")
tpl, err := assetFunc("template.html")
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
Expand Down
15 changes: 6 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"syscall"
"time"

"github.com/elazarl/go-bindata-assetfs"
"github.com/julienschmidt/httprouter"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/log"
Expand Down Expand Up @@ -57,15 +58,11 @@ func main() {
r.PUT("/metrics/jobs/:job", handler.Push(ms, true))
r.POST("/metrics/jobs/:job", handler.Push(ms, false))
r.DELETE("/metrics/jobs/:job", handler.Delete(ms))
r.Handler("GET", "/functions.js", prometheus.InstrumentHandlerFunc(
r.Handler("GET", "/static/*filepath", prometheus.InstrumentHandler(
"static",
func(w http.ResponseWriter, _ *http.Request) {
if b, err := Asset("resources/functions.js"); err == nil {
w.Write(b)
} else {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
},
http.FileServer(
&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir},
),
))
statusHandler := prometheus.InstrumentHandlerFunc("status", handler.Status(ms, Asset, flags, BuildInfo))
r.Handler("GET", "/status", statusHandler)
Expand All @@ -74,7 +71,7 @@ func main() {
// Re-enable pprof.
r.GET("/debug/pprof/*pprof", handlePprof)

log.Printf("Listening on %s.\n", *listenAddress)
log.Printf("Listening on %s.", *listenAddress)
l, err := net.Listen("tcp", *listenAddress)
if err != nil {
log.Fatal(err)
Expand Down
21 changes: 21 additions & 0 deletions resources/static/bootstrap-3.3.4-dist/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2011-2015 Twitter, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions resources/static/bootstrap-3.3.4-dist/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions resources/static/bootstrap-3.3.4-dist/js/bootstrap.min.js

Large diffs are not rendered by default.

File renamed without changes.
4 changes: 4 additions & 0 deletions resources/static/jquery-2.1.4.min.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions resources/static/jquery-license
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Copyright jQuery Foundation and other contributors, https://jquery.org/

This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery

The following license applies to all parts of this software except as
documented below:

====

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

====

All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.
10 changes: 5 additions & 5 deletions resources/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Prometheus Pushgateway</title>

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="/functions.js"></script>
<script src="/static/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="/static/bootstrap-3.3.4-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/bootstrap-3.3.4-dist/css/bootstrap-theme.min.css">
<script src="/static/bootstrap-3.3.4-dist/js/bootstrap.min.js"></script>
<script src="/static/functions.js"></script>

<style type="text/css">
.cursor-pointer {
Expand Down

0 comments on commit 7cd0cb6

Please sign in to comment.