Created
July 27, 2015 21:21
-
-
Save msuarz/ef3af5d438a2e1987940 to your computer and use it in GitHub Desktop.
Go Grunt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadTasks = require 'load-grunt-tasks' | |
module.exports = (grunt) -> | |
env = process.env | |
cwd = process.cwd() | |
root = "#{cwd}/../../go" | |
src = "#{root}/src/#{env.src}" | |
command = (cmd, opts) -> | |
command: cmd | |
options: | |
execOptions: opts | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
env: | |
go: | |
GOPATH: root | |
PATH: "#{env.PATH}:#{root}/bin" | |
watch: | |
go: | |
files: ['../**/*.go'] | |
tasks: ['shell:sync', 'shell:test'] | |
shell: | |
env: command: 'env' | |
clean: command: "rm -Rf #{root}" | |
source: command: "mkdir -p #{src}" | |
sync: command: "rsync -ar ../ #{src}/ --exclude ci" | |
get: command("go get -v -t ./...", cwd: src) | |
test: command("go test -v ./...", cwd: src) | |
loadTasks grunt | |
grunt.option 'force', true | |
grunt.registerTask 'install', ['env:go', 'shell:clean', 'shell:source', 'shell:sync', 'shell:get'] | |
grunt.registerTask 'test', ['env:go', 'shell:test'] | |
grunt.registerTask 'echo', ['env:go', 'shell:env'] | |
grunt.registerTask 'default', ['env', 'watch:go'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment