├── Supfile ├── Procfile ├── Godeps ├── _workspace │ ├── .gitignore │ └── src │ │ ├── golang.org │ │ └── x │ │ │ ├── sys │ │ │ ├── unix │ │ │ │ ├── .gitignore │ │ │ │ ├── asm.s │ │ │ │ ├── constants.go │ │ │ │ ├── syscall_no_getwd.go │ │ │ │ ├── zsysnum_solaris_amd64.go │ │ │ │ ├── env_unset.go │ │ │ │ ├── flock_linux_32bit.go │ │ │ │ ├── asm_solaris_amd64.s │ │ │ │ ├── gccgo_linux_amd64.go │ │ │ │ ├── race0.go │ │ │ │ ├── env_unix.go │ │ │ │ ├── asm_linux_arm64.s │ │ │ │ ├── str.go │ │ │ │ ├── race.go │ │ │ │ ├── asm_linux_ppc64x.s │ │ │ │ ├── asm_linux_arm.s │ │ │ │ ├── asm_freebsd_arm.s │ │ │ │ ├── asm_netbsd_arm.s │ │ │ │ ├── asm_darwin_386.s │ │ │ │ ├── asm_freebsd_386.s │ │ │ │ ├── asm_netbsd_386.s │ │ │ │ ├── asm_openbsd_386.s │ │ │ │ ├── asm_darwin_amd64.s │ │ │ │ ├── asm_dragonfly_386.s │ │ │ │ ├── asm_freebsd_amd64.s │ │ │ │ ├── asm_linux_amd64.s │ │ │ │ ├── asm_netbsd_amd64.s │ │ │ │ ├── asm_openbsd_amd64.s │ │ │ │ ├── asm_dragonfly_amd64.s │ │ │ │ ├── asm_darwin_arm.s │ │ │ │ ├── asm_darwin_arm64.s │ │ │ │ ├── flock.go │ │ │ │ ├── mksysnum_darwin.pl │ │ │ │ ├── asm_linux_386.s │ │ │ │ ├── syscall_solaris_amd64.go │ │ │ │ ├── gccgo_c.c │ │ │ │ ├── syscall_openbsd_amd64.go │ │ │ │ ├── sockcmsg_linux.go │ │ │ │ ├── syscall_netbsd_386.go │ │ │ │ ├── syscall_netbsd_arm.go │ │ │ │ ├── syscall_openbsd_386.go │ │ │ │ ├── syscall_netbsd_amd64.go │ │ │ │ ├── mksysnum_dragonfly.pl │ │ │ │ ├── mksysnum_openbsd.pl │ │ │ │ ├── mksysnum_netbsd.pl │ │ │ │ ├── mksysnum_linux.pl │ │ │ │ ├── gccgo.go │ │ │ │ ├── syscall_freebsd_amd64.go │ │ │ │ ├── syscall_dragonfly_amd64.go │ │ │ │ ├── syscall_freebsd_arm.go │ │ │ │ ├── syscall_freebsd_386.go │ │ │ │ ├── syscall_dragonfly_386.go │ │ │ │ ├── mksysnum_freebsd.pl │ │ │ │ ├── syscall_darwin_arm.go │ │ │ │ ├── syscall_darwin_arm64.go │ │ │ │ ├── syscall_darwin_386.go │ │ │ │ ├── syscall_darwin_amd64.go │ │ │ │ └── syscall.go │ │ │ ├── PATENTS │ │ │ └── LICENSE │ │ │ ├── crypto │ │ │ ├── ssh │ │ │ │ ├── test │ │ │ │ │ └── doc.go │ │ │ │ ├── terminal │ │ │ │ │ ├── util_bsd.go │ │ │ │ │ └── util_linux.go │ │ │ │ ├── doc.go │ │ │ │ ├── mac.go │ │ │ │ ├── buffer.go │ │ │ │ └── agent │ │ │ │ │ └── forward.go │ │ │ ├── curve25519 │ │ │ │ ├── const_amd64.s │ │ │ │ ├── doc.go │ │ │ │ ├── cswap_amd64.s │ │ │ │ ├── freeze_amd64.s │ │ │ │ └── square_amd64.s │ │ │ ├── PATENTS │ │ │ └── LICENSE │ │ │ └── net │ │ │ ├── PATENTS │ │ │ ├── LICENSE │ │ │ └── websocket │ │ │ └── client.go │ │ ├── github.com │ │ ├── nlopes │ │ │ └── slack │ │ │ │ ├── .gitignore │ │ │ │ ├── examples │ │ │ │ ├── files │ │ │ │ │ ├── example.txt │ │ │ │ │ └── files.go │ │ │ │ ├── users │ │ │ │ │ └── users.go │ │ │ │ ├── groups │ │ │ │ │ └── groups.go │ │ │ │ ├── messages │ │ │ │ │ └── messages.go │ │ │ │ ├── stars │ │ │ │ │ └── stars.go │ │ │ │ └── websocket │ │ │ │ │ └── websocket.go │ │ │ │ ├── TODO.txt │ │ │ │ ├── .travis.yml │ │ │ │ ├── comment.go │ │ │ │ ├── websocket_stars.go │ │ │ │ ├── websocket_reactions.go │ │ │ │ ├── websocket_pins.go │ │ │ │ ├── pagination.go │ │ │ │ ├── emoji.go │ │ │ │ ├── messageID.go │ │ │ │ ├── websocket_dm.go │ │ │ │ ├── history.go │ │ │ │ ├── websocket_teams.go │ │ │ │ ├── attachments.go │ │ │ │ ├── websocket_utils.go │ │ │ │ ├── LICENSE │ │ │ │ ├── rtm.go │ │ │ │ ├── conversation.go │ │ │ │ ├── websocket_files.go │ │ │ │ ├── backoff.go │ │ │ │ ├── websocket_groups.go │ │ │ │ ├── oauth.go │ │ │ │ ├── slack.go │ │ │ │ ├── websocket_proxy.go │ │ │ │ ├── README.md │ │ │ │ ├── pins.go │ │ │ │ ├── websocket_internals.go │ │ │ │ ├── item.go │ │ │ │ ├── websocket_channels.go │ │ │ │ └── websocket.go │ │ ├── pressly │ │ │ └── sup │ │ │ │ ├── .gitignore │ │ │ │ ├── example │ │ │ │ ├── example.local.cfg │ │ │ │ ├── example.stg.cfg │ │ │ │ ├── example.dev.cfg │ │ │ │ ├── example.prod.cfg │ │ │ │ ├── Dockerfile │ │ │ │ ├── scripts │ │ │ │ │ └── docker-build.sh │ │ │ │ └── example.go │ │ │ │ ├── .travis.yml │ │ │ │ ├── Glockfile │ │ │ │ ├── colors.go │ │ │ │ ├── client.go │ │ │ │ ├── Makefile │ │ │ │ ├── LICENSE │ │ │ │ ├── tar.go │ │ │ │ └── localhost.go │ │ ├── boltdb │ │ │ └── bolt │ │ │ │ ├── .gitignore │ │ │ │ ├── boltsync_unix.go │ │ │ │ ├── bolt_linux.go │ │ │ │ ├── bolt_386.go │ │ │ │ ├── bolt_arm.go │ │ │ │ ├── bolt_amd64.go │ │ │ │ ├── bolt_arm64.go │ │ │ │ ├── bolt_s390x.go │ │ │ │ ├── bolt_ppc64le.go │ │ │ │ ├── Makefile │ │ │ │ ├── bolt_openbsd.go │ │ │ │ ├── LICENSE │ │ │ │ ├── doc.go │ │ │ │ ├── bolt_unix_solaris.go │ │ │ │ ├── bolt_unix.go │ │ │ │ └── errors.go │ │ ├── goware │ │ │ └── prefixer │ │ │ │ ├── doc.go │ │ │ │ ├── .travis.yml │ │ │ │ ├── example │ │ │ │ ├── prefix.go │ │ │ │ └── README.md │ │ │ │ ├── LICENSE │ │ │ │ └── README.md │ │ ├── stretchr │ │ │ └── testify │ │ │ │ ├── assert │ │ │ │ ├── assertion_forward.go.tmpl │ │ │ │ ├── errors.go │ │ │ │ ├── forward_assertions.go │ │ │ │ └── doc.go │ │ │ │ ├── vendor │ │ │ │ └── github.com │ │ │ │ │ ├── davecgh │ │ │ │ │ └── go-spew │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── stretchr │ │ │ │ │ └── objx │ │ │ │ │ │ └── LICENSE.md │ │ │ │ │ └── pmezard │ │ │ │ │ └── go-difflib │ │ │ │ │ └── LICENSE │ │ │ │ ├── LICENSE │ │ │ │ └── LICENCE.txt │ │ ├── davecgh │ │ │ └── go-spew │ │ │ │ ├── LICENSE │ │ │ │ └── spew │ │ │ │ └── bypasssafe.go │ │ └── pmezard │ │ │ └── go-difflib │ │ │ └── LICENSE │ │ └── gopkg.in │ │ └── yaml.v2 │ │ ├── LICENSE.libyaml │ │ ├── writerc.go │ │ └── sorter.go ├── Readme └── Godeps.json ├── etc └── fresh-runner.conf ├── .gitignore ├── cmd └── supbot │ ├── main.go │ └── Supfile ├── lib ├── sup │ └── sup_test.go ├── git │ ├── git_test.go │ └── git.go ├── hal │ ├── Supfile │ └── hal_test.go └── slack │ └── client.go ├── app.json ├── Dockerfile ├── Makefile └── README.md /Supfile: -------------------------------------------------------------------------------- 1 | cmd/supbot/Supfile -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: bin/supbot 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/.gitignore: -------------------------------------------------------------------------------- 1 | /pkg 2 | /bin 3 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/.gitignore: -------------------------------------------------------------------------------- 1 | *.test 2 | *~ 3 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | *.sw? 3 | -------------------------------------------------------------------------------- /etc/fresh-runner.conf: -------------------------------------------------------------------------------- 1 | valid_ext: .conf, .go, .tpl, .tmpl, .html 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/example.local.cfg: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/example.stg.cfg: -------------------------------------------------------------------------------- 1 | staging 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/example.dev.cfg: -------------------------------------------------------------------------------- 1 | development 2 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/example.prod.cfg: -------------------------------------------------------------------------------- 1 | production 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | bin 3 | cmd/*/tmp 4 | *.db 5 | supbot_linux_amd64 6 | sup_linux_amd64 7 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/.gitignore: -------------------------------------------------------------------------------- 1 | *.prof 2 | *.test 3 | *.swp 4 | /bin/ 5 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/files/example.txt: -------------------------------------------------------------------------------- 1 | Nan Nan Nan Nan Nan Nan Nan Nan Batman 2 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/doc.go: -------------------------------------------------------------------------------- 1 | // Package prefixer implements io.Reader wrapper prepending 2 | // every line with a given string. 3 | package prefixer 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/TODO.txt: -------------------------------------------------------------------------------- 1 | - Add more tests!!! 2 | - Add support to have markdown hints 3 | - See section Message Formatting at https://api.slack.com/docs/formatting 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.5.2 5 | - 1.4.3 6 | - tip 7 | 8 | install: 9 | - make tools deps build 10 | 11 | script: 12 | - make test 13 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 4 | } 5 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - tip 6 | 7 | script: 8 | - go test 9 | - cd example && go build -o prefix && echo -e "1\n2\n3\n" | ./prefix | grep "> " 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/Glockfile: -------------------------------------------------------------------------------- 1 | github.com/goware/prefixer 395022866408d928fc2439f7eac73dd8d370ec1d 2 | golang.org/x/crypto beef0f4390813b96e8e68fd78570396d0f4751fc 3 | gopkg.in/yaml.v2 53feefa2559fb8dfa8d81baad31be332c97d6c77 4 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/boltsync_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!linux,!openbsd 2 | 3 | package bolt 4 | 5 | // fdatasync flushes written data to a file descriptor. 6 | func fdatasync(db *DB) error { 7 | return db.file.Sync() 8 | } 9 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_linux.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fdatasync flushes written data to a file descriptor. 8 | func fdatasync(db *DB) error { 9 | return syscall.Fdatasync(int(db.file.Fd())) 10 | } 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_386.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_amd64.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0x7FFFFFFF 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/colors.go: -------------------------------------------------------------------------------- 1 | package sup 2 | 3 | var ( 4 | Colors = []string{ 5 | "\033[32m", // green 6 | "\033[33m", // yellow 7 | "\033[36m", // cyan 8 | "\033[35m", // magenta 9 | "\033[31m", // red 10 | "\033[34m", // blue 11 | } 12 | ResetColor = "\033[0m" 13 | ) 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | TEXT ·use(SB),NOSPLIT,$0 10 | RET 11 | -------------------------------------------------------------------------------- /cmd/supbot/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/gophergala2016/supbot/lib/slack" 7 | ) 8 | 9 | func main() { 10 | token := os.Getenv("SLACK_TOKEN") 11 | if token == "" { 12 | panic("slack token must be set") 13 | } 14 | 15 | s := slack.NewClient(token) 16 | s.Start() 17 | } 18 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm64.go: -------------------------------------------------------------------------------- 1 | // +build arm64 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_s390x.go: -------------------------------------------------------------------------------- 1 | // +build s390x 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_ppc64le.go: -------------------------------------------------------------------------------- 1 | // +build ppc64le 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/test/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This package contains integration tests for the 6 | // golang.org/x/crypto/ssh package. 7 | package test 8 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - tip 6 | 7 | before_install: 8 | - export PATH=$HOME/gopath/bin:$PATH 9 | 10 | script: 11 | - go test -race ./... 12 | - go test -cover ./... 13 | 14 | matrix: 15 | allow_failures: 16 | - go: tip 17 | 18 | git: 19 | depth: 10 20 | -------------------------------------------------------------------------------- /lib/sup/sup_test.go: -------------------------------------------------------------------------------- 1 | package sup 2 | 3 | import ( 4 | "bytes" 5 | "log" 6 | "testing" 7 | ) 8 | 9 | func TestNew(t *testing.T) { 10 | var b bytes.Buffer 11 | if err := New(&b).SetNetwork("local").SetTarget("ping").SetWd("../../cmd/supbot").Exec(); err != nil { 12 | log.Fatalln("Testing error:", err) 13 | } 14 | 15 | log.Printf("%s", string(b.Bytes())) 16 | } 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/client.go: -------------------------------------------------------------------------------- 1 | package sup 2 | 3 | import "io" 4 | 5 | type Client interface { 6 | Connect(host string) error 7 | Run(task *Task) error 8 | Wait() error 9 | Close() error 10 | Prefix() (string, int) 11 | Write(p []byte) (n int, err error) 12 | WriteClose() error 13 | Stdin() io.WriteCloser 14 | Stderr() io.Reader 15 | Stdout() io.Reader 16 | } 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/comment.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // Comment contains all the information relative to a comment 4 | type Comment struct { 5 | ID string `json:"id,omitempty"` 6 | Created JSONTime `json:"created,omitempty"` 7 | Timestamp JSONTime `json:"timestamp,omitempty"` 8 | User string `json:"user,omitempty"` 9 | Comment string `json:"comment,omitempty"` 10 | } 11 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "supbot-gophergala2016", 3 | "description": "Chatops slack bot for Sup", 4 | "keywords": [ 5 | "sup", 6 | "go", 7 | "gophergala2016", 8 | "chatops" 9 | ], 10 | "image": "heroku/go:1.5", 11 | "mount_dir": "src/github.com/gophergala2016/supbot/cmd/supbot", 12 | "website": "http://github.com/gophergala2016/supbot", 13 | "repository": "http://github.com/gophergala2016/supbot" 14 | } 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/Dockerfile: -------------------------------------------------------------------------------- 1 | #FROM scratch 2 | #FROM gliderlabs/alpine:3.1 3 | #FORM ubuntu_lean # https://blog.jtlebi.fr/2015/04/25/how-i-shrunk-a-docker-image-by-98-8-featuring-fanotify/ 4 | 5 | FROM ubuntu:14.04 6 | 7 | #RUN apt-get update && apt-get install --no-install-recommends -y \ 8 | # ca-certificates 9 | 10 | COPY ./example /usr/bin/ 11 | 12 | EXPOSE 8000 13 | 14 | CMD ["/usr/bin/example"] 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "syscall" 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | const ioctlWriteTermios = syscall.TIOCSETA 13 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/scripts/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /tmp/$IMAGE 5 | 6 | # Cleanup. 7 | sudo rm -rf bin 8 | 9 | # Bulder image. Build binaries (make dist) into bin/ dir. 10 | sudo docker run --rm \ 11 | -v $(pwd):/go/src/$REPO/$NAME \ 12 | -w /go/src/$REPO/$NAME \ 13 | golang:1.5.2 go build 14 | 15 | # Bake bin/* into the resulting image. 16 | sudo docker build --no-cache -t $IMAGE . 17 | 18 | sudo docker push $IMAGE 19 | -------------------------------------------------------------------------------- /lib/git/git_test.go: -------------------------------------------------------------------------------- 1 | package git 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestCloneCheckout(t *testing.T) { 10 | assert := assert.New(t) 11 | 12 | repo, err := Clone("https://github.com/gophergala2016/supbot.git") 13 | assert.NoError(err) 14 | assert.NotNil(repo) 15 | 16 | assert.NotEmpty(repo.Dir()) 17 | 18 | err = repo.Checkout("master") 19 | assert.NoError(err) 20 | } 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/users/users.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 7 | ) 8 | 9 | func main() { 10 | api := slack.New("YOUR_TOKEN_HERE") 11 | user, err := api.GetUserInfo("U023BECGF") 12 | if err != nil { 13 | fmt.Printf("%s\n", err) 14 | return 15 | } 16 | fmt.Printf("ID: %s, Fullname: %s, Email: %s\n", user.ID, user.Profile.RealName, user.Profile.Email) 17 | } 18 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_stars.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | type starEvent struct { 4 | Type string `json:"type"` 5 | User string `json:"user"` 6 | Item StarredItem `json:"item"` 7 | EventTimestamp JSONTimeString `json:"event_ts"` 8 | } 9 | 10 | // StarAddedEvent represents the Star added event 11 | type StarAddedEvent starEvent 12 | 13 | // StarRemovedEvent represents the Star removed event 14 | type StarRemovedEvent starEvent 15 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl 17 | -------------------------------------------------------------------------------- /lib/hal/Supfile: -------------------------------------------------------------------------------- 1 | # Supfile for local "supbot" example 2 | --- 3 | 4 | env: # Environment variables for the commands 5 | NAME: example 6 | REPO: github.com/gophergala2016/supbot 7 | BRANCH: master 8 | IMAGE: supbot 9 | HOST_PORT: 8000 10 | CONTAINER_PORT: 8000 11 | 12 | networks: # Groups of hosts 13 | local: 14 | hosts: 15 | - localhost 16 | 17 | commands: # Named set of commands to be run remotely 18 | ping: 19 | desc: Print uname and current date/time. 20 | run: uname -a; date 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/Makefile: -------------------------------------------------------------------------------- 1 | BRANCH=`git rev-parse --abbrev-ref HEAD` 2 | COMMIT=`git rev-parse --short HEAD` 3 | GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" 4 | 5 | default: build 6 | 7 | race: 8 | @go test -v -race -test.run="TestSimulate_(100op|1000op)" 9 | 10 | # go get github.com/kisielk/errcheck 11 | errcheck: 12 | @errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt 13 | 14 | test: 15 | @go test -v -cover . 16 | @go test -v ./cmd/bolt 17 | 18 | .PHONY: fmt test 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/example/prefix.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | 7 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/goware/prefixer" 8 | ) 9 | 10 | func main() { 11 | // Prefixer accepts anything that implements io.Reader interface 12 | prefixReader := prefixer.New(os.Stdin, "> ") 13 | 14 | // Read all prefixed lines from STDIN into a buffer 15 | buffer, _ := ioutil.ReadAll(prefixReader) 16 | 17 | // Write buffer to STDOUT 18 | os.Stdout.Write(buffer) 19 | } 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-64 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | // These constants are declared here, rather than importing 8 | // them from the syscall package as some syscall packages, even 9 | // on linux, for example gccgo, do not declare them. 10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 12 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.5.3 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y ca-certificates git bzr mercurial make 5 | 6 | RUN mkdir -p /src/supbot 7 | RUN git clone https://github.com/gophergala2016/supbot.git /src/supbot 8 | RUN cd /src/supbot && go get -d -v ./... && make build 9 | RUN cp /src/supbot/bin/supbot /bin/supbot 10 | 11 | RUN go get -u github.com/pressly/sup/cmd/sup 12 | RUN go build -o /bin/sup github.com/pressly/sup/cmd/sup 13 | 14 | VOLUME /root/.ssh 15 | 16 | RUN mkdir -p /var/supbot 17 | WORKDIR /var/supbot 18 | 19 | ENTRYPOINT ["/bin/supbot"] 20 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/example/example.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "io/ioutil" 5 | "log" 6 | "net/http" 7 | ) 8 | 9 | func main() { 10 | config, err := ioutil.ReadFile("/etc/example.cfg") 11 | if err != nil { 12 | log.Fatal(err) 13 | } 14 | 15 | // Define handler that returns "Hello $ENV" 16 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 17 | w.Write([]byte("Hello ")) 18 | w.Write(config) 19 | }) 20 | 21 | err = http.ListenAndServe(":8000", nil) 22 | if err != nil { 23 | log.Fatal(err) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_reactions.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | type reactionEvent struct { 4 | Type string `json:"type"` 5 | User string `json:"user"` 6 | Item ReactedItem `json:"item"` 7 | Reaction string `json:"reaction"` 8 | EventTimestamp JSONTimeString `json:"event_ts"` 9 | } 10 | 11 | // ReactionAddedEvent represents the Reaction added event 12 | type ReactionAddedEvent reactionEvent 13 | 14 | // ReactionRemovedEvent represents the Reaction removed event 15 | type ReactionRemovedEvent reactionEvent 16 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_pins.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | type pinEvent struct { 4 | Type string `json:"type"` 5 | User string `json:"user"` 6 | Item Item `json:"item"` 7 | Channel string `json:"channel_id"` 8 | EventTimestamp JSONTimeString `json:"event_ts"` 9 | HasPins bool `json:"has_pins,omitempty"` 10 | } 11 | 12 | // PinAddedEvent represents the Pin added event 13 | type PinAddedEvent pinEvent 14 | 15 | // PinRemovedEvent represents the Pin removed event 16 | type PinRemovedEvent pinEvent 17 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/groups/groups.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 7 | ) 8 | 9 | func main() { 10 | api := slack.New("YOUR_TOKEN_HERE") 11 | // If you set debugging, it will log all requests to the console 12 | // Useful when encountering issues 13 | // api.SetDebug(true) 14 | groups, err := api.GetGroups(false) 15 | if err != nil { 16 | fmt.Printf("%s\n", err) 17 | return 18 | } 19 | for _, group := range groups { 20 | fmt.Printf("ID: %s, Name: %s\n", group.ID, group.Name) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/pagination.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // Paging contains paging information 4 | type Paging struct { 5 | Count int `json:"count"` 6 | Total int `json:"total"` 7 | Page int `json:"page"` 8 | Pages int `json:"pages"` 9 | } 10 | 11 | // Pagination contains pagination information 12 | // This is different from Paging in that it contains additional details 13 | type Pagination struct { 14 | TotalCount int `json:"total_count"` 15 | Page int `json:"page"` 16 | PerPage int `json:"per_page"` 17 | PageCount int `json:"page_count"` 18 | First int `json:"first"` 19 | Last int `json:"last"` 20 | } 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/emoji.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import ( 4 | "errors" 5 | "net/url" 6 | ) 7 | 8 | type emojiResponseFull struct { 9 | Emoji map[string]string `json:"emoji"` 10 | SlackResponse 11 | } 12 | 13 | // GetEmoji retrieves all the emojis 14 | func (api *Client) GetEmoji() (map[string]string, error) { 15 | values := url.Values{ 16 | "token": {api.config.token}, 17 | } 18 | response := &emojiResponseFull{} 19 | err := post("emoji.list", values, response, api.debug) 20 | if err != nil { 21 | return nil, err 22 | } 23 | if !response.Ok { 24 | return nil, errors.New(response.Error) 25 | } 26 | return response.Emoji, nil 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_openbsd.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | msAsync = 1 << iota // perform asynchronous writes 10 | msSync // perform synchronous writes 11 | msInvalidate // invalidate cached data 12 | ) 13 | 14 | func msync(db *DB) error { 15 | _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate) 16 | if errno != 0 { 17 | return errno 18 | } 19 | return nil 20 | } 21 | 22 | func fdatasync(db *DB) error { 23 | if db.data != nil { 24 | return msync(db) 25 | } 26 | return db.file.Sync() 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/messageID.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import "sync" 4 | 5 | // IDGenerator provides an interface for generating integer ID values. 6 | type IDGenerator interface { 7 | Next() int 8 | } 9 | 10 | // NewSafeID returns a new instance of an IDGenerator which is safe for 11 | // concurrent use by multiple goroutines. 12 | func NewSafeID(startID int) IDGenerator { 13 | return &safeID{ 14 | nextID: startID, 15 | mutex: &sync.Mutex{}, 16 | } 17 | } 18 | 19 | type safeID struct { 20 | nextID int 21 | mutex *sync.Mutex 22 | } 23 | 24 | func (s *safeID) Next() int { 25 | s.mutex.Lock() 26 | defer s.mutex.Unlock() 27 | id := s.nextID 28 | s.nextID++ 29 | return id 30 | } 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/curve25519/const_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF 11 | GLOBL ·REDMASK51(SB), 8, $8 12 | 13 | DATA ·_121666_213(SB)/8, $996687872 14 | GLOBL ·_121666_213(SB), 8, $8 15 | 16 | DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA 17 | GLOBL ·_2P0(SB), 8, $8 18 | 19 | DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE 20 | GLOBL ·_2P1234(SB), 8, $8 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/files/files.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 7 | ) 8 | 9 | func main() { 10 | api := slack.New("YOUR_TOKEN_HERE") 11 | params := slack.FileUploadParameters{ 12 | Title: "Batman Example", 13 | //Filetype: "txt", 14 | File: "example.txt", 15 | //Content: "Nan Nan Nan Nan Nan Nan Nan Nan Batman", 16 | } 17 | file, err := api.UploadFile(params) 18 | if err != nil { 19 | fmt.Printf("%s\n", err) 20 | return 21 | } 22 | fmt.Printf("Name: %s, URL: %s\n", file.Name, file.URL) 23 | 24 | err = api.DeleteFile(file.ID) 25 | if err != nil { 26 | fmt.Printf("%s\n", err) 27 | return 28 | } 29 | fmt.Printf("File %s deleted successfully.\n", file.Name) 30 | } 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Dave Collins 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_dragonfly_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-32 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-56 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-32 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-44 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_dm.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // IMCreatedEvent represents the IM created event 4 | type IMCreatedEvent struct { 5 | Type string `json:"type"` 6 | User string `json:"user"` 7 | Channel ChannelCreatedInfo `json:"channel"` 8 | } 9 | 10 | // IMHistoryChangedEvent represents the IM history changed event 11 | type IMHistoryChangedEvent ChannelHistoryChangedEvent 12 | 13 | // IMOpenEvent represents the IM open event 14 | type IMOpenEvent ChannelInfoEvent 15 | 16 | // IMCloseEvent represents the IM close event 17 | type IMCloseEvent ChannelInfoEvent 18 | 19 | // IMMarkedEvent represents the IM marked event 20 | type IMMarkedEvent ChannelInfoEvent 21 | 22 | // IMMarkedHistoryChanged represents the IM marked history changed event 23 | type IMMarkedHistoryChanged ChannelInfoEvent 24 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/example/README.md: -------------------------------------------------------------------------------- 1 | # Prefixer example 2 | 3 | See [prefix.go](./prefix.go). 4 | 5 | ## Build "prefix" binary 6 | 7 | ```bash 8 | $ git clone https://github.com/goware/prefixer.git 9 | $ cd prefixer/example 10 | $ go build -o prefix 11 | ``` 12 | 13 | ## Usage 14 | 15 | Create an email reply (`"> "` prefix) from any text easily: 16 | 17 | ```bash 18 | $ ./prefix 19 | Dear John, 20 | did you know that https://github.com/goware/prefixer is a golang pkg 21 | that prefixes every line with a given string and accepts any io.Reader? 22 | 23 | Cheers, 24 | - Jane 25 | ^D 26 | > Dear John, 27 | > did you know that https://github.com/goware/prefixer is a golang pkg 28 | > that prefixes every line with a given string and accepts any io.Reader? 29 | > 30 | > Cheers, 31 | > - Jane 32 | ``` 33 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package ssh implements an SSH client and server. 7 | 8 | SSH is a transport security protocol, an authentication protocol and a 9 | family of application protocols. The most typical application level 10 | protocol is a remote shell and this is specifically implemented. However, 11 | the multiplexed nature of SSH is exposed to users that wish to support 12 | others. 13 | 14 | References: 15 | [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD 16 | [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 17 | */ 18 | package ssh 19 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Dave Collins 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/messages/messages.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 7 | ) 8 | 9 | func main() { 10 | api := slack.New("YOUR_TOKEN_HERE") 11 | params := slack.PostMessageParameters{} 12 | attachment := slack.Attachment{ 13 | Pretext: "some pretext", 14 | Text: "some text", 15 | // Uncomment the following part to send a field too 16 | /* 17 | Fields: []slack.AttachmentField{ 18 | slack.AttachmentField{ 19 | Title: "a", 20 | Value: "no", 21 | }, 22 | }, 23 | */ 24 | } 25 | params.Attachments = []slack.Attachment{attachment} 26 | channelID, timestamp, err := api.PostMessage("CHANNEL_ID", "Some text", params) 27 | if err != nil { 28 | fmt.Printf("%s\n", err) 29 | return 30 | } 31 | fmt.Printf("Message successfully sent to channel %s at %s", channelID, timestamp) 32 | } 33 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print < Glockfile 38 | 39 | docker: 40 | docker build -t supbot . 41 | 42 | docker-run: 43 | (docker stop supbot &> /dev/null || exit 0) && \ 44 | (docker rm supbot &> /dev/null || exit 0) && \ 45 | docker run -i -e SLACK_TOKEN=$(SLACK_TOKEN) --name supbot -t supbot 46 | 47 | deploy: 48 | sup prod deploy 49 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_teams.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // TeamJoinEvent represents the Team join event 4 | type TeamJoinEvent struct { 5 | Type string `json:"type"` 6 | User *User `json:"user,omitempty"` 7 | } 8 | 9 | // TeamRenameEvent represents the Team rename event 10 | type TeamRenameEvent struct { 11 | Type string `json:"type"` 12 | Name string `json:"name,omitempty"` 13 | EventTimestamp *JSONTimeString `json:"event_ts,omitempty"` 14 | } 15 | 16 | // TeamPrefChangeEvent represents the Team preference change event 17 | type TeamPrefChangeEvent struct { 18 | Type string `json:"type"` 19 | Name string `json:"name,omitempty"` 20 | Value []string `json:"value,omitempty"` 21 | } 22 | 23 | // TeamDomainChangeEvent represents the Team domain change event 24 | type TeamDomainChangeEvent struct { 25 | Type string `json:"type"` 26 | URL string `json:"url"` 27 | Domain string `json:"domain"` 28 | } 29 | 30 | // TeamMigrationStartedEvent represents the Team migration started event 31 | type TeamMigrationStartedEvent struct { 32 | Type string `json:"type"` 33 | } 34 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func (iov *Iovec) SetLen(length int) { 27 | iov.Len = uint64(length) 28 | } 29 | 30 | func (cmsg *Cmsghdr) SetLen(length int) { 31 | cmsg.Len = uint32(length) 32 | } 33 | 34 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 35 | // TODO(aram): implement this, see issue 5847. 36 | panic("unimplemented") 37 | } 38 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build dist test install clean tools deps update-deps 2 | 3 | all: 4 | @echo "build: Build code." 5 | @echo "test: Run tests." 6 | @echo "install: Install binary." 7 | @echo "" 8 | @echo "tools Install tools." 9 | @echo "deps Install dependencies." 10 | @echo "update-deps Update dependencies." 11 | @echo "clean: Clean up." 12 | 13 | build: 14 | @mkdir -p ./bin 15 | @rm -f ./bin/* 16 | go build -o ./bin/sup ./cmd/sup 17 | 18 | dist: 19 | @mkdir -p ./bin 20 | @rm -f ./bin/* 21 | GOOS=darwin GOARCH=amd64 go build -o ./bin/sup-darwin64 ./cmd/sup 22 | GOOS=linux GOARCH=amd64 go build -o ./bin/sup-linux64 ./cmd/sup 23 | tar -czf ./bin/sup-linux64.tar.gz ./bin/sup-linux64 24 | tar -czf ./bin/sup-darwin64.tar.gz ./bin/sup-darwin64 25 | 26 | test: 27 | go test ./... 28 | 29 | install: 30 | go install ./cmd/sup 31 | 32 | clean: 33 | @rm -rf ./bin 34 | 35 | tools: 36 | go get -u github.com/pressly/glock 37 | 38 | deps: 39 | @glock sync -n github.com/pressly/sup < Glockfile 40 | 41 | update-deps: 42 | @glock save -n github.com/pressly/sup > Glockfile 43 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/attachments.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // AttachmentField contains information for an attachment field 4 | // An Attachment can contain multiple of these 5 | type AttachmentField struct { 6 | Title string `json:"title"` 7 | Value string `json:"value"` 8 | Short bool `json:"short"` 9 | } 10 | 11 | // Attachment contains all the information for an attachment 12 | type Attachment struct { 13 | Color string `json:"color,omitempty"` 14 | Fallback string `json:"fallback"` 15 | 16 | AuthorName string `json:"author_name,omitempty"` 17 | AuthorSubname string `json:"author_subname,omitempty"` 18 | AuthorLink string `json:"author_link,omitempty"` 19 | AuthorIcon string `json:"author_icon,omitempty"` 20 | 21 | Title string `json:"title,omitempty"` 22 | TitleLink string `json:"title_link,omitempty"` 23 | Pretext string `json:"pretext,omitempty"` 24 | Text string `json:"text"` 25 | 26 | ImageURL string `json:"image_url,omitempty"` 27 | ThumbURL string `json:"thumb_url,omitempty"` 28 | 29 | Fields []AttachmentField `json:"fields,omitempty"` 30 | MarkdownIn []string `json:"mrkdwn_in,omitempty"` 31 | } 32 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Ben Johnson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015 Pressly Inc. www.pressly.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Pressly Inc. www.pressly.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/hal/hal_test.go: -------------------------------------------------------------------------------- 1 | package hal 2 | 3 | import ( 4 | "bytes" 5 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/stretchr/testify/assert" 6 | "log" 7 | "testing" 8 | ) 9 | 10 | type testCommand struct { 11 | command string 12 | err bool 13 | } 14 | 15 | func TestSendCommand(t *testing.T) { 16 | 17 | testCommands := []testCommand{ 18 | { 19 | command: "help", 20 | err: false, 21 | }, 22 | { 23 | command: "wipe", 24 | err: false, 25 | }, 26 | { 27 | command: "prod deploy", 28 | err: true, 29 | }, 30 | { 31 | command: "local ping", 32 | err: true, 33 | }, 34 | { 35 | command: `set-repo https://github.com/gophergala2016/supbot.git`, 36 | err: false, 37 | }, 38 | { 39 | command: "local ping", 40 | err: false, 41 | }, 42 | } 43 | 44 | buf := bytes.NewBuffer(nil) 45 | 46 | hal := New(buf) 47 | 48 | for _, c := range testCommands { 49 | _, err := hal.Write([]byte(c.command)) 50 | log.Printf("command: %q", c.command) 51 | if err == nil { 52 | assert.False(t, c.err) 53 | } else { 54 | assert.True(t, c.err) 55 | } 56 | log.Printf("out: %s, %q", buf.String(), err) 57 | buf.Reset() 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/examples/stars/stars.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | 7 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 8 | ) 9 | 10 | func main() { 11 | var ( 12 | apiToken string 13 | debug bool 14 | ) 15 | 16 | flag.StringVar(&apiToken, "token", "YOUR_TOKEN_HERE", "Your Slack API Token") 17 | flag.BoolVar(&debug, "debug", false, "Show JSON output") 18 | flag.Parse() 19 | 20 | api := slack.New(apiToken) 21 | if debug { 22 | api.SetDebug(true) 23 | } 24 | 25 | // Get all stars for the usr. 26 | params := slack.NewStarsParameters() 27 | starredItems, _, err := api.GetStarred(params) 28 | if err != nil { 29 | fmt.Printf("Error getting stars: %s\n", err) 30 | return 31 | } 32 | for _, s := range starredItems { 33 | var desc string 34 | switch s.Type { 35 | case slack.TYPE_MESSAGE: 36 | desc = s.Message.Text 37 | case slack.TYPE_FILE: 38 | desc = s.File.Name 39 | case slack.TYPE_FILE_COMMENT: 40 | desc = s.File.Name + " - " + s.Comment.Comment 41 | case slack.TYPE_CHANNEL, slack.TYPE_IM, slack.TYPE_GROUP: 42 | desc = s.Channel 43 | } 44 | fmt.Printf("Starred %s: %s\n", s.Type, desc) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = nsec % 1e9 / 1e3 24 | tv.Sec = nsec / 1e9 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/LICENSE.md: -------------------------------------------------------------------------------- 1 | objx - by Mat Ryer and Tyler Bunnell 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) 2014 Stretchr, Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint32(fd) 30 | k.Filter = int16(mode) 31 | k.Flags = uint16(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint32(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 20 | 21 | func NsecToTimeval(nsec int64) (tv Timeval) { 22 | nsec += 999 // round up to microsecond 23 | tv.Usec = int32(nsec % 1e9 / 1e3) 24 | tv.Sec = int64(nsec / 1e9) 25 | return 26 | } 27 | 28 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 29 | k.Ident = uint64(fd) 30 | k.Filter = uint32(mode) 31 | k.Flags = uint32(flags) 32 | } 33 | 34 | func (iov *Iovec) SetLen(length int) { 35 | iov.Len = uint64(length) 36 | } 37 | 38 | func (msghdr *Msghdr) SetControllen(length int) { 39 | msghdr.Controllen = uint32(length) 40 | } 41 | 42 | func (cmsg *Cmsghdr) SetLen(length int) { 43 | cmsg.Len = uint32(length) 44 | } 45 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_dragonfly.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for DragonFly from master list 7 | # (for example, /usr/src/sys/kern/syscalls.master). 8 | 9 | use strict; 10 | 11 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 12 | print STDERR "GOARCH or GOOS not defined in environment\n"; 13 | exit 1; 14 | } 15 | 16 | my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV); 17 | 18 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print < | ssh "tar -C -xvzf -" 13 | 14 | // RemoteTarCommand returns command to be run on remote SSH host 15 | // to properly receive the created TAR stream. 16 | // TODO: Check for relative directory. 17 | func RemoteTarCommand(dir string) string { 18 | return fmt.Sprintf("tar -C \"%s\" -xzf -", dir) 19 | } 20 | 21 | func LocalTarCommand(path, exclude string) string { 22 | 23 | // Added pattens to exclude from tar compress 24 | excludes := "" 25 | 26 | result := strings.Split(exclude, ",") 27 | 28 | for _, exclude := range result { 29 | excludes += `--exclude=` + strings.TrimSpace(exclude) + ` ` 30 | } 31 | 32 | return fmt.Sprintf("tar %s -C '.' -czf - %s", excludes, path) 33 | } 34 | 35 | // NewTarStreamReader creates a tar stream reader from a local path. 36 | // TODO: Refactor. Use "archive/tar" instead. 37 | func NewTarStreamReader(path, exclude, env string) io.Reader { 38 | cmd := exec.Command("bash", "-c", env+LocalTarCommand(path, exclude)) 39 | 40 | stdout, err := cmd.StdoutPipe() 41 | if err != nil { 42 | return nil 43 | } 44 | 45 | stderr, err := cmd.StderrPipe() 46 | if err != nil { 47 | return nil 48 | } 49 | 50 | output := io.MultiReader(stdout, stderr) 51 | 52 | if err := cmd.Start(); err != nil { 53 | return nil 54 | } 55 | 56 | return output 57 | } 58 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_linux.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | 6 | use strict; 7 | 8 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 9 | print STDERR "GOARCH or GOOS not defined in environment\n"; 10 | exit 1; 11 | } 12 | 13 | my $command = "mksysnum_linux.pl ". join(' ', @ARGV); 14 | 15 | print < 999){ 29 | # ignore deprecated syscalls that are no longer implemented 30 | # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 31 | return; 32 | } 33 | $name =~ y/a-z/A-Z/; 34 | print " SYS_$name = $num;\n"; 35 | } 36 | 37 | my $prev; 38 | open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; 39 | while(){ 40 | if(/^#define __NR_syscalls\s+/) { 41 | # ignore redefinitions of __NR_syscalls 42 | } 43 | elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ 44 | $prev = $2; 45 | fmt($1, $2); 46 | } 47 | elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ 48 | $prev = $2; 49 | fmt($1, $2); 50 | } 51 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){ 52 | fmt($1, $prev+$2) 53 | } 54 | } 55 | 56 | print < float64(b.Max) { 46 | return b.Max 47 | } 48 | //bump attempts count 49 | b.attempts++ 50 | //return as a time.Duration 51 | return time.Duration(dur) 52 | } 53 | 54 | //Resets the current value of the counter back to Min 55 | func (b *backoff) Reset() { 56 | b.attempts = 0 57 | } 58 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_groups.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // GroupCreatedEvent represents the Group created event 4 | type GroupCreatedEvent struct { 5 | Type string `json:"type"` 6 | User string `json:"user"` 7 | Channel ChannelCreatedInfo `json:"channel"` 8 | } 9 | 10 | // XXX: Should we really do this? event.Group is probably nicer than event.Channel 11 | // even though the api returns "channel" 12 | 13 | // GroupMarkedEvent represents the Group marked event 14 | type GroupMarkedEvent ChannelInfoEvent 15 | 16 | // GroupOpenEvent represents the Group open event 17 | type GroupOpenEvent ChannelInfoEvent 18 | 19 | // GroupCloseEvent represents the Group close event 20 | type GroupCloseEvent ChannelInfoEvent 21 | 22 | // GroupArchiveEvent represents the Group archive event 23 | type GroupArchiveEvent ChannelInfoEvent 24 | 25 | // GroupUnarchiveEvent represents the Group unarchive event 26 | type GroupUnarchiveEvent ChannelInfoEvent 27 | 28 | // GroupLeftEvent represents the Group left event 29 | type GroupLeftEvent ChannelInfoEvent 30 | 31 | // GroupJoinedEvent represents the Group joined event 32 | type GroupJoinedEvent ChannelJoinedEvent 33 | 34 | // GroupRenameEvent represents the Group rename event 35 | type GroupRenameEvent struct { 36 | Type string `json:"type"` 37 | Group GroupRenameInfo `json:"channel"` 38 | Timestamp string `json:"ts"` 39 | } 40 | 41 | // GroupRenameInfo represents the group info related to the renamed group 42 | type GroupRenameInfo struct { 43 | ID string `json:"id"` 44 | Name string `json:"name"` 45 | Created string `json:"created"` 46 | } 47 | 48 | // GroupHistoryChangedEvent represents the Group history changed event 49 | type GroupHistoryChangedEvent ChannelHistoryChangedEvent 50 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = nsec % 1e9 / 1e3 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = nsec % 1e9 / 1e3 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "github.com/gophergala2016/supbot", 3 | "GoVersion": "go1.5", 4 | "Packages": [ 5 | "./..." 6 | ], 7 | "Deps": [ 8 | { 9 | "ImportPath": "github.com/boltdb/bolt", 10 | "Comment": "v1.1.0-65-gee4a088", 11 | "Rev": "ee4a0888a9abe7eefe5a0992ca4cb06864839873" 12 | }, 13 | { 14 | "ImportPath": "github.com/davecgh/go-spew/spew", 15 | "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" 16 | }, 17 | { 18 | "ImportPath": "github.com/goware/prefixer", 19 | "Rev": "395022866408d928fc2439f7eac73dd8d370ec1d" 20 | }, 21 | { 22 | "ImportPath": "github.com/nlopes/slack", 23 | "Comment": "v0.0.1-74-gfecd1dd", 24 | "Rev": "fecd1dd0008dcb1a01e18b900b1abd4fd4e79177" 25 | }, 26 | { 27 | "ImportPath": "github.com/pmezard/go-difflib/difflib", 28 | "Rev": "792786c7400a136282c1664665ae0a8db921c6c2" 29 | }, 30 | { 31 | "ImportPath": "github.com/pressly/sup", 32 | "Comment": "v0.3-27-g4ee5083", 33 | "Rev": "4ee5083c8321340bc2a6410f24d8a760f7ad3847" 34 | }, 35 | { 36 | "ImportPath": "github.com/stretchr/testify/assert", 37 | "Comment": "v1.1.3", 38 | "Rev": "f390dcf405f7b83c997eac1b06768bb9f44dec18" 39 | }, 40 | { 41 | "ImportPath": "golang.org/x/crypto/curve25519", 42 | "Rev": "3760e016850398b85094c4c99e955b8c3dea5711" 43 | }, 44 | { 45 | "ImportPath": "golang.org/x/crypto/ssh", 46 | "Rev": "3760e016850398b85094c4c99e955b8c3dea5711" 47 | }, 48 | { 49 | "ImportPath": "golang.org/x/net/websocket", 50 | "Rev": "2e9cee70ee697e0a2ef894b560dda50dec7dff58" 51 | }, 52 | { 53 | "ImportPath": "golang.org/x/sys/unix", 54 | "Rev": "20457ee8ea8546920d3f4e19e405da45250dc5a5" 55 | }, 56 | { 57 | "ImportPath": "gopkg.in/yaml.v2", 58 | "Rev": "f7716cbe52baa25d2e9b0d0da546fcf909fc16b4" 59 | } 60 | ] 61 | } 62 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return tv.Sec*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = nsec / 1e9 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when either the code is running on Google App Engine or "-tags disableunsafe" 17 | // is added to the go build command line. 18 | // +build appengine disableunsafe 19 | 20 | package spew 21 | 22 | import "reflect" 23 | 24 | const ( 25 | // UnsafeDisabled is a build-time constant which specifies whether or 26 | // not access to the unsafe package is available. 27 | UnsafeDisabled = true 28 | ) 29 | 30 | // unsafeReflectValue typically converts the passed reflect.Value into a one 31 | // that bypasses the typical safety restrictions preventing access to 32 | // unaddressable and unexported data. However, doing this relies on access to 33 | // the unsafe package. This is a stub version which simply returns the passed 34 | // reflect.Value when the unsafe package is not available. 35 | func unsafeReflectValue(v reflect.Value) reflect.Value { 36 | return v 37 | } 38 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int32(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int32(nsec / 1e9) 30 | return 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var writtenOut uint64 = 0 53 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 54 | 55 | written = int(writtenOut) 56 | 57 | if e1 != 0 { 58 | err = e1 59 | } 60 | return 61 | } 62 | 63 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 64 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/mksysnum_freebsd.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for FreeBSD from master list 7 | # (for example, /usr/src/sys/kern/syscalls.master). 8 | 9 | use strict; 10 | 11 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 12 | print STDERR "GOARCH or GOOS not defined in environment\n"; 13 | exit 1; 14 | } 15 | 16 | my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV); 17 | 18 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){ 44 | next 45 | } 46 | 47 | print " $name = $num; // $proto\n"; 48 | 49 | # We keep Capsicum syscall numbers for FreeBSD 50 | # 9-STABLE here because we are not sure whether they 51 | # are mature and stable. 52 | if($num == 513){ 53 | print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n"; 54 | print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n"; 55 | print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n"; 56 | print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n"; 57 | } 58 | } 59 | } 60 | 61 | print <>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/pins.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import ( 4 | "errors" 5 | "net/url" 6 | ) 7 | 8 | type listPinsResponseFull struct { 9 | Items []Item 10 | Paging `json:"paging"` 11 | SlackResponse 12 | } 13 | 14 | // AddPin pins an item in a channel 15 | func (api *Client) AddPin(channel string, item ItemRef) error { 16 | values := url.Values{ 17 | "channel": {channel}, 18 | "token": {api.config.token}, 19 | } 20 | if item.Timestamp != "" { 21 | values.Set("timestamp", string(item.Timestamp)) 22 | } 23 | if item.File != "" { 24 | values.Set("file", string(item.File)) 25 | } 26 | if item.Comment != "" { 27 | values.Set("file_comment", string(item.Comment)) 28 | } 29 | response := &SlackResponse{} 30 | if err := post("pins.add", values, response, api.debug); err != nil { 31 | return err 32 | } 33 | if !response.Ok { 34 | return errors.New(response.Error) 35 | } 36 | return nil 37 | } 38 | 39 | // RemovePin un-pins an item from a channel 40 | func (api *Client) RemovePin(channel string, item ItemRef) error { 41 | values := url.Values{ 42 | "channel": {channel}, 43 | "token": {api.config.token}, 44 | } 45 | if item.Timestamp != "" { 46 | values.Set("timestamp", string(item.Timestamp)) 47 | } 48 | if item.File != "" { 49 | values.Set("file", string(item.File)) 50 | } 51 | if item.Comment != "" { 52 | values.Set("file_comment", string(item.Comment)) 53 | } 54 | response := &SlackResponse{} 55 | if err := post("pins.remove", values, response, api.debug); err != nil { 56 | return err 57 | } 58 | if !response.Ok { 59 | return errors.New(response.Error) 60 | } 61 | return nil 62 | } 63 | 64 | // ListPins returns information about the items a user reacted to. 65 | func (api *Client) ListPins(channel string) ([]Item, *Paging, error) { 66 | values := url.Values{ 67 | "channel": {channel}, 68 | "token": {api.config.token}, 69 | } 70 | response := &listPinsResponseFull{} 71 | err := post("pins.list", values, response, api.debug) 72 | if err != nil { 73 | return nil, nil, err 74 | } 75 | if !response.Ok { 76 | return nil, nil, errors.New(response.Error) 77 | } 78 | return response.Items, &response.Paging, nil 79 | } 80 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/pressly/sup/localhost.go: -------------------------------------------------------------------------------- 1 | package sup 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os/exec" 7 | "os/user" 8 | ) 9 | 10 | // Client is a wrapper over the SSH connection/sessions. 11 | type LocalhostClient struct { 12 | cmd *exec.Cmd 13 | user string 14 | stdin io.WriteCloser 15 | stdout io.Reader 16 | stderr io.Reader 17 | running bool 18 | env string //export FOO="bar"; export BAR="baz"; 19 | } 20 | 21 | func (c *LocalhostClient) Connect(_ string) error { 22 | u, err := user.Current() 23 | if err != nil { 24 | return err 25 | } 26 | 27 | c.user = u.Username 28 | return nil 29 | } 30 | 31 | func (c *LocalhostClient) Run(task *Task) error { 32 | var err error 33 | 34 | if c.running { 35 | return fmt.Errorf("Command already running") 36 | } 37 | 38 | cmd := exec.Command("bash", "-c", c.env+"set -x;"+task.Run) 39 | c.cmd = cmd 40 | 41 | c.stdout, err = cmd.StdoutPipe() 42 | if err != nil { 43 | return err 44 | } 45 | 46 | c.stderr, err = cmd.StderrPipe() 47 | if err != nil { 48 | return err 49 | } 50 | 51 | c.stdin, err = cmd.StdinPipe() 52 | if err != nil { 53 | return err 54 | } 55 | 56 | if err := c.cmd.Start(); err != nil { 57 | return ErrTask{task, err.Error()} 58 | } 59 | 60 | c.running = true 61 | return nil 62 | } 63 | 64 | func (c *LocalhostClient) Wait() error { 65 | if !c.running { 66 | return fmt.Errorf("Trying to wait on stopped command") 67 | } 68 | err := c.cmd.Wait() 69 | c.running = false 70 | return err 71 | } 72 | 73 | func (c *LocalhostClient) Close() error { 74 | return nil 75 | } 76 | 77 | func (c *LocalhostClient) Stdin() io.WriteCloser { 78 | return c.stdin 79 | } 80 | 81 | func (c *LocalhostClient) Stderr() io.Reader { 82 | return c.stderr 83 | } 84 | 85 | func (c *LocalhostClient) Stdout() io.Reader { 86 | return c.stdout 87 | } 88 | 89 | func (c *LocalhostClient) Prefix() (string, int) { 90 | host := c.user + "@localhost" + " | " 91 | return ResetColor + host, len(host) 92 | } 93 | 94 | func (c *LocalhostClient) Write(p []byte) (n int, err error) { 95 | return c.stdin.Write(p) 96 | } 97 | 98 | func (c *LocalhostClient) WriteClose() error { 99 | return c.stdin.Close() 100 | } 101 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/goware/prefixer/README.md: -------------------------------------------------------------------------------- 1 | # Prefixer 2 | [Golang](http://golang.org/)'s [io.Reader](http://golang.org/pkg/io/#Reader) wrapper prepending every line with a given string. 3 | 4 | [![GoDoc](https://godoc.org/github.com/goware/prefixer?status.png)](https://godoc.org/github.com/goware/prefixer) 5 | [![Travis](https://travis-ci.org/goware/prefixer.svg?branch=master)](https://travis-ci.org/goware/prefixer) 6 | 7 | 8 | ## Use cases 9 | 1. Logger that prefixes every line with a timestamp etc. 10 | ```bash 11 | 16:54:49 My awesome server | Creating etcd client pointing to http://localhost:4001 12 | 16:54:49 My awesome server | Listening on http://localhost:8080 13 | 16:54:49 My awesome server | [restful/swagger] listing is available at 127.0.0.1:8080/swaggerapi 14 | ``` 15 | 16 | 2. SSH multiplexer prepending output from multiple servers with a hostname 17 | ```bash 18 | host1.example.com | SUCCESS 19 | host2.example.com | SUCCESS 20 | host3.example.com | -bash: cd: workdir: No such file or directory 21 | host4.example.com | SUCCESS 22 | ``` 23 | 24 | 3. Create an email reply (`"> "` prefix) from any text easily. 25 | ```bash 26 | $ ./prefix 27 | Dear John, 28 | did you know that https://github.com/goware/prefixer is a golang pkg 29 | that prefixes every line with a given string and accepts any io.Reader? 30 | 31 | Cheers, 32 | - Jane 33 | ^D 34 | > Dear John, 35 | > did you know that https://github.com/goware/prefixer is a golang pkg 36 | > that prefixes every line with a given string and accepts any io.Reader? 37 | > 38 | > Cheers, 39 | > - Jane 40 | ``` 41 | 42 | ## Example 43 | 44 | See the ["Prefix Line Reader" example](./example). 45 | 46 | ```go 47 | package main 48 | 49 | import ( 50 | "io/ioutil" 51 | "os" 52 | 53 | "github.com/goware/prefixer" 54 | ) 55 | 56 | func main() { 57 | // Prefixer accepts anything that implements io.Reader interface 58 | prefixReader := prefixer.New(os.Stdin, "> ") 59 | 60 | // Read all prefixed lines from STDIN into a buffer 61 | buffer, _ := ioutil.ReadAll(prefixReader) 62 | 63 | // Write buffer to STDOUT 64 | os.Stdout.Write(buffer) 65 | } 66 | ``` 67 | 68 | ## License 69 | Prefixer is licensed under the [MIT License](./LICENSE). 70 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = sec 40 | tv.Usec = usec 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint64(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint64(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int32(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = int32(sec) 40 | tv.Usec = int32(usec) 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint32(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint32(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 15 | 16 | func Getpagesize() int { return 4096 } 17 | 18 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 19 | 20 | func NsecToTimespec(nsec int64) (ts Timespec) { 21 | ts.Sec = nsec / 1e9 22 | ts.Nsec = nsec % 1e9 23 | return 24 | } 25 | 26 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 27 | 28 | func NsecToTimeval(nsec int64) (tv Timeval) { 29 | nsec += 999 // round up to microsecond 30 | tv.Usec = int32(nsec % 1e9 / 1e3) 31 | tv.Sec = int64(nsec / 1e9) 32 | return 33 | } 34 | 35 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 36 | func Gettimeofday(tv *Timeval) (err error) { 37 | // The tv passed to gettimeofday must be non-nil 38 | // but is otherwise unused. The answers come back 39 | // in the two registers. 40 | sec, usec, err := gettimeofday(tv) 41 | tv.Sec = sec 42 | tv.Usec = usec 43 | return err 44 | } 45 | 46 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 47 | k.Ident = uint64(fd) 48 | k.Filter = int16(mode) 49 | k.Flags = uint16(flags) 50 | } 51 | 52 | func (iov *Iovec) SetLen(length int) { 53 | iov.Len = uint64(length) 54 | } 55 | 56 | func (msghdr *Msghdr) SetControllen(length int) { 57 | msghdr.Controllen = uint32(length) 58 | } 59 | 60 | func (cmsg *Cmsghdr) SetLen(length int) { 61 | cmsg.Len = uint32(length) 62 | } 63 | 64 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 65 | var length = uint64(count) 66 | 67 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 68 | 69 | written = int(length) 70 | 71 | if e1 != 0 { 72 | err = e1 73 | } 74 | return 75 | } 76 | 77 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 78 | 79 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 80 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 81 | const SYS___SYSCTL = SYS_SYSCTL 82 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_unix_solaris.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "syscall" 7 | "time" 8 | "unsafe" 9 | 10 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/golang.org/x/sys/unix" 11 | ) 12 | 13 | // flock acquires an advisory lock on a file descriptor. 14 | func flock(f *os.File, exclusive bool, timeout time.Duration) error { 15 | var t time.Time 16 | for { 17 | // If we're beyond our timeout then return an error. 18 | // This can only occur after we've attempted a flock once. 19 | if t.IsZero() { 20 | t = time.Now() 21 | } else if timeout > 0 && time.Since(t) > timeout { 22 | return ErrTimeout 23 | } 24 | var lock syscall.Flock_t 25 | lock.Start = 0 26 | lock.Len = 0 27 | lock.Pid = 0 28 | lock.Whence = 0 29 | lock.Pid = 0 30 | if exclusive { 31 | lock.Type = syscall.F_WRLCK 32 | } else { 33 | lock.Type = syscall.F_RDLCK 34 | } 35 | err := syscall.FcntlFlock(f.Fd(), syscall.F_SETLK, &lock) 36 | if err == nil { 37 | return nil 38 | } else if err != syscall.EAGAIN { 39 | return err 40 | } 41 | 42 | // Wait for a bit and try again. 43 | time.Sleep(50 * time.Millisecond) 44 | } 45 | } 46 | 47 | // funlock releases an advisory lock on a file descriptor. 48 | func funlock(f *os.File) error { 49 | var lock syscall.Flock_t 50 | lock.Start = 0 51 | lock.Len = 0 52 | lock.Type = syscall.F_UNLCK 53 | lock.Whence = 0 54 | return syscall.FcntlFlock(uintptr(f.Fd()), syscall.F_SETLK, &lock) 55 | } 56 | 57 | // mmap memory maps a DB's data file. 58 | func mmap(db *DB, sz int) error { 59 | // Map the data file to memory. 60 | b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) 61 | if err != nil { 62 | return err 63 | } 64 | 65 | // Advise the kernel that the mmap is accessed randomly. 66 | if err := unix.Madvise(b, syscall.MADV_RANDOM); err != nil { 67 | return fmt.Errorf("madvise: %s", err) 68 | } 69 | 70 | // Save the original byte slice and convert to a byte array pointer. 71 | db.dataref = b 72 | db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0])) 73 | db.datasz = sz 74 | return nil 75 | } 76 | 77 | // munmap unmaps a DB's data file from memory. 78 | func munmap(db *DB) error { 79 | // Ignore the unmap if we have no mapped data. 80 | if db.dataref == nil { 81 | return nil 82 | } 83 | 84 | // Unmap using the original byte slice. 85 | err := unix.Munmap(db.dataref) 86 | db.dataref = nil 87 | db.data = nil 88 | db.datasz = 0 89 | return err 90 | } 91 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/bolt_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!solaris 2 | 3 | package bolt 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | "time" 10 | "unsafe" 11 | ) 12 | 13 | // flock acquires an advisory lock on a file descriptor. 14 | func flock(f *os.File, exclusive bool, timeout time.Duration) error { 15 | var t time.Time 16 | for { 17 | // If we're beyond our timeout then return an error. 18 | // This can only occur after we've attempted a flock once. 19 | if t.IsZero() { 20 | t = time.Now() 21 | } else if timeout > 0 && time.Since(t) > timeout { 22 | return ErrTimeout 23 | } 24 | flag := syscall.LOCK_SH 25 | if exclusive { 26 | flag = syscall.LOCK_EX 27 | } 28 | 29 | // Otherwise attempt to obtain an exclusive lock. 30 | err := syscall.Flock(int(f.Fd()), flag|syscall.LOCK_NB) 31 | if err == nil { 32 | return nil 33 | } else if err != syscall.EWOULDBLOCK { 34 | return err 35 | } 36 | 37 | // Wait for a bit and try again. 38 | time.Sleep(50 * time.Millisecond) 39 | } 40 | } 41 | 42 | // funlock releases an advisory lock on a file descriptor. 43 | func funlock(f *os.File) error { 44 | return syscall.Flock(int(f.Fd()), syscall.LOCK_UN) 45 | } 46 | 47 | // mmap memory maps a DB's data file. 48 | func mmap(db *DB, sz int) error { 49 | // Map the data file to memory. 50 | b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) 51 | if err != nil { 52 | return err 53 | } 54 | 55 | // Advise the kernel that the mmap is accessed randomly. 56 | if err := madvise(b, syscall.MADV_RANDOM); err != nil { 57 | return fmt.Errorf("madvise: %s", err) 58 | } 59 | 60 | // Save the original byte slice and convert to a byte array pointer. 61 | db.dataref = b 62 | db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0])) 63 | db.datasz = sz 64 | return nil 65 | } 66 | 67 | // munmap unmaps a DB's data file from memory. 68 | func munmap(db *DB) error { 69 | // Ignore the unmap if we have no mapped data. 70 | if db.dataref == nil { 71 | return nil 72 | } 73 | 74 | // Unmap using the original byte slice. 75 | err := syscall.Munmap(db.dataref) 76 | db.dataref = nil 77 | db.data = nil 78 | db.datasz = 0 79 | return err 80 | } 81 | 82 | // NOTE: This function is copied from stdlib because it is not available on darwin. 83 | func madvise(b []byte, advice int) (err error) { 84 | _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice)) 85 | if e1 != 0 { 86 | err = e1 87 | } 88 | return 89 | } 90 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_internals.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | /** 9 | * Internal events, created by this lib and not mapped to Slack APIs. 10 | */ 11 | 12 | // ConnectedEvent is used for when we connect to Slack 13 | type ConnectedEvent struct { 14 | ConnectionCount int // 1 = first time, 2 = second time 15 | Info *Info 16 | } 17 | 18 | // ConnectionErrorEvent contains information about a connection error 19 | type ConnectionErrorEvent struct { 20 | Attempt int 21 | ErrorObj error 22 | } 23 | 24 | func (c *ConnectionErrorEvent) Error() string { 25 | return c.ErrorObj.Error() 26 | } 27 | 28 | // ConnectingEvent contains information about our connection attempt 29 | type ConnectingEvent struct { 30 | Attempt int // 1 = first attempt, 2 = second attempt 31 | ConnectionCount int 32 | } 33 | 34 | // DisconnectedEvent contains information about how we disconnected 35 | type DisconnectedEvent struct { 36 | Intentional bool 37 | } 38 | 39 | // LatencyReport contains information about connection latency 40 | type LatencyReport struct { 41 | Value time.Duration 42 | } 43 | 44 | // InvalidAuthEvent is used in case we can't even authenticate with the API 45 | type InvalidAuthEvent struct{} 46 | 47 | // UnmarshallingErrorEvent is used when there are issues deconstructing a response 48 | type UnmarshallingErrorEvent struct { 49 | ErrorObj error 50 | } 51 | 52 | func (u UnmarshallingErrorEvent) Error() string { 53 | return u.ErrorObj.Error() 54 | } 55 | 56 | // MessageTooLongEvent is used when sending a message that is too long 57 | type MessageTooLongEvent struct { 58 | Message OutgoingMessage 59 | MaxLength int 60 | } 61 | 62 | func (m *MessageTooLongEvent) Error() string { 63 | return fmt.Sprintf("Message too long (max %d characters)", m.MaxLength) 64 | } 65 | 66 | // OutgoingErrorEvent contains information in case there were errors sending messages 67 | type OutgoingErrorEvent struct { 68 | Message OutgoingMessage 69 | ErrorObj error 70 | } 71 | 72 | func (o OutgoingErrorEvent) Error() string { 73 | return o.ErrorObj.Error() 74 | } 75 | 76 | // IncomingEventError contains information about an unexpected error receiving a websocket event 77 | type IncomingEventError struct { 78 | ErrorObj error 79 | } 80 | 81 | func (i *IncomingEventError) Error() string { 82 | return i.ErrorObj.Error() 83 | } 84 | 85 | // AckErrorEvent i 86 | type AckErrorEvent struct { 87 | ErrorObj error 88 | } 89 | 90 | func (a *AckErrorEvent) Error() string { 91 | return a.ErrorObj.Error() 92 | } 93 | -------------------------------------------------------------------------------- /cmd/supbot/Supfile: -------------------------------------------------------------------------------- 1 | # Supfile for local "supbot" example 2 | --- 3 | 4 | env: # Environment variables for the commands 5 | NAME: supbot 6 | REPO: github.com/gophergala2016/supbot 7 | BRANCH: master 8 | IMAGE: supbot 9 | WORKDIR: /home/deploy/workdir 10 | SLACK_TOKEN: xoxb-19232920311-vb7KYcw8EpdfcN9Qz3v7cWpl 11 | 12 | networks: # Groups of hosts 13 | local: 14 | hosts: 15 | - localhost 16 | prod: 17 | hosts: 18 | - deploy@162.243.9.244 19 | 20 | commands: # Named set of commands to be run remotely 21 | ping: 22 | desc: Print uname and current date/time. 23 | run: uname -a; date 24 | check: 25 | run: rm -rf $WORKDIR/$NAME && mkdir -p $WORKDIR/$NAME 26 | upload: 27 | upload: 28 | - src: ./ 29 | dst: $WORKDIR/$NAME 30 | pull: 31 | run: git clone https://github.com/gophergala2016/supbot.git $WORKDIR/$NAME 32 | build: 33 | run: cd $WORKDIR/$NAME && docker build -t $NAME . 34 | image: 35 | run: docker images | grep $NAME 36 | stop: 37 | run: docker stop $NAME || exit 0 38 | rm: 39 | run: docker rm $NAME || exit 0 40 | start: 41 | run: docker start $NAME || exit 0 42 | run: 43 | run: > 44 | mkdir -p /home/deploy/data && cd $WORKDIR/$NAME && docker run \ 45 | -d \ 46 | -e SLACK_TOKEN=$SLACK_TOKEN \ 47 | --restart=always \ 48 | -v /home/deploy/.ssh:/root/.ssh \ 49 | -v /home/deploy/data:/var/supbot \ 50 | --name $NAME \ 51 | -t $NAME 52 | restart-nohup: 53 | run: > 54 | nohup sh -c '(docker stop $NAME || exit 0) && 55 | (docker rm $NAME || exit 0) && 56 | mkdir -p /home/deploy/data && cd $WORKDIR/$NAME && docker run \ 57 | -d \ 58 | -e SLACK_TOKEN=$SLACK_TOKEN \ 59 | --restart=always \ 60 | -v /home/deploy/.ssh:/root/.ssh \ 61 | -v /home/deploy/data:/var/supbot \ 62 | --name $NAME \ 63 | -t $NAME' 64 | ps: 65 | run: docker ps | grep $NAME 66 | logs: 67 | run: docker logs $NAME 68 | install: 69 | run: sudo apt-get update && apt-get install -y git vim tmux 70 | reboot: 71 | run: sudo reboot 72 | lsroot: 73 | desc: List the root directory 74 | run: ls -al / 75 | 76 | targets: 77 | old-deploy: 78 | - ping 79 | - check 80 | # - upload 81 | - pull 82 | - build 83 | - image 84 | - stop 85 | - rm 86 | - run 87 | - ps 88 | deploy: 89 | - ping 90 | - check 91 | # - upload 92 | - pull 93 | - build 94 | - image 95 | - restart-nohup 96 | init: 97 | - ping 98 | - install 99 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/item.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | const ( 4 | TYPE_MESSAGE = "message" 5 | TYPE_FILE = "file" 6 | TYPE_FILE_COMMENT = "file_comment" 7 | TYPE_CHANNEL = "channel" 8 | TYPE_IM = "im" 9 | TYPE_GROUP = "group" 10 | ) 11 | 12 | // Item is any type of slack message - message, file, or file comment. 13 | type Item struct { 14 | Type string `json:"type"` 15 | Channel string `json:"channel,omitempty"` 16 | Message *Message `json:"message,omitempty"` 17 | File *File `json:"file,omitempty"` 18 | Comment *Comment `json:"comment,omitempty"` 19 | Timestamp string `json:"ts,omitempty"` 20 | } 21 | 22 | // NewMessageItem turns a message on a channel into a typed message struct. 23 | func NewMessageItem(ch string, m *Message) Item { 24 | return Item{Type: TYPE_MESSAGE, Channel: ch, Message: m} 25 | } 26 | 27 | // NewFileItem turns a file into a typed file struct. 28 | func NewFileItem(f *File) Item { 29 | return Item{Type: TYPE_FILE, File: f} 30 | } 31 | 32 | // NewFileCommentItem turns a file and comment into a typed file_comment struct. 33 | func NewFileCommentItem(f *File, c *Comment) Item { 34 | return Item{Type: TYPE_FILE_COMMENT, File: f, Comment: c} 35 | } 36 | 37 | // NewChannelItem turns a channel id into a typed channel struct. 38 | func NewChannelItem(ch string) Item { 39 | return Item{Type: TYPE_CHANNEL, Channel: ch} 40 | } 41 | 42 | // NewIMItem turns a channel id into a typed im struct. 43 | func NewIMItem(ch string) Item { 44 | return Item{Type: TYPE_IM, Channel: ch} 45 | } 46 | 47 | // NewGroupItem turns a channel id into a typed group struct. 48 | func NewGroupItem(ch string) Item { 49 | return Item{Type: TYPE_GROUP, Channel: ch} 50 | } 51 | 52 | // ItemRef is a reference to a message of any type. One of FileID, 53 | // CommentId, or the combination of ChannelId and Timestamp must be 54 | // specified. 55 | type ItemRef struct { 56 | Channel string `json:"channel"` 57 | Timestamp string `json:"timestamp"` 58 | File string `json:"file"` 59 | Comment string `json:"file_comment"` 60 | } 61 | 62 | // NewRefToMessage initializes a reference to to a message. 63 | func NewRefToMessage(channel, timestamp string) ItemRef { 64 | return ItemRef{Channel: channel, Timestamp: timestamp} 65 | } 66 | 67 | // NewRefToFile initializes a reference to a file. 68 | func NewRefToFile(file string) ItemRef { 69 | return ItemRef{File: file} 70 | } 71 | 72 | // NewRefToComment initializes a reference to a file comment. 73 | func NewRefToComment(comment string) ItemRef { 74 | return ItemRef{Comment: comment} 75 | } 76 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/buffer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | import ( 8 | "io" 9 | "sync" 10 | ) 11 | 12 | // buffer provides a linked list buffer for data exchange 13 | // between producer and consumer. Theoretically the buffer is 14 | // of unlimited capacity as it does no allocation of its own. 15 | type buffer struct { 16 | // protects concurrent access to head, tail and closed 17 | *sync.Cond 18 | 19 | head *element // the buffer that will be read first 20 | tail *element // the buffer that will be read last 21 | 22 | closed bool 23 | } 24 | 25 | // An element represents a single link in a linked list. 26 | type element struct { 27 | buf []byte 28 | next *element 29 | } 30 | 31 | // newBuffer returns an empty buffer that is not closed. 32 | func newBuffer() *buffer { 33 | e := new(element) 34 | b := &buffer{ 35 | Cond: newCond(), 36 | head: e, 37 | tail: e, 38 | } 39 | return b 40 | } 41 | 42 | // write makes buf available for Read to receive. 43 | // buf must not be modified after the call to write. 44 | func (b *buffer) write(buf []byte) { 45 | b.Cond.L.Lock() 46 | e := &element{buf: buf} 47 | b.tail.next = e 48 | b.tail = e 49 | b.Cond.Signal() 50 | b.Cond.L.Unlock() 51 | } 52 | 53 | // eof closes the buffer. Reads from the buffer once all 54 | // the data has been consumed will receive os.EOF. 55 | func (b *buffer) eof() error { 56 | b.Cond.L.Lock() 57 | b.closed = true 58 | b.Cond.Signal() 59 | b.Cond.L.Unlock() 60 | return nil 61 | } 62 | 63 | // Read reads data from the internal buffer in buf. Reads will block 64 | // if no data is available, or until the buffer is closed. 65 | func (b *buffer) Read(buf []byte) (n int, err error) { 66 | b.Cond.L.Lock() 67 | defer b.Cond.L.Unlock() 68 | 69 | for len(buf) > 0 { 70 | // if there is data in b.head, copy it 71 | if len(b.head.buf) > 0 { 72 | r := copy(buf, b.head.buf) 73 | buf, b.head.buf = buf[r:], b.head.buf[r:] 74 | n += r 75 | continue 76 | } 77 | // if there is a next buffer, make it the head 78 | if len(b.head.buf) == 0 && b.head != b.tail { 79 | b.head = b.head.next 80 | continue 81 | } 82 | 83 | // if at least one byte has been copied, return 84 | if n > 0 { 85 | break 86 | } 87 | 88 | // if nothing was read, and there is nothing outstanding 89 | // check to see if the buffer is closed. 90 | if b.closed { 91 | err = io.EOF 92 | break 93 | } 94 | // out of buffers, wait for producer 95 | b.Cond.Wait() 96 | } 97 | return 98 | } 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # supbot 2 | 3 | > Sup... Slack? 4 | 5 | ## What is Sup? 6 | 7 | [Sup](https://github.com/pressly/sup) let's you execute commands on remote 8 | machines based on predefined and simple rules. 9 | 10 | ## What is Supbot? 11 | 12 | Supbot is a [Slack](https://www.slack.com) bot that listens to Sup commands. 13 | 14 | You can easily monitor, deploy, bring-up, bring-down, tail logs... on any 15 | environment, across any network directly from your Slack channel. 16 | 17 | You can do anything Sup can do, directly from Slack. 18 | 19 | ![screen shot 2016-01-24 at 3 27 42 pm](https://cloud.githubusercontent.com/assets/385670/12538719/1a5c1f48-c2af-11e5-94d9-0be574897f67.png) 20 | 21 | How about using a remote network and not only the local one? Yes: 22 | 23 | ![screen shot 2016-01-24 at 4 01 04 pm](https://cloud.githubusercontent.com/assets/385670/12538901/cee918b8-c2b3-11e5-9974-b4f8a68fea46.png) 24 | 25 | ## Checking out the repo 26 | 27 | ``` 28 | cd ~/projects 29 | git checkout https://github.com/gophergala2016/supbot.git 30 | ``` 31 | 32 | ## Obtaining a Slack token 33 | 34 | Your deployment of the Slack bot will require a Slack bot token. This token will need to be set to the `SLACK_TOKEN` environment variable. 35 | 36 | To obtain this token, you will need to sign into Slack and request a custom bot integration for your team's subdomain. At the time of writing (Jan 24 2016), you can start this process at the following URL: 37 | 38 | `https://[your-team-subdomain].slack.com/apps/build/custom-integration` 39 | 40 | ## Deploying to a server 41 | 42 | You can use `sup` to deploy to a server as defined in the `Supfile`. 43 | 44 | ``` 45 | # This is a portion of the supfile 46 | networks: 47 | ... 48 | prod: 49 | hosts: 50 | - deploy@162.243.9.244 51 | ``` 52 | 53 | ``` 54 | make deploy 55 | ``` 56 | 57 | If you want to try it locally, use `make docker` to build the docker image, 58 | then use `make docker-run` to run this server locally. 59 | 60 | ``` 61 | SLACK_TOKEN=yyy make docker-run 62 | ``` 63 | 64 | ## Deploying to Heroku 65 | 66 | ```sh 67 | $ heroku create 68 | $ git push heroku master 69 | $ heroku open 70 | ``` 71 | or 72 | 73 | [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 74 | 75 | Make sure to set your `SLACK_TOKEN` env variable 76 | 77 | ```sh 78 | $ heroku config:set SLACK_TOKEN=xxx-xxyz-xxzy 79 | 80 | Setting config vars and restarting xxxx... done 81 | SLACK_TOKEN: xxx-xxyz-xxzy 82 | 83 | $ heroku config 84 | === xxxx Config Vars 85 | SLACK_TOKEN: xxx-xxyz-xxzy 86 | ``` 87 | 88 | Some pointers: 89 | 90 | - you might need to run `heroku ps:scale worker=1` to scale dyno manually 91 | 92 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket_channels.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | // ChannelCreatedEvent represents the Channel created event 4 | type ChannelCreatedEvent struct { 5 | Type string `json:"type"` 6 | Channel ChannelCreatedInfo `json:"channel"` 7 | EventTimestamp JSONTimeString `json:"event_ts"` 8 | } 9 | 10 | // ChannelCreatedInfo represents the information associated with the Channel created event 11 | type ChannelCreatedInfo struct { 12 | ID string `json:"id"` 13 | IsChannel bool `json:"is_channel"` 14 | Name string `json:"name"` 15 | Created int `json:"created"` 16 | Creator string `json:"creator"` 17 | } 18 | 19 | // ChannelJoinedEvent represents the Channel joined event 20 | type ChannelJoinedEvent struct { 21 | Type string `json:"type"` 22 | Channel Channel `json:"channel"` 23 | } 24 | 25 | // ChannelInfoEvent represents the Channel info event 26 | type ChannelInfoEvent struct { 27 | // channel_left 28 | // channel_deleted 29 | // channel_archive 30 | // channel_unarchive 31 | Type string `json:"type"` 32 | Channel string `json:"channel"` 33 | User string `json:"user,omitempty"` 34 | Timestamp *JSONTimeString `json:"ts,omitempty"` 35 | } 36 | 37 | // ChannelRenameEvent represents the Channel rename event 38 | type ChannelRenameEvent struct { 39 | Type string `json:"type"` 40 | Channel ChannelRenameInfo `json:"channel"` 41 | Timestamp string `json:"event_ts"` 42 | } 43 | 44 | // ChannelRenameInfo represents the information associated with a Channel rename event 45 | type ChannelRenameInfo struct { 46 | ID string `json:"id"` 47 | Name string `json:"name"` 48 | Created *JSONTimeString `json:"created"` 49 | } 50 | 51 | // ChannelHistoryChangedEvent represents the Channel history changed event 52 | type ChannelHistoryChangedEvent struct { 53 | Type string `json:"type"` 54 | Latest JSONTimeString `json:"latest"` 55 | Timestamp JSONTimeString `json:"ts"` 56 | EventTimestamp JSONTimeString `json:"event_ts"` 57 | } 58 | 59 | // ChannelMarkedEvent represents the Channel marked event 60 | type ChannelMarkedEvent ChannelInfoEvent 61 | 62 | // ChannelLeftEvent represents the Channel left event 63 | type ChannelLeftEvent ChannelInfoEvent 64 | 65 | // ChannelDeletedEvent represents the Channel deleted event 66 | type ChannelDeletedEvent ChannelInfoEvent 67 | 68 | // ChannelArchiveEvent represents the Channel archive event 69 | type ChannelArchiveEvent ChannelInfoEvent 70 | 71 | // ChannelUnarchiveEvent represents the Channel unarchive event 72 | type ChannelUnarchiveEvent ChannelInfoEvent 73 | -------------------------------------------------------------------------------- /lib/slack/client.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "log" 8 | "strings" 9 | 10 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/github.com/nlopes/slack" 11 | "github.com/gophergala2016/supbot/lib/hal" 12 | ) 13 | 14 | // Slack represets a Slack bot. 15 | type Slack struct { 16 | token string // slack token 17 | rtm *slack.RTM 18 | api *slack.Client 19 | botUID string 20 | 21 | // singleton channel name 22 | channel string 23 | } 24 | 25 | var ( 26 | supBot io.Writer 27 | ) 28 | 29 | // NewClient creates a new slack bot. 30 | func NewClient(token string) *Slack { 31 | if len(token) < 1 { 32 | panic("supbot: can't seem to start myself") 33 | } 34 | api := slack.New(token) 35 | 36 | s := &Slack{token: token, api: api, rtm: api.NewRTM()} 37 | go s.rtm.ManageConnection() 38 | 39 | supBot = hal.New(s) 40 | return s 41 | } 42 | 43 | func (s *Slack) wasMentioned(msg string) bool { 44 | if len(msg) < 1 { 45 | return false 46 | } 47 | return strings.Contains(msg, s.botUID) 48 | } 49 | 50 | // expect some byte and write to slack 51 | func (s *Slack) Write(o []byte) (n int, err error) { 52 | outBuf := bytes.Buffer{} 53 | outBuf.Write(o) 54 | 55 | params := slack.NewPostMessageParameters() 56 | params.Username = "supslack" 57 | params.AsUser = true 58 | 59 | params.Attachments = []slack.Attachment{ 60 | { 61 | Text: fmt.Sprintf("%s\n\u2014", outBuf.String()), // \u200B for space 62 | MarkdownIn: []string{"text"}, 63 | }, 64 | } 65 | 66 | s.api.PostMessage(s.channel, "", params) 67 | return len(o), nil 68 | } 69 | 70 | // Start waits for Slack events. 71 | func (s *Slack) Start() { 72 | Loop: 73 | for { 74 | select { 75 | case msg := <-s.rtm.IncomingEvents: 76 | switch ev := msg.Data.(type) { 77 | case *slack.HelloEvent: 78 | log.Println("slackbot: hello dave.") 79 | case *slack.ConnectedEvent: 80 | log.Println("slackbot: I'm online dave.") 81 | for _, ch := range ev.Info.Channels { 82 | log.Printf("slackbot: joined channel %s\n", ch.Name) 83 | s.rtm.SendMessage( 84 | s.rtm.NewOutgoingMessage( 85 | ch.Name, 86 | "Never send a human to do a machine's job.", 87 | ), 88 | ) 89 | } 90 | s.botUID = fmt.Sprintf("<@%s>: ", ev.Info.User.ID) 91 | case *slack.MessageEvent: 92 | s.channel = ev.Msg.Channel 93 | // must be mentioned 94 | if s.wasMentioned(ev.Text) { 95 | // TODO: pass to bot 96 | supBot.Write([]byte(strings.TrimPrefix(ev.Text, s.botUID))) 97 | } 98 | case *slack.InvalidAuthEvent: 99 | log.Println("supbot: I seem to be disconnected, can't let you do that.") 100 | break Loop 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | // If the output encoding is UTF-8, we don't need to recode the buffer. 22 | if emitter.encoding == yaml_UTF8_ENCODING { 23 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 24 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 25 | } 26 | emitter.buffer_pos = 0 27 | return true 28 | } 29 | 30 | // Recode the buffer into the raw buffer. 31 | var low, high int 32 | if emitter.encoding == yaml_UTF16LE_ENCODING { 33 | low, high = 0, 1 34 | } else { 35 | high, low = 1, 0 36 | } 37 | 38 | pos := 0 39 | for pos < emitter.buffer_pos { 40 | // See the "reader.c" code for more details on UTF-8 encoding. Note 41 | // that we assume that the buffer contains a valid UTF-8 sequence. 42 | 43 | // Read the next UTF-8 character. 44 | octet := emitter.buffer[pos] 45 | 46 | var w int 47 | var value rune 48 | switch { 49 | case octet&0x80 == 0x00: 50 | w, value = 1, rune(octet&0x7F) 51 | case octet&0xE0 == 0xC0: 52 | w, value = 2, rune(octet&0x1F) 53 | case octet&0xF0 == 0xE0: 54 | w, value = 3, rune(octet&0x0F) 55 | case octet&0xF8 == 0xF0: 56 | w, value = 4, rune(octet&0x07) 57 | } 58 | for k := 1; k < w; k++ { 59 | octet = emitter.buffer[pos+k] 60 | value = (value << 6) + (rune(octet) & 0x3F) 61 | } 62 | pos += w 63 | 64 | // Write the character. 65 | if value < 0x10000 { 66 | var b [2]byte 67 | b[high] = byte(value >> 8) 68 | b[low] = byte(value & 0xFF) 69 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) 70 | } else { 71 | // Write the character using a surrogate pair (check "reader.c"). 72 | var b [4]byte 73 | value -= 0x10000 74 | b[high] = byte(0xD8 + (value >> 18)) 75 | b[low] = byte((value >> 10) & 0xFF) 76 | b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) 77 | b[low+2] = byte(value & 0xFF) 78 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) 79 | } 80 | } 81 | 82 | // Write the raw buffer. 83 | if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { 84 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 85 | } 86 | emitter.buffer_pos = 0 87 | emitter.raw_buffer = emitter.raw_buffer[:0] 88 | return true 89 | } 90 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/ssh/agent/forward.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package agent 6 | 7 | import ( 8 | "errors" 9 | "io" 10 | "net" 11 | "sync" 12 | 13 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/golang.org/x/crypto/ssh" 14 | ) 15 | 16 | // RequestAgentForwarding sets up agent forwarding for the session. 17 | // ForwardToAgent or ForwardToRemote should be called to route 18 | // the authentication requests. 19 | func RequestAgentForwarding(session *ssh.Session) error { 20 | ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil) 21 | if err != nil { 22 | return err 23 | } 24 | if !ok { 25 | return errors.New("forwarding request denied") 26 | } 27 | return nil 28 | } 29 | 30 | // ForwardToAgent routes authentication requests to the given keyring. 31 | func ForwardToAgent(client *ssh.Client, keyring Agent) error { 32 | channels := client.HandleChannelOpen(channelType) 33 | if channels == nil { 34 | return errors.New("agent: already have handler for " + channelType) 35 | } 36 | 37 | go func() { 38 | for ch := range channels { 39 | channel, reqs, err := ch.Accept() 40 | if err != nil { 41 | continue 42 | } 43 | go ssh.DiscardRequests(reqs) 44 | go func() { 45 | ServeAgent(keyring, channel) 46 | channel.Close() 47 | }() 48 | } 49 | }() 50 | return nil 51 | } 52 | 53 | const channelType = "auth-agent@openssh.com" 54 | 55 | // ForwardToRemote routes authentication requests to the ssh-agent 56 | // process serving on the given unix socket. 57 | func ForwardToRemote(client *ssh.Client, addr string) error { 58 | channels := client.HandleChannelOpen(channelType) 59 | if channels == nil { 60 | return errors.New("agent: already have handler for " + channelType) 61 | } 62 | conn, err := net.Dial("unix", addr) 63 | if err != nil { 64 | return err 65 | } 66 | conn.Close() 67 | 68 | go func() { 69 | for ch := range channels { 70 | channel, reqs, err := ch.Accept() 71 | if err != nil { 72 | continue 73 | } 74 | go ssh.DiscardRequests(reqs) 75 | go forwardUnixSocket(channel, addr) 76 | } 77 | }() 78 | return nil 79 | } 80 | 81 | func forwardUnixSocket(channel ssh.Channel, addr string) { 82 | conn, err := net.Dial("unix", addr) 83 | if err != nil { 84 | return 85 | } 86 | 87 | var wg sync.WaitGroup 88 | wg.Add(2) 89 | go func() { 90 | io.Copy(conn, channel) 91 | conn.(*net.UnixConn).CloseWrite() 92 | wg.Done() 93 | }() 94 | go func() { 95 | io.Copy(channel, conn) 96 | channel.CloseWrite() 97 | wg.Done() 98 | }() 99 | 100 | wg.Wait() 101 | conn.Close() 102 | channel.Close() 103 | } 104 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // The primary use of this package is inside other packages that provide a more 15 | // portable interface to the system, such as "os", "time" and "net". Use 16 | // those packages rather than this one if you can. 17 | // For details of the functions and data types in this package consult 18 | // the manuals for the appropriate operating system. 19 | // These calls return err == nil to indicate success; otherwise 20 | // err represents an operating system error describing the failure and 21 | // holds a value of type syscall.Errno. 22 | package unix 23 | 24 | import "unsafe" 25 | 26 | // ByteSliceFromString returns a NUL-terminated slice of bytes 27 | // containing the text of s. If s contains a NUL byte at any 28 | // location, it returns (nil, EINVAL). 29 | func ByteSliceFromString(s string) ([]byte, error) { 30 | for i := 0; i < len(s); i++ { 31 | if s[i] == 0 { 32 | return nil, EINVAL 33 | } 34 | } 35 | a := make([]byte, len(s)+1) 36 | copy(a, s) 37 | return a, nil 38 | } 39 | 40 | // BytePtrFromString returns a pointer to a NUL-terminated array of 41 | // bytes containing the text of s. If s contains a NUL byte at any 42 | // location, it returns (nil, EINVAL). 43 | func BytePtrFromString(s string) (*byte, error) { 44 | a, err := ByteSliceFromString(s) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return &a[0], nil 49 | } 50 | 51 | // Single-word zero for use when we need a valid pointer to 0 bytes. 52 | // See mkunix.pl. 53 | var _zero uintptr 54 | 55 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 56 | return int64(ts.Sec), int64(ts.Nsec) 57 | } 58 | 59 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 60 | return int64(tv.Sec), int64(tv.Usec) * 1000 61 | } 62 | 63 | func (ts *Timespec) Nano() int64 { 64 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 65 | } 66 | 67 | func (tv *Timeval) Nano() int64 { 68 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 69 | } 70 | 71 | // use is a no-op, but the compiler cannot see that it is. 72 | // Calling use(p) ensures that p is kept live until that point. 73 | //go:noescape 74 | func use(p unsafe.Pointer) 75 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/nlopes/slack/websocket.go: -------------------------------------------------------------------------------- 1 | package slack 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "log" 7 | "time" 8 | 9 | "github.com/gophergala2016/supbot/Godeps/_workspace/src/golang.org/x/net/websocket" 10 | ) 11 | 12 | const ( 13 | // MaxMessageTextLength is the current maximum message length in number of characters as defined here 14 | // https://api.slack.com/rtm#limits 15 | MaxMessageTextLength = 4000 16 | ) 17 | 18 | // RTM represents a managed websocket connection. It also supports 19 | // all the methods of the `Client` type. 20 | // 21 | // Create this element with Client's NewRTM(). 22 | type RTM struct { 23 | idGen IDGenerator 24 | pings map[int]time.Time 25 | 26 | // Connection life-cycle 27 | conn *websocket.Conn 28 | IncomingEvents chan RTMEvent 29 | outgoingMessages chan OutgoingMessage 30 | killChannel chan bool 31 | forcePing chan bool 32 | rawEvents chan json.RawMessage 33 | wasIntentional bool 34 | isConnected bool 35 | 36 | // Client is the main API, embedded 37 | Client 38 | websocketURL string 39 | 40 | // UserDetails upon connection 41 | info *Info 42 | } 43 | 44 | // NewRTM returns a RTM, which provides a fully managed connection to 45 | // Slack's websocket-based Real-Time Messaging protocol. 46 | func newRTM(api *Client) *RTM { 47 | return &RTM{ 48 | Client: *api, 49 | IncomingEvents: make(chan RTMEvent, 50), 50 | outgoingMessages: make(chan OutgoingMessage, 20), 51 | pings: make(map[int]time.Time), 52 | isConnected: false, 53 | wasIntentional: true, 54 | killChannel: make(chan bool), 55 | forcePing: make(chan bool), 56 | rawEvents: make(chan json.RawMessage), 57 | idGen: NewSafeID(1), 58 | } 59 | } 60 | 61 | // Disconnect and wait, blocking until a successful disconnection. 62 | func (rtm *RTM) Disconnect() error { 63 | if !rtm.isConnected { 64 | return errors.New("Invalid call to Disconnect - Slack API is already disconnected") 65 | } 66 | rtm.killChannel <- true 67 | return nil 68 | } 69 | 70 | // Reconnect only makes sense if you've successfully disconnectd with Disconnect(). 71 | func (rtm *RTM) Reconnect() error { 72 | log.Println("RTM::Reconnect not implemented!") 73 | return nil 74 | } 75 | 76 | // GetInfo returns the info structure received when calling 77 | // "startrtm", holding all channels, groups and other metadata needed 78 | // to implement a full chat client. It will be non-nil after a call to 79 | // StartRTM(). 80 | func (rtm *RTM) GetInfo() *Info { 81 | return rtm.info 82 | } 83 | 84 | // SendMessage submits a simple message through the websocket. For 85 | // more complicated messages, use `rtm.PostMessage` with a complete 86 | // struct describing your attachments and all. 87 | func (rtm *RTM) SendMessage(msg *OutgoingMessage) { 88 | if msg == nil { 89 | rtm.Debugln("Error: Attempted to SendMessage(nil)") 90 | return 91 | } 92 | 93 | rtm.outgoingMessages <- *msg 94 | } 95 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/github.com/boltdb/bolt/errors.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import "errors" 4 | 5 | // These errors can be returned when opening or calling methods on a DB. 6 | var ( 7 | // ErrDatabaseNotOpen is returned when a DB instance is accessed before it 8 | // is opened or after it is closed. 9 | ErrDatabaseNotOpen = errors.New("database not open") 10 | 11 | // ErrDatabaseOpen is returned when opening a database that is 12 | // already open. 13 | ErrDatabaseOpen = errors.New("database already open") 14 | 15 | // ErrInvalid is returned when a data file is not a Bolt-formatted database. 16 | ErrInvalid = errors.New("invalid database") 17 | 18 | // ErrVersionMismatch is returned when the data file was created with a 19 | // different version of Bolt. 20 | ErrVersionMismatch = errors.New("version mismatch") 21 | 22 | // ErrChecksum is returned when either meta page checksum does not match. 23 | ErrChecksum = errors.New("checksum error") 24 | 25 | // ErrTimeout is returned when a database cannot obtain an exclusive lock 26 | // on the data file after the timeout passed to Open(). 27 | ErrTimeout = errors.New("timeout") 28 | ) 29 | 30 | // These errors can occur when beginning or committing a Tx. 31 | var ( 32 | // ErrTxNotWritable is returned when performing a write operation on a 33 | // read-only transaction. 34 | ErrTxNotWritable = errors.New("tx not writable") 35 | 36 | // ErrTxClosed is returned when committing or rolling back a transaction 37 | // that has already been committed or rolled back. 38 | ErrTxClosed = errors.New("tx closed") 39 | 40 | // ErrDatabaseReadOnly is returned when a mutating transaction is started on a 41 | // read-only database. 42 | ErrDatabaseReadOnly = errors.New("database is in read-only mode") 43 | ) 44 | 45 | // These errors can occur when putting or deleting a value or a bucket. 46 | var ( 47 | // ErrBucketNotFound is returned when trying to access a bucket that has 48 | // not been created yet. 49 | ErrBucketNotFound = errors.New("bucket not found") 50 | 51 | // ErrBucketExists is returned when creating a bucket that already exists. 52 | ErrBucketExists = errors.New("bucket already exists") 53 | 54 | // ErrBucketNameRequired is returned when creating a bucket with a blank name. 55 | ErrBucketNameRequired = errors.New("bucket name required") 56 | 57 | // ErrKeyRequired is returned when inserting a zero-length key. 58 | ErrKeyRequired = errors.New("key required") 59 | 60 | // ErrKeyTooLarge is returned when inserting a key that is larger than MaxKeySize. 61 | ErrKeyTooLarge = errors.New("key too large") 62 | 63 | // ErrValueTooLarge is returned when inserting a value that is larger than MaxValueSize. 64 | ErrValueTooLarge = errors.New("value too large") 65 | 66 | // ErrIncompatibleValue is returned when trying create or delete a bucket 67 | // on an existing non-bucket key or when trying to create or delete a 68 | // non-bucket key on an existing bucket key. 69 | ErrIncompatibleValue = errors.New("incompatible value") 70 | ) 71 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/gopkg.in/yaml.v2/sorter.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "reflect" 5 | "unicode" 6 | ) 7 | 8 | type keyList []reflect.Value 9 | 10 | func (l keyList) Len() int { return len(l) } 11 | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } 12 | func (l keyList) Less(i, j int) bool { 13 | a := l[i] 14 | b := l[j] 15 | ak := a.Kind() 16 | bk := b.Kind() 17 | for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { 18 | a = a.Elem() 19 | ak = a.Kind() 20 | } 21 | for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { 22 | b = b.Elem() 23 | bk = b.Kind() 24 | } 25 | af, aok := keyFloat(a) 26 | bf, bok := keyFloat(b) 27 | if aok && bok { 28 | if af != bf { 29 | return af < bf 30 | } 31 | if ak != bk { 32 | return ak < bk 33 | } 34 | return numLess(a, b) 35 | } 36 | if ak != reflect.String || bk != reflect.String { 37 | return ak < bk 38 | } 39 | ar, br := []rune(a.String()), []rune(b.String()) 40 | for i := 0; i < len(ar) && i < len(br); i++ { 41 | if ar[i] == br[i] { 42 | continue 43 | } 44 | al := unicode.IsLetter(ar[i]) 45 | bl := unicode.IsLetter(br[i]) 46 | if al && bl { 47 | return ar[i] < br[i] 48 | } 49 | if al || bl { 50 | return bl 51 | } 52 | var ai, bi int 53 | var an, bn int64 54 | for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { 55 | an = an*10 + int64(ar[ai]-'0') 56 | } 57 | for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { 58 | bn = bn*10 + int64(br[bi]-'0') 59 | } 60 | if an != bn { 61 | return an < bn 62 | } 63 | if ai != bi { 64 | return ai < bi 65 | } 66 | return ar[i] < br[i] 67 | } 68 | return len(ar) < len(br) 69 | } 70 | 71 | // keyFloat returns a float value for v if it is a number/bool 72 | // and whether it is a number/bool or not. 73 | func keyFloat(v reflect.Value) (f float64, ok bool) { 74 | switch v.Kind() { 75 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 76 | return float64(v.Int()), true 77 | case reflect.Float32, reflect.Float64: 78 | return v.Float(), true 79 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 80 | return float64(v.Uint()), true 81 | case reflect.Bool: 82 | if v.Bool() { 83 | return 1, true 84 | } 85 | return 0, true 86 | } 87 | return 0, false 88 | } 89 | 90 | // numLess returns whether a < b. 91 | // a and b must necessarily have the same kind. 92 | func numLess(a, b reflect.Value) bool { 93 | switch a.Kind() { 94 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 95 | return a.Int() < b.Int() 96 | case reflect.Float32, reflect.Float64: 97 | return a.Float() < b.Float() 98 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 99 | return a.Uint() < b.Uint() 100 | case reflect.Bool: 101 | return !a.Bool() && b.Bool() 102 | } 103 | panic("not a number") 104 | } 105 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/crypto/curve25519/square_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | // func square(out, in *[5]uint64) 11 | TEXT ·square(SB),7,$96-16 12 | MOVQ out+0(FP), DI 13 | MOVQ in+8(FP), SI 14 | 15 | MOVQ SP,R11 16 | MOVQ $31,CX 17 | NOTQ CX 18 | ANDQ CX,SP 19 | ADDQ $32, SP 20 | 21 | MOVQ R11,0(SP) 22 | MOVQ R12,8(SP) 23 | MOVQ R13,16(SP) 24 | MOVQ R14,24(SP) 25 | MOVQ R15,32(SP) 26 | MOVQ BX,40(SP) 27 | MOVQ BP,48(SP) 28 | MOVQ 0(SI),AX 29 | MULQ 0(SI) 30 | MOVQ AX,CX 31 | MOVQ DX,R8 32 | MOVQ 0(SI),AX 33 | SHLQ $1,AX 34 | MULQ 8(SI) 35 | MOVQ AX,R9 36 | MOVQ DX,R10 37 | MOVQ 0(SI),AX 38 | SHLQ $1,AX 39 | MULQ 16(SI) 40 | MOVQ AX,R11 41 | MOVQ DX,R12 42 | MOVQ 0(SI),AX 43 | SHLQ $1,AX 44 | MULQ 24(SI) 45 | MOVQ AX,R13 46 | MOVQ DX,R14 47 | MOVQ 0(SI),AX 48 | SHLQ $1,AX 49 | MULQ 32(SI) 50 | MOVQ AX,R15 51 | MOVQ DX,BX 52 | MOVQ 8(SI),AX 53 | MULQ 8(SI) 54 | ADDQ AX,R11 55 | ADCQ DX,R12 56 | MOVQ 8(SI),AX 57 | SHLQ $1,AX 58 | MULQ 16(SI) 59 | ADDQ AX,R13 60 | ADCQ DX,R14 61 | MOVQ 8(SI),AX 62 | SHLQ $1,AX 63 | MULQ 24(SI) 64 | ADDQ AX,R15 65 | ADCQ DX,BX 66 | MOVQ 8(SI),DX 67 | IMUL3Q $38,DX,AX 68 | MULQ 32(SI) 69 | ADDQ AX,CX 70 | ADCQ DX,R8 71 | MOVQ 16(SI),AX 72 | MULQ 16(SI) 73 | ADDQ AX,R15 74 | ADCQ DX,BX 75 | MOVQ 16(SI),DX 76 | IMUL3Q $38,DX,AX 77 | MULQ 24(SI) 78 | ADDQ AX,CX 79 | ADCQ DX,R8 80 | MOVQ 16(SI),DX 81 | IMUL3Q $38,DX,AX 82 | MULQ 32(SI) 83 | ADDQ AX,R9 84 | ADCQ DX,R10 85 | MOVQ 24(SI),DX 86 | IMUL3Q $19,DX,AX 87 | MULQ 24(SI) 88 | ADDQ AX,R9 89 | ADCQ DX,R10 90 | MOVQ 24(SI),DX 91 | IMUL3Q $38,DX,AX 92 | MULQ 32(SI) 93 | ADDQ AX,R11 94 | ADCQ DX,R12 95 | MOVQ 32(SI),DX 96 | IMUL3Q $19,DX,AX 97 | MULQ 32(SI) 98 | ADDQ AX,R13 99 | ADCQ DX,R14 100 | MOVQ ·REDMASK51(SB),SI 101 | SHLQ $13,R8:CX 102 | ANDQ SI,CX 103 | SHLQ $13,R10:R9 104 | ANDQ SI,R9 105 | ADDQ R8,R9 106 | SHLQ $13,R12:R11 107 | ANDQ SI,R11 108 | ADDQ R10,R11 109 | SHLQ $13,R14:R13 110 | ANDQ SI,R13 111 | ADDQ R12,R13 112 | SHLQ $13,BX:R15 113 | ANDQ SI,R15 114 | ADDQ R14,R15 115 | IMUL3Q $19,BX,DX 116 | ADDQ DX,CX 117 | MOVQ CX,DX 118 | SHRQ $51,DX 119 | ADDQ R9,DX 120 | ANDQ SI,CX 121 | MOVQ DX,R8 122 | SHRQ $51,DX 123 | ADDQ R11,DX 124 | ANDQ SI,R8 125 | MOVQ DX,R9 126 | SHRQ $51,DX 127 | ADDQ R13,DX 128 | ANDQ SI,R9 129 | MOVQ DX,AX 130 | SHRQ $51,DX 131 | ADDQ R15,DX 132 | ANDQ SI,AX 133 | MOVQ DX,R10 134 | SHRQ $51,DX 135 | IMUL3Q $19,DX,DX 136 | ADDQ DX,CX 137 | ANDQ SI,R10 138 | MOVQ CX,0(DI) 139 | MOVQ R8,8(DI) 140 | MOVQ R9,16(DI) 141 | MOVQ AX,24(DI) 142 | MOVQ R10,32(DI) 143 | MOVQ 0(SP),R11 144 | MOVQ 8(SP),R12 145 | MOVQ 16(SP),R13 146 | MOVQ 24(SP),R14 147 | MOVQ 32(SP),R15 148 | MOVQ 40(SP),BX 149 | MOVQ 48(SP),BP 150 | MOVQ R11,SP 151 | MOVQ DI,AX 152 | MOVQ SI,DX 153 | RET 154 | -------------------------------------------------------------------------------- /Godeps/_workspace/src/golang.org/x/net/websocket/client.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "bufio" 9 | "crypto/tls" 10 | "io" 11 | "net" 12 | "net/http" 13 | "net/url" 14 | ) 15 | 16 | // DialError is an error that occurs while dialling a websocket server. 17 | type DialError struct { 18 | *Config 19 | Err error 20 | } 21 | 22 | func (e *DialError) Error() string { 23 | return "websocket.Dial " + e.Config.Location.String() + ": " + e.Err.Error() 24 | } 25 | 26 | // NewConfig creates a new WebSocket config for client connection. 27 | func NewConfig(server, origin string) (config *Config, err error) { 28 | config = new(Config) 29 | config.Version = ProtocolVersionHybi13 30 | config.Location, err = url.ParseRequestURI(server) 31 | if err != nil { 32 | return 33 | } 34 | config.Origin, err = url.ParseRequestURI(origin) 35 | if err != nil { 36 | return 37 | } 38 | config.Header = http.Header(make(map[string][]string)) 39 | return 40 | } 41 | 42 | // NewClient creates a new WebSocket client connection over rwc. 43 | func NewClient(config *Config, rwc io.ReadWriteCloser) (ws *Conn, err error) { 44 | br := bufio.NewReader(rwc) 45 | bw := bufio.NewWriter(rwc) 46 | err = hybiClientHandshake(config, br, bw) 47 | if err != nil { 48 | return 49 | } 50 | buf := bufio.NewReadWriter(br, bw) 51 | ws = newHybiClientConn(config, buf, rwc) 52 | return 53 | } 54 | 55 | // Dial opens a new client connection to a WebSocket. 56 | func Dial(url_, protocol, origin string) (ws *Conn, err error) { 57 | config, err := NewConfig(url_, origin) 58 | if err != nil { 59 | return nil, err 60 | } 61 | if protocol != "" { 62 | config.Protocol = []string{protocol} 63 | } 64 | return DialConfig(config) 65 | } 66 | 67 | var portMap = map[string]string{ 68 | "ws": "80", 69 | "wss": "443", 70 | } 71 | 72 | func parseAuthority(location *url.URL) string { 73 | if _, ok := portMap[location.Scheme]; ok { 74 | if _, _, err := net.SplitHostPort(location.Host); err != nil { 75 | return net.JoinHostPort(location.Host, portMap[location.Scheme]) 76 | } 77 | } 78 | return location.Host 79 | } 80 | 81 | // DialConfig opens a new client connection to a WebSocket with a config. 82 | func DialConfig(config *Config) (ws *Conn, err error) { 83 | var client net.Conn 84 | if config.Location == nil { 85 | return nil, &DialError{config, ErrBadWebSocketLocation} 86 | } 87 | if config.Origin == nil { 88 | return nil, &DialError{config, ErrBadWebSocketOrigin} 89 | } 90 | switch config.Location.Scheme { 91 | case "ws": 92 | client, err = net.Dial("tcp", parseAuthority(config.Location)) 93 | 94 | case "wss": 95 | client, err = tls.Dial("tcp", parseAuthority(config.Location), config.TlsConfig) 96 | 97 | default: 98 | err = ErrBadScheme 99 | } 100 | if err != nil { 101 | goto Error 102 | } 103 | 104 | ws, err = NewClient(config, client) 105 | if err != nil { 106 | client.Close() 107 | goto Error 108 | } 109 | return 110 | 111 | Error: 112 | return nil, &DialError{config, err} 113 | } 114 | --------------------------------------------------------------------------------