From ab44a65e8143452b584bf8fd030603360182c594 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 27 Aug 2015 10:57:17 +0200 Subject: [PATCH] Integrated scripts task --- make.go | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/make.go b/make.go index 2383e17d6..c9a4cd355 100644 --- a/make.go +++ b/make.go @@ -64,7 +64,45 @@ func embed() error { // scripts step concatinates all javascript files. func scripts() error { - // concatinate scripts + files := []string{ + "cmd/drone-server/static/scripts/term.js", + "cmd/drone-server/static/scripts/drone.js", + "cmd/drone-server/static/scripts/controllers/repos.js", + "cmd/drone-server/static/scripts/controllers/builds.js", + "cmd/drone-server/static/scripts/controllers/users.js", + "cmd/drone-server/static/scripts/services/repos.js", + "cmd/drone-server/static/scripts/services/builds.js", + "cmd/drone-server/static/scripts/services/users.js", + "cmd/drone-server/static/scripts/services/logs.js", + "cmd/drone-server/static/scripts/services/tokens.js", + "cmd/drone-server/static/scripts/services/feed.js", + "cmd/drone-server/static/scripts/filters/filter.js", + "cmd/drone-server/static/scripts/filters/gravatar.js", + "cmd/drone-server/static/scripts/filters/time.js", + } + + f, err := os.OpenFile( + "cmd/drone-server/static/scripts/drone.min.js", + os.O_CREATE|os.O_RDWR|os.O_TRUNC, + 0660) + + defer f.Close() + + if err != nil { + fmt.Println("Failed to open output file") + return err + } + + for _, input := range files { + content, err := ioutil.ReadFile(input) + + if err != nil { + return err + } + + f.Write(content) + } + return nil }