├── tmp
└── .gitkeep
├── files
├── public
├── files
│ └── .gitkeep
├── robots.txt
├── img
│ ├── bee.gif
│ ├── mac.png
│ ├── win.png
│ ├── Golang.png
│ ├── github.png
│ ├── gopher.png
│ ├── linux.png
│ ├── favicon.png
│ └── qiniu-logo.png
├── gobuild-badge.png
├── fonts
│ ├── fontello.eot
│ ├── fontello.ttf
│ ├── fontello.woff
│ └── fontello.svg
├── gobuildrc
├── js
│ ├── common-gobuild.js
│ ├── site.js
│ └── html5shiv.js
└── css
│ └── font.css
├── Godeps
└── _workspace
│ └── src
│ ├── github.com
│ ├── shxsun
│ │ ├── klog
│ │ │ ├── testdata
│ │ │ │ └── .gitkeep
│ │ │ ├── images
│ │ │ │ └── sample.png
│ │ │ ├── .gitignore
│ │ │ ├── example
│ │ │ │ └── example.go
│ │ │ ├── utils.go
│ │ │ ├── LICENSE
│ │ │ └── README.md
│ │ ├── goyaml
│ │ │ ├── .gitignore
│ │ │ ├── suite_test.go
│ │ │ ├── Makefile
│ │ │ └── LICENSE.libyaml
│ │ ├── go-uuid
│ │ │ ├── doc.go
│ │ │ ├── version4.go
│ │ │ ├── version1.go
│ │ │ ├── LICENSE
│ │ │ ├── hash.go
│ │ │ ├── util.go
│ │ │ └── dce.go
│ │ ├── go-sh
│ │ │ ├── example_test.go
│ │ │ ├── test_test.go
│ │ │ ├── example
│ │ │ │ └── example1.go
│ │ │ ├── test.go
│ │ │ ├── pipe_test.go
│ │ │ ├── OLD_README.md
│ │ │ ├── sh_test.go
│ │ │ ├── pipe.go
│ │ │ └── README.md
│ │ └── go-websocket
│ │ │ ├── examplehandler_test.go
│ │ │ ├── exampledial_test.go
│ │ │ └── client.go
│ ├── lunny
│ │ └── xorm
│ │ │ ├── VERSION
│ │ │ ├── xorm
│ │ │ ├── templates
│ │ │ │ ├── c++
│ │ │ │ │ ├── config
│ │ │ │ │ └── class.h.tpl
│ │ │ │ ├── go
│ │ │ │ │ ├── config
│ │ │ │ │ └── struct.go.tpl
│ │ │ │ └── goxorm
│ │ │ │ │ ├── config
│ │ │ │ │ └── struct.go.tpl
│ │ │ ├── .gopmfile
│ │ │ ├── lang.go
│ │ │ ├── README.md
│ │ │ ├── c++.go
│ │ │ └── cmd.go
│ │ │ ├── benchmark.bat
│ │ │ ├── benchmark.sh
│ │ │ ├── .gopmfile
│ │ │ ├── docs
│ │ │ ├── cache_design.png
│ │ │ ├── AutoMap.md
│ │ │ └── ChangelogCN.md
│ │ │ ├── tests
│ │ │ └── mysql_ddl.sql
│ │ │ ├── .gitignore
│ │ │ ├── error.go
│ │ │ ├── examples
│ │ │ ├── pool.go
│ │ │ ├── singlemapping.go
│ │ │ ├── derive.go
│ │ │ ├── conversion.go
│ │ │ ├── cache.go
│ │ │ └── sync.go
│ │ │ ├── processors.go
│ │ │ ├── filter.go
│ │ │ ├── LICENSE
│ │ │ ├── mymysql.go
│ │ │ ├── CONTRIBUTING.md
│ │ │ └── xorm.go
│ ├── Unknwon
│ │ ├── cae
│ │ │ └── zip
│ │ │ │ ├── testdata
│ │ │ │ ├── testdir.lnk
│ │ │ │ ├── README.txt
│ │ │ │ ├── testdir
│ │ │ │ │ ├── level1
│ │ │ │ │ │ └── README.txt
│ │ │ │ │ └── gophercolor16x16.png
│ │ │ │ ├── test.lnk
│ │ │ │ ├── test.zip
│ │ │ │ ├── readme.notzip
│ │ │ │ └── gophercolor16x16.png
│ │ │ │ └── read.go
│ │ └── com
│ │ │ ├── testdata
│ │ │ ├── sample_file.txt
│ │ │ ├── SaveFile.txt
│ │ │ ├── statDir
│ │ │ │ ├── sample_file.txt
│ │ │ │ ├── SaveFile.txt
│ │ │ │ ├── SaveFileS.txt
│ │ │ │ └── secondLevel
│ │ │ │ │ ├── sample_file.txt
│ │ │ │ │ ├── SaveFile.txt
│ │ │ │ │ └── SaveFileS.txt
│ │ │ └── SaveFileS.txt
│ │ │ ├── .gitignore
│ │ │ ├── url.go
│ │ │ ├── README.md
│ │ │ ├── html_test.go
│ │ │ ├── dir_test.go
│ │ │ ├── slice.go
│ │ │ ├── path_test.go
│ │ │ ├── regex.go
│ │ │ ├── regex_test.go
│ │ │ ├── html.go
│ │ │ ├── path.go
│ │ │ ├── string_test.go
│ │ │ └── time.go
│ ├── codegangsta
│ │ ├── inject
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ └── LICENSE
│ │ ├── martini
│ │ │ ├── wercker.yml
│ │ │ ├── go_version.go
│ │ │ ├── .gitignore
│ │ │ ├── env_test.go
│ │ │ ├── env.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── LICENSE
│ │ │ ├── return_handler.go
│ │ │ └── recovery_test.go
│ │ └── martini-contrib
│ │ │ └── render
│ │ │ └── fixtures
│ │ │ ├── basic
│ │ │ ├── hypertext.html
│ │ │ ├── content.tmpl
│ │ │ ├── delims.tmpl
│ │ │ ├── hello.tmpl
│ │ │ ├── admin
│ │ │ │ └── index.tmpl
│ │ │ ├── layout.tmpl
│ │ │ └── another_layout.tmpl
│ │ │ └── custom_funcs
│ │ │ └── index.tmpl
│ ├── qiniu
│ │ ├── rpc
│ │ │ ├── README.md
│ │ │ ├── .gitignore
│ │ │ └── CHANGELOG.md
│ │ ├── bytes
│ │ │ ├── README.md
│ │ │ ├── .gitignore
│ │ │ ├── seekable
│ │ │ │ └── seekable.go
│ │ │ └── bytes_test.go
│ │ └── api
│ │ │ ├── conf
│ │ │ └── conf.go
│ │ │ └── rs
│ │ │ ├── token_test.go
│ │ │ ├── rs_api_test.go
│ │ │ ├── token.go
│ │ │ ├── batch_api.go
│ │ │ └── rs_api.go
│ ├── astaxie
│ │ └── beego
│ │ │ └── utils
│ │ │ ├── testdata
│ │ │ └── grepe.test
│ │ │ ├── caller.go
│ │ │ ├── slice_test.go
│ │ │ ├── caller_test.go
│ │ │ ├── captcha
│ │ │ ├── siprng_test.go
│ │ │ ├── image_test.go
│ │ │ └── README.md
│ │ │ ├── safemap_test.go
│ │ │ ├── rand.go
│ │ │ ├── mail_test.go
│ │ │ ├── file_test.go
│ │ │ ├── safemap.go
│ │ │ └── file.go
│ ├── aybabtme
│ │ └── color
│ │ │ ├── .gitignore
│ │ │ ├── LICENSE
│ │ │ ├── sample
│ │ │ └── sample.go
│ │ │ ├── doc.go
│ │ │ └── README.md
│ └── go-sql-driver
│ │ └── mysql
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── result.go
│ │ ├── appengine.go
│ │ ├── transaction.go
│ │ ├── errors_test.go
│ │ ├── AUTHORS
│ │ ├── CONTRIBUTING.md
│ │ ├── rows.go
│ │ └── CHANGELOG.md
│ └── code.google.com
│ └── p
│ └── freetype-go
│ └── freetype
│ └── freetype_test.go
├── bin
├── font.ttf
├── update.sh
├── supervisor.ini
├── install.sh
├── autobuild
├── gobuild.io.nginx
├── build
├── ssl.key
├── crypted-ssl.key
└── ssl.crt
├── templates
├── document.tmpl
├── about.tmpl
├── search.tmpl
├── dlscript.sh.tmpl
└── build.tmpl
├── CHANGELOG
├── assembly_test.go
├── publish
├── achieve_test.go
├── upload.go
└── achieve.go
├── .gobuild.yml
├── INTRODUCE.md
├── utils
├── tmpfile_test.go
├── namelock_test.go
├── safemap.go
├── broadcast_test.go
├── utils_test.go
├── utils.go
├── namelock.go
├── tmpfile.go
├── bufreader.go
└── broadcast.go
├── .gitignore
├── config.yaml.sample
├── search_api.go
├── upload.go
├── router_badge.go
├── database
└── database_test.go
└── assembly.go
/tmp/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/files:
--------------------------------------------------------------------------------
1 | public/files
--------------------------------------------------------------------------------
/public/files/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/testdata/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/VERSION:
--------------------------------------------------------------------------------
1 | xorm v0.3.1
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/testdir.lnk:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/sample_file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 | Disallow: /bin/
4 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/SaveFile.txt:
--------------------------------------------------------------------------------
1 | TestSaveFile
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/sample_file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/c++/config:
--------------------------------------------------------------------------------
1 | lang=c++
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/go/config:
--------------------------------------------------------------------------------
1 | lang=go
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/SaveFileS.txt:
--------------------------------------------------------------------------------
1 | TestSaveFileS
--------------------------------------------------------------------------------
/bin/font.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/bin/font.ttf
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/SaveFile.txt:
--------------------------------------------------------------------------------
1 | TestSaveFile
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/SaveFileS.txt:
--------------------------------------------------------------------------------
1 | TestSaveFileS
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/benchmark.bat:
--------------------------------------------------------------------------------
1 | go test -v -bench=. -run=XXX
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/benchmark.sh:
--------------------------------------------------------------------------------
1 | go test -v -bench=. -run=XXX
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/secondLevel/sample_file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/inject/.gitignore:
--------------------------------------------------------------------------------
1 | inject
2 | inject.test
3 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/wercker.yml:
--------------------------------------------------------------------------------
1 | box: wercker/golang@1.1.1
--------------------------------------------------------------------------------
/public/img/bee.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/bee.gif
--------------------------------------------------------------------------------
/public/img/mac.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/mac.png
--------------------------------------------------------------------------------
/public/img/win.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/win.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/secondLevel/SaveFile.txt:
--------------------------------------------------------------------------------
1 | TestSaveFile
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/.gopmfile:
--------------------------------------------------------------------------------
1 | [target]
2 | path = github.com/lunny/xorm
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/.gopmfile:
--------------------------------------------------------------------------------
1 | [deps]
2 | github.com/lunny/xorm=../
--------------------------------------------------------------------------------
/public/img/Golang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/Golang.png
--------------------------------------------------------------------------------
/public/img/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/github.png
--------------------------------------------------------------------------------
/public/img/gopher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/gopher.png
--------------------------------------------------------------------------------
/public/img/linux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/linux.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/testdata/statDir/secondLevel/SaveFileS.txt:
--------------------------------------------------------------------------------
1 | TestSaveFileS
--------------------------------------------------------------------------------
/public/gobuild-badge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/gobuild-badge.png
--------------------------------------------------------------------------------
/public/img/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/favicon.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/README.txt:
--------------------------------------------------------------------------------
1 | This small file is in ZIP64 format.
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/rpc/README.md:
--------------------------------------------------------------------------------
1 | rpc
2 | ===
3 |
4 | Golang rpc client based on http
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/goyaml/.gitignore:
--------------------------------------------------------------------------------
1 | .bzr
2 | .bzrignore
3 | .lbox
4 | .lbox.check
5 |
--------------------------------------------------------------------------------
/public/fonts/fontello.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/fonts/fontello.eot
--------------------------------------------------------------------------------
/public/fonts/fontello.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/fonts/fontello.ttf
--------------------------------------------------------------------------------
/public/fonts/fontello.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/fonts/fontello.woff
--------------------------------------------------------------------------------
/public/img/qiniu-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/public/img/qiniu-logo.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/hypertext.html:
--------------------------------------------------------------------------------
1 | Hypertext!
2 |
--------------------------------------------------------------------------------
/templates/document.tmpl:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/content.tmpl:
--------------------------------------------------------------------------------
1 | {{ . }}
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/delims.tmpl:
--------------------------------------------------------------------------------
1 | Hello {[{.}]}
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/hello.tmpl:
--------------------------------------------------------------------------------
1 | Hello {{.}}
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/goxorm/config:
--------------------------------------------------------------------------------
1 | lang=go
2 | genJson=0
3 | prefix=cos_
4 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/testdir/level1/README.txt:
--------------------------------------------------------------------------------
1 | This small file is in ZIP64 format.
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/inject/README.md:
--------------------------------------------------------------------------------
1 | inject
2 | ======
3 |
4 | Dependency injection for go
5 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/custom_funcs/index.tmpl:
--------------------------------------------------------------------------------
1 | {{ myCustomFunc }}
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/admin/index.tmpl:
--------------------------------------------------------------------------------
1 | Admin {{.}}
2 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/layout.tmpl:
--------------------------------------------------------------------------------
1 | head
2 | {{ yield }}
3 | foot
4 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/testdata/grepe.test:
--------------------------------------------------------------------------------
1 | # empty lines
2 |
3 |
4 |
5 | hello
6 | # comment
7 | world
8 |
--------------------------------------------------------------------------------
/CHANGELOG:
--------------------------------------------------------------------------------
1 | * 2013-01-08 第一个版本诞生
2 | * 2013-01-09 合并高和(Codefor)的pull request
3 | * 2014-01-20 gobuild.io域名正式启用
4 | * 2013-02-14 启用fuxiaohei的新页面
5 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini-contrib/render/fixtures/basic/another_layout.tmpl:
--------------------------------------------------------------------------------
1 | another head
2 | {{ yield }}
3 | another foot
4 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/aybabtme/color/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.sublime-workspace
3 | *.sublime-*
4 |
5 | *.dat
6 | *.html
7 | sample/sample
8 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .DS_Store?
3 | ._*
4 | .Spotlight-V100
5 | .Trashes
6 | Icon?
7 | ehthumbs.db
8 | Thumbs.db
9 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 | go:
3 | - 1.1
4 | - tip
5 |
6 | before_script:
7 | - mysql -e 'create database gotest;'
8 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/images/sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/shxsun/klog/images/sample.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/test.lnk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/test.lnk
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/test.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/test.zip
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/docs/cache_design.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/lunny/xorm/docs/cache_design.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/readme.notzip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/readme.notzip
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/gophercolor16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/gophercolor16x16.png
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/go_version.go:
--------------------------------------------------------------------------------
1 | // +build !go1.1
2 |
3 | package martini
4 |
5 | func MartiniDoesNotSupportGo1Point0() {
6 | "Martini requires Go 1.1 or greater."
7 | }
8 |
--------------------------------------------------------------------------------
/public/gobuildrc:
--------------------------------------------------------------------------------
1 | # default .gobuild
2 | #framework: none
3 | filesets:
4 | includes:
5 | - README.md
6 | - LICENSE
7 | - CHANGELOG
8 | excludes:
9 | - .svn
10 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/testdir/gophercolor16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeskyblue/gobuild/HEAD/Godeps/_workspace/src/github.com/Unknwon/cae/zip/testdata/testdir/gophercolor16x16.png
--------------------------------------------------------------------------------
/bin/update.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 | #
3 | gopath=$(go env GOPATH)
4 | gobin=${GOBIN:-"$gopath/bin"}
5 | cd $gopath/src/github.com/codeskyblue/gobuild
6 | git pull
7 | go get -v
8 | cd -
9 | mv -v $gobin/gobuild ./gobuild
10 |
11 |
--------------------------------------------------------------------------------
/assembly_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | /*
4 | func TestPackage(t *testing.T) {
5 | addr, err := Package([]string{"README.md"}, "public/gobuildrc")
6 | if err != nil {
7 | t.Fatal(err)
8 | }
9 | t.Log(addr)
10 | }
11 | */
12 |
--------------------------------------------------------------------------------
/publish/achieve_test.go:
--------------------------------------------------------------------------------
1 | package publish
2 |
3 | /*
4 | func TestPackage(t *testing.T) {
5 | addr, err := Package([]string{"README.md"}, "public/gobuildrc")
6 | if err != nil {
7 | t.Fatal(err)
8 | }
9 | t.Log(addr)
10 | }
11 | */
12 |
--------------------------------------------------------------------------------
/.gobuild.yml:
--------------------------------------------------------------------------------
1 | ---
2 | filesets:
3 | includes:
4 | - public
5 | - templates
6 | - bin
7 | - config.yaml
8 | - README.md
9 | - LICENSE
10 | - CHANGELOG
11 | excludes:
12 | - .svn
13 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/goyaml/suite_test.go:
--------------------------------------------------------------------------------
1 | package goyaml_test
2 |
3 | import (
4 | . "launchpad.net/gocheck"
5 | "testing"
6 | )
7 |
8 | func Test(t *testing.T) { TestingT(t) }
9 |
10 | type S struct{}
11 |
12 | var _ = Suite(&S{})
13 |
--------------------------------------------------------------------------------
/INTRODUCE.md:
--------------------------------------------------------------------------------
1 | gobuild.io是一个提供golang在线编译的网站。由开源社区维护和更新。
2 |
3 | 有很多很多优秀的工具是用golang写出来的。不过最大的开源网站github.com只提供代码的托管,并不提供二进制文件的下载。该网站将代码的编译与二进制的分享结合了起来,给无数人带来了便利。
4 |
5 | 比如一个项目的地址是github.com/beego/bee,而二进制文件的下载直接前往gobuild.io/github.com/beego/bee选择相应的平台和处理器架构。该网站将自动下载代码和编译打包。
6 |
--------------------------------------------------------------------------------
/templates/about.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
About us
3 |
4 | This website is just my hobby at first.
5 | Since lunny, unknown, fuxiaohei joined the program, this website are getting more and more strong.
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/caller.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "reflect"
5 | "runtime"
6 | )
7 |
8 | // get function name
9 | func GetFuncName(i interface{}) string {
10 | return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
11 | }
12 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/tests/mysql_ddl.sql:
--------------------------------------------------------------------------------
1 | --DROP DATABASE xorm_test;
2 | --DROP DATABASE xorm_test2;
3 | CREATE DATABASE IF NOT EXISTS xorm_test CHARACTER SET utf8 COLLATE utf8_general_ci;
4 | CREATE DATABASE IF NOT EXISTS xorm_test2 CHARACTER SET utf8 COLLATE utf8_general_ci;
5 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/bytes/README.md:
--------------------------------------------------------------------------------
1 | bytes
2 | =====
3 |
4 | [](https://drone.io/github.com/qiniu/bytes/latest)
5 |
6 | 
7 |
8 | Extension module of golang bytes processing
9 |
--------------------------------------------------------------------------------
/bin/supervisor.ini:
--------------------------------------------------------------------------------
1 | [program:gobuild]
2 | command = /home/golang/gobuild/gobuild
3 | directory = /home/golang/gobuild
4 | autostart = true
5 | user = golang
6 | killasgroup = true
7 |
8 | stderr_logfile = /var/log/supervisor/gobuild.stdout.log
9 | stdout_logfile = /var/log/supervisor/gobuild.stdout.log
10 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/go/struct.go.tpl:
--------------------------------------------------------------------------------
1 | package {{.Model}}
2 |
3 | import (
4 | {{range .Imports}}"{{.}}"{{end}}
5 | )
6 |
7 | {{range .Tables}}
8 | type {{Mapper .Name}} struct {
9 | {{$table := .}}
10 | {{range .Columns}} {{Mapper .Name}} {{Type .}}
11 | {{end}}
12 | }
13 |
14 | {{end}}
--------------------------------------------------------------------------------
/utils/tmpfile_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "os"
5 | "testing"
6 | )
7 |
8 | func TestTempFile(t *testing.T) {
9 | name, err := TempFile("./", "tmp-", ".zip")
10 | if err != nil {
11 | t.Fatal(err)
12 | }
13 | t.Log(name)
14 | err = os.Remove(name)
15 | if err != nil {
16 | t.Fatal(err)
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/slice_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestInSlice(t *testing.T) {
8 | sl := []string{"A", "b"}
9 | if !InSlice("A", sl) {
10 | t.Error("should be true")
11 | }
12 | if InSlice("B", sl) {
13 | t.Error("should be false")
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/caller_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "strings"
5 | "testing"
6 | )
7 |
8 | func TestGetFuncName(t *testing.T) {
9 | name := GetFuncName(TestGetFuncName)
10 | t.Log(name)
11 | if !strings.HasSuffix(name, ".TestGetFuncName") {
12 | t.Error("get func name error")
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 | // The uuid package generates and inspects UUIDs.
6 | //
7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services.
8 | package uuid
9 |
--------------------------------------------------------------------------------
/utils/namelock_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "testing"
5 | "time"
6 | )
7 |
8 | func TestNameLock(t *testing.T) {
9 | n1 := NewNameLock("hello")
10 | n2 := NewNameLock("hello")
11 | go func() {
12 | n1.Lock()
13 | time.Sleep(1e5)
14 | t.Log("first")
15 | n1.Unlock()
16 | }()
17 | time.Sleep(1e4)
18 | n2.Lock()
19 | t.Log("second")
20 | n2.Unlock()
21 | }
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | files/**
24 | gobuild
25 | sqlite.db
26 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/bytes/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/rpc/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 | *.test
24 |
--------------------------------------------------------------------------------
/bin/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -
2 | #
3 | WORKSPACE=$(cd $(dirname $0)/..; pwd)
4 | export GOPATH=$WORKSPACE/gopath
5 | export GOBIN=$WORKSPACE/bin
6 | export PATH=$GOBIN:$PATH
7 |
8 | go get -v github.com/mitchellh/gox
9 |
10 | go get -v github.com/beego/bee
11 | go get -v github.com/robfig/revel/revel
12 | go get -v github.com/gpmgo/gopm
13 |
14 | #echo build toolchain
15 | echo "run if first: gox -build-toolchain"
16 | #go build
17 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 |
6 | # Folders
7 | _obj
8 | _test
9 |
10 | # Architecture specific extensions/prefixes
11 | *.[568vq]
12 | [568vq].out
13 |
14 | *.cgo1.go
15 | *.cgo2.c
16 | _cgo_defun.c
17 | _cgo_gotypes.go
18 | _cgo_export.*
19 |
20 | _testmain.go
21 |
22 | *.exe
23 |
24 | *.swp
25 | *.swx
26 | *~
27 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/example/example.go:
--------------------------------------------------------------------------------
1 | package main
2 | import "github.com/shxsun/klog"
3 | func main(){
4 | k := klog.NewLogger(nil, "") // Write to stdout and without prefix
5 |
6 | k.Infof("Hi %s.", "Susan")
7 | k.Warn("Oh my god, you are alive!")
8 | k.Error("Yes, but I will go to Mars tomorrow. So only one day with you")
9 | k.Fatal("Oh no, donot leave me again... faint") // Fatal will call os.Exit(1)
10 | }
11 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/env_test.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func Test_SetENV(t *testing.T) {
8 | tests := []struct {
9 | in string
10 | out string
11 | }{
12 | {"", "development"},
13 | {"not_development", "not_development"},
14 | }
15 |
16 | for _, test := range tests {
17 | setENV(test.in)
18 | if Env != test.out {
19 | expect(t, Env, test.out)
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
2 | *.o
3 | *.a
4 | *.so
5 | *.db
6 |
7 | # Folders
8 | _obj
9 | _test
10 |
11 | # Architecture specific extensions/prefixes
12 | *.[568vq]
13 | [568vq].out
14 |
15 | *.cgo1.go
16 | *.cgo2.c
17 | _cgo_defun.c
18 | _cgo_gotypes.go
19 | _cgo_export.*
20 |
21 | _testmain.go
22 |
23 | *.exe
24 | vendor
25 |
26 | *.log
27 | .vendor
28 | temp_test.go
29 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/captcha/siprng_test.go:
--------------------------------------------------------------------------------
1 | package captcha
2 |
3 | import "testing"
4 |
5 | func TestSiphash(t *testing.T) {
6 | good := uint64(0xe849e8bb6ffe2567)
7 | cur := siphash(0, 0, 0)
8 | if cur != good {
9 | t.Fatalf("siphash: expected %x, got %x", good, cur)
10 | }
11 | }
12 |
13 | func BenchmarkSiprng(b *testing.B) {
14 | b.SetBytes(8)
15 | p := &siprng{}
16 | for i := 0; i < b.N; i++ {
17 | p.Uint64()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/goxorm/struct.go.tpl:
--------------------------------------------------------------------------------
1 | package {{.Model}}
2 |
3 | {{$ilen := len .Imports}}
4 | {{if gt $ilen 0}}
5 | import (
6 | {{range .Imports}}"{{.}}"{{end}}
7 | )
8 | {{end}}
9 |
10 | {{range .Tables}}
11 | type {{Mapper .Name}} struct {
12 | {{$table := .}}
13 | {{$columns := .Columns}}
14 | {{range .ColumnsSeq}}{{$col := getCol $columns .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}}
15 | {{end}}
16 | }
17 |
18 | {{end}}
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/rpc/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | #CHANGELOG
2 |
3 | ## v2.0.01
4 |
5 | 2013-03-20 Issue [#7](https://github.com/qiniu/rpc/pull/7):
6 |
7 | - support jsonrpc
8 |
9 |
10 | ## v2.0.00
11 |
12 | 2013-03-20 Issue [#5](https://github.com/qiniu/rpc/pull/5):
13 |
14 | - support X-Reqid, X-Log
15 | - support User-Agent
16 | - rpc error bugfix
17 |
18 |
19 | ## v1.0.00
20 |
21 | 2013-03-10 Issue [#2](https://github.com/qiniu/rpc/pull/2):
22 |
23 | - initial version
24 |
--------------------------------------------------------------------------------
/config.yaml.sample:
--------------------------------------------------------------------------------
1 | ---
2 | development:
3 | hostname: localhost:3000
4 | listen: 0.0.0.0:3000
5 | driver: mysql
6 | data_source: root@/gobuild
7 | goroot: /Users/skyblue/go
8 |
9 | production:
10 | hostname: gobuild.io
11 | listen: 0.0.0.0:7000
12 | driver: mysql
13 | data_source: root:toor@tcp(skyblue:3306)/gobuild
14 | goroot: /usr/src/go
15 | # qiniu
16 | access_key: BgESh3GconLxVmqlkM19U3ANknrCsTWwIx67S3fo
17 | secret_key: xxxx
18 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/safemap_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func Test_beemap(t *testing.T) {
8 | bm := NewBeeMap()
9 | if !bm.Set("astaxie", 1) {
10 | t.Error("set Error")
11 | }
12 | if !bm.Check("astaxie") {
13 | t.Error("check err")
14 | }
15 |
16 | if v := bm.Get("astaxie"); v.(int) != 1 {
17 | t.Error("get err")
18 | }
19 |
20 | bm.Delete("astaxie")
21 | if bm.Check("astaxie") {
22 | t.Error("delete err")
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/env.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "os"
5 | )
6 |
7 | // Envs
8 | const (
9 | Dev string = "development"
10 | Prod string = "production"
11 | Test string = "test"
12 | )
13 |
14 | // Env is the environment that Martini is executing in. The MARTINI_ENV is read on initialization to set this variable.
15 | var Env = Dev
16 |
17 | func setENV(e string) {
18 | if len(e) > 0 {
19 | Env = e
20 | }
21 | }
22 |
23 | func init() {
24 | setENV(os.Getenv("MARTINI_ENV"))
25 | }
26 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/api/conf/conf.go:
--------------------------------------------------------------------------------
1 | package conf
2 |
3 | import (
4 | "github.com/qiniu/rpc"
5 | )
6 |
7 | var UP_HOST = "http://up.qiniu.com"
8 | var RS_HOST = "http://rs.qbox.me"
9 | var RSF_HOST = "http://rsf.qbox.me"
10 |
11 | var PUB_HOST = "http://pub.qbox.me"
12 | var IO_HOST = "http://iovip.qbox.me"
13 |
14 | var ACCESS_KEY string
15 | var SECRET_KEY string
16 |
17 | func SetUserAgent(userAgent string) {
18 | rpc.UserAgent = userAgent
19 | }
20 |
21 | func init() {
22 | SetUserAgent("qiniu go-sdk v6.0.0")
23 | }
24 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/error.go:
--------------------------------------------------------------------------------
1 | package xorm
2 |
3 | import (
4 | "errors"
5 | )
6 |
7 | var (
8 | ErrParamsType error = errors.New("Params type error")
9 | ErrTableNotFound error = errors.New("Not found table")
10 | ErrUnSupportedType error = errors.New("Unsupported type error")
11 | ErrNotExist error = errors.New("Not exist error")
12 | ErrCacheFailed error = errors.New("Cache failed")
13 | ErrNeedDeletedCond error = errors.New("Delete need at least one condition")
14 | ErrNotImplemented error = errors.New("Not implemented.")
15 | )
16 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/templates/c++/class.h.tpl:
--------------------------------------------------------------------------------
1 | {{ range .Imports}}
2 | #include {{.}}
3 | {{ end }}
4 |
5 | {{range .Tables}}class {{Mapper .Name}} {
6 | {{$table := .}}
7 | public:
8 | {{range .Columns}}{{$name := Mapper .Name}} {{Type .}} Get{{Mapper .Name}}() {
9 | return this->m_{{UnTitle $name}};
10 | }
11 |
12 | void Set{{$name}}({{Type .}} {{UnTitle $name}}) {
13 | this->m_{{UnTitle $name}} = {{UnTitle $name}};
14 | }
15 |
16 | {{end}}private:
17 | {{range .Columns}}{{$name := Mapper .Name}} {{Type .}} m_{{UnTitle $name}};
18 | {{end}}
19 | }
20 |
21 | {{end}}
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/rand.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "crypto/rand"
5 | )
6 |
7 | // RandomCreateBytes generate random []byte by specify chars.
8 | func RandomCreateBytes(n int, alphabets ...byte) []byte {
9 | const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
10 | var bytes = make([]byte, n)
11 | rand.Read(bytes)
12 | for i, b := range bytes {
13 | if len(alphabets) == 0 {
14 | bytes[i] = alphanum[b%byte(len(alphanum))]
15 | } else {
16 | bytes[i] = alphabets[b%byte(len(alphabets))]
17 | }
18 | }
19 | return bytes
20 | }
21 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/logger.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "log"
5 | "net/http"
6 | "time"
7 | )
8 |
9 | // Logger returns a middleware handler that logs the request as it goes in and the response as it goes out.
10 | func Logger() Handler {
11 | return func(res http.ResponseWriter, req *http.Request, c Context, log *log.Logger) {
12 | start := time.Now()
13 | log.Printf("Started %s %s", req.Method, req.URL.Path)
14 |
15 | rw := res.(ResponseWriter)
16 | c.Next()
17 |
18 | log.Printf("Completed %v %s in %v\n", rw.Status(), http.StatusText(rw.Status()), time.Since(start))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/utils.go:
--------------------------------------------------------------------------------
1 | // utils.go
2 | package klog
3 |
4 | import (
5 | "os"
6 | "runtime"
7 | )
8 |
9 | func isTermOutput() (result bool) {
10 | switch runtime.GOOS {
11 | case "linux", "darwin":
12 | fi, _ := os.Stdout.Stat()
13 | return fi.Mode()&os.ModeCharDevice == os.ModeCharDevice
14 | case "windows":
15 | return os.Stdout.Fd() < 0xff
16 | }
17 | return false
18 | }
19 |
20 | //method, exists := l.color.getMethod(colorName)
21 | //if exists {
22 | // outstr = method.Func.Call([]reflect.Value{
23 | // reflect.ValueOf(l.color),
24 | // reflect.ValueOf(outstr)},
25 | // )[0].String()
26 | //}
27 |
--------------------------------------------------------------------------------
/utils/safemap.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "sync"
4 |
5 | type SafeMap struct {
6 | db map[string]interface{}
7 | sync.Mutex
8 | }
9 |
10 | func NewSafeMap() *SafeMap {
11 | return &SafeMap{
12 | db: make(map[string]interface{}),
13 | }
14 | }
15 |
16 | func (this *SafeMap) Set(key string, v interface{}) {
17 | this.Lock()
18 | defer this.Unlock()
19 | this.db[key] = v
20 | }
21 |
22 | func (this *SafeMap) Del(key string) {
23 | this.Lock()
24 | defer this.Unlock()
25 | delete(this.db, key)
26 | }
27 |
28 | func (this *SafeMap) Get(key string) (v interface{}) {
29 | this.Lock()
30 | defer this.Unlock()
31 | return this.db[key]
32 | }
33 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/example_test.go:
--------------------------------------------------------------------------------
1 | package sh_test
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/shxsun/go-sh"
7 | )
8 |
9 | func ExampleCommand() {
10 | out, err := sh.Command("echo", "hello").Output()
11 | fmt.Println(string(out), err)
12 | }
13 |
14 | func ExampleCommandPipe() {
15 | out, err := sh.Command("echo", "-n", "hi").Command("wc", "-c").Output()
16 | fmt.Println(string(out), err)
17 | }
18 |
19 | func ExampleCommandSetDir() {
20 | out, err := sh.Command("pwd", sh.Dir("/")).Output()
21 | fmt.Println(string(out), err)
22 | }
23 |
24 | func ExampleTest() {
25 | if sh.Test("dir", "mydir") {
26 | fmt.Println("mydir exists")
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/url.go:
--------------------------------------------------------------------------------
1 |
2 | package com
3 |
4 | import (
5 | "net/url"
6 | "encoding/base64"
7 | )
8 |
9 | // url encode string, is + not %20
10 | func UrlEncode(str string) string {
11 | s := url.QueryEscape(str)
12 | return s
13 | }
14 |
15 | // url decode string
16 | func UrlDecode(str string) (string, error) {
17 | return url.QueryUnescape(str)
18 | }
19 |
20 | // base64 encode
21 | func Base64Encode(str string) string {
22 | return base64.StdEncoding.EncodeToString([]byte(str))
23 | }
24 |
25 | // base64 decode
26 | func Base64Decode(str string) (string, error) {
27 | s, e := base64.StdEncoding.DecodeString(str)
28 | return string(s), e
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/bin/autobuild:
--------------------------------------------------------------------------------
1 | #!/bin/bash -
2 | #
3 |
4 | echo ARGS:"$#" "$@"
5 | PS4='$ '
6 | #export PATH=/bin:/usr/bin:/usr/local/bin:$GOPATH/bin:$HOME/bin:$PATH
7 |
8 | CURDIR=$(cd $(dirname $0); pwd)
9 |
10 | go version
11 | export
12 |
13 | export GOBIN="$GOBIN/${path}"
14 |
15 | set -eu -x # open debug
16 | cd "$GOPATH/src/$PROJECT"
17 |
18 | SHA=$(git rev-parse HEAD)
19 | go get -u -v
20 | CGO_ENABLED=0 go build
21 | gox '-os=linux windows darwin' '-arch=amd64 386' -output="$CURDIR/files/$PROJECT/$SHA/{{.OS}}_{{.Arch}}/{{.Dir}}"
22 |
23 | addr=$(cat "$CURDIR/app.ini" | grep "^serverAddr" | awk -F: '{print "127.0.0.1:" $2}' | xargs echo -n)
24 | curl -s -d "p=$PROJECT" -d "sha=$SHA" $addr/api/update
25 |
26 |
--------------------------------------------------------------------------------
/utils/broadcast_test.go:
--------------------------------------------------------------------------------
1 | // broadcast_test.go
2 | package utils
3 |
4 | import (
5 | "io"
6 | "io/ioutil"
7 | "testing"
8 | "time"
9 | )
10 |
11 | func TestBroadCast(t *testing.T) {
12 | broadcast := NewWriteBroadcaster()
13 | _, r1 := broadcast.NewReader("test")
14 | go func() {
15 | //io.Copy(os.Stdout, r1)
16 | r1.Close()
17 | }()
18 | broadcast.Write([]byte("abc"))
19 | time.Sleep(time.Millisecond * 500)
20 | bufstr, r2 := broadcast.NewReader("last reader")
21 | if string(bufstr) != "abc" {
22 | t.Errorf("expect []byte(abc), but got: []byte(%s)", string(bufstr))
23 | }
24 | go io.Copy(ioutil.Discard, r2)
25 | broadcast.Write([]byte("ABC"))
26 | broadcast.CloseWriters()
27 | }
28 |
--------------------------------------------------------------------------------
/utils/utils_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "errors"
5 | "testing"
6 | "time"
7 | )
8 |
9 | func TestGoTimeout(t *testing.T) {
10 | err := GoTimeout(func() error {
11 | return nil
12 | }, time.Second*1)
13 | if err != nil {
14 | t.Error(err)
15 | }
16 | }
17 |
18 | func TestGoTimeoutErr(t *testing.T) {
19 | var Err = errors.New("SampleErr")
20 | err := GoTimeout(func() error {
21 | return Err
22 | }, time.Second*1)
23 | if err != Err {
24 | t.Error(err)
25 | }
26 | }
27 |
28 | func TestGoTimeoutTimeout(t *testing.T) {
29 | err := GoTimeout(func() error {
30 | time.Sleep(1e8 * 2)
31 | return nil
32 | }, 1e8)
33 | if err != ErrTimeout {
34 | t.Error(err)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/test_test.go:
--------------------------------------------------------------------------------
1 | package sh
2 |
3 | import "testing"
4 |
5 | var s = NewSession()
6 |
7 | type T struct{ *testing.T }
8 |
9 | func NewT(t *testing.T) *T { return &T{t} }
10 |
11 | func (t *T) checkTest(exp string, arg string, result bool) {
12 | r := s.Test(exp, arg)
13 | if r != result {
14 | t.Errorf("test -%s %s, %v != %v", exp, arg, r, result)
15 | }
16 | }
17 | func TestTest(i *testing.T) {
18 | t := NewT(i)
19 | t.checkTest("d", "../go-sh", true)
20 | t.checkTest("d", "./yymm", false)
21 |
22 | t.checkTest("f", "./sh.go", true)
23 | t.checkTest("f", "../go-sh", false)
24 | t.checkTest("f", "./yymm", false)
25 |
26 | // t.checkTest("x", "lksjdf", false)
27 | }
28 |
--------------------------------------------------------------------------------
/utils/utils.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "log"
7 | "time"
8 |
9 | "github.com/codeskyblue/goyaml"
10 | )
11 |
12 | func Debugf(format string, a ...interface{}) {
13 | if false {
14 | log.Println("DEBUG: ", fmt.Sprintf(format, a...))
15 | }
16 | }
17 |
18 | var ErrTimeout = errors.New("timeout")
19 |
20 | func GoTimeout(f func() error, timeout time.Duration) (err error) {
21 | done := make(chan bool)
22 | go func() {
23 | err = f()
24 | done <- true
25 | }()
26 | select {
27 | case <-time.After(timeout):
28 | return ErrTimeout
29 | case <-done:
30 | return
31 | }
32 | }
33 |
34 | func Dump(a interface{}) {
35 | out, _ := goyaml.Marshal(a)
36 | fmt.Println(string(out))
37 | }
38 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/result.go:
--------------------------------------------------------------------------------
1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2 | //
3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public
6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7 | // You can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | package mysql
10 |
11 | type mysqlResult struct {
12 | affectedRows int64
13 | insertId int64
14 | }
15 |
16 | func (res *mysqlResult) LastInsertId() (int64, error) {
17 | return res.insertId, nil
18 | }
19 |
20 | func (res *mysqlResult) RowsAffected() (int64, error) {
21 | return res.affectedRows, nil
22 | }
23 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/appengine.go:
--------------------------------------------------------------------------------
1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2 | //
3 | // Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public
6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7 | // You can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | // +build appengine
10 |
11 | package mysql
12 |
13 | import (
14 | "appengine/cloudsql"
15 | "net"
16 | )
17 |
18 | func init() {
19 | if dials == nil {
20 | dials = make(map[string]dialFunc)
21 | }
22 | dials["cloudsql"] = func(cfg *config) (net.Conn, error) {
23 | return cloudsql.Dial(cfg.addr)
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/utils/namelock.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "sync"
4 |
5 | var (
6 | namelock = &sync.Mutex{}
7 | namelist = make(map[string]*sync.Mutex)
8 | )
9 |
10 | type NameLock struct {
11 | name string
12 | mu *sync.Mutex
13 | }
14 |
15 | func NewNameLock(name string) *NameLock {
16 | namelock.Lock()
17 | defer namelock.Unlock()
18 |
19 | mu := namelist[name]
20 | if mu == nil {
21 | mu = &sync.Mutex{}
22 | namelist[name] = mu
23 | }
24 | return &NameLock{
25 | name: name,
26 | mu: mu,
27 | }
28 | }
29 |
30 | func (l *NameLock) Lock() {
31 | l.mu.Lock()
32 | }
33 |
34 | func (l *NameLock) Unlock() {
35 | //namelock.Lock()
36 | //defer namelock.Unlock()
37 | // FIXME: I dont know if need to delete from namelist
38 | l.mu.Unlock()
39 | }
40 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-websocket/examplehandler_test.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 websocket_test
6 |
7 | import (
8 | "io"
9 | "net/http"
10 |
11 | "code.google.com/p/go.net/websocket"
12 | )
13 |
14 | // Echo the data received on the WebSocket.
15 | func EchoServer(ws *websocket.Conn) {
16 | io.Copy(ws, ws)
17 | }
18 |
19 | // This example demonstrates a trivial echo server.
20 | func ExampleHandler() {
21 | http.Handle("/echo", websocket.Handler(EchoServer))
22 | err := http.ListenAndServe(":12345", nil)
23 | if err != nil {
24 | panic("ListenAndServe: " + err.Error())
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/logger_test.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "bytes"
5 | "log"
6 | "net/http"
7 | "net/http/httptest"
8 | "testing"
9 | )
10 |
11 | func Test_Logger(t *testing.T) {
12 | buff := bytes.NewBufferString("")
13 | recorder := httptest.NewRecorder()
14 |
15 | m := New()
16 | // replace log for testing
17 | m.Map(log.New(buff, "[martini] ", 0))
18 | m.Use(Logger())
19 | m.Use(func(res http.ResponseWriter) {
20 | res.WriteHeader(http.StatusNotFound)
21 | })
22 |
23 | req, err := http.NewRequest("GET", "http://localhost:3000/foobar", nil)
24 | if err != nil {
25 | t.Error(err)
26 | }
27 |
28 | m.ServeHTTP(recorder, req)
29 | expect(t, recorder.Code, http.StatusNotFound)
30 | refute(t, len(buff.String()), 0)
31 | }
32 |
--------------------------------------------------------------------------------
/search_api.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "github.com/Unknwon/com"
5 | "net/http"
6 | )
7 |
8 | var searchApi = "https://gowalker.org/api/v1/search?key={keyword}&gorepo=false&gosubrepo=false&cmd=true&cgo=false"
9 |
10 | type SearchItem struct {
11 | Name string `json:"project_name"`
12 | Path string `json:"project_path"`
13 | HomePage string `json:"homepage"`
14 | ImportPath string `json:"import_path"`
15 | }
16 |
17 | type SearchPackages struct {
18 | Packages []*SearchItem `json:"packages"`
19 | }
20 |
21 | func NewSearch(key string) (*SearchPackages, error) {
22 | url := com.Expand(searchApi, map[string]string{
23 | "keyword": key,
24 | })
25 | packages := new(SearchPackages)
26 | err := com.HttpGetJSON(&http.Client{}, url, packages)
27 | return packages, err
28 | }
29 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/goyaml/Makefile:
--------------------------------------------------------------------------------
1 | include $(GOROOT)/src/Make.inc
2 |
3 | YAML=yaml-0.1.3
4 | LIBYAML=$(PWD)/$(YAML)/src/.libs/libyaml.a
5 |
6 | TARG=launchpad.net/goyaml
7 |
8 | GOFILES=\
9 | goyaml.go\
10 | resolve.go\
11 |
12 | CGOFILES=\
13 | decode.go\
14 | encode.go\
15 |
16 | CGO_OFILES+=\
17 | helpers.o\
18 | api.o\
19 | scanner.o\
20 | reader.o\
21 | parser.o\
22 | writer.o\
23 | emitter.o\
24 |
25 | GOFMT=gofmt
26 |
27 | BADFMT:=$(shell $(GOFMT) -l $(GOFILES) $(CGOFILES) $(wildcard *_test.go))
28 |
29 | all: package
30 | gofmt: $(BADFMT)
31 | @for F in $(BADFMT); do $(GOFMT) -w $$F && echo $$F; done
32 |
33 | include $(GOROOT)/src/Make.pkg
34 |
35 | ifneq ($(BADFMT),)
36 | ifneq ($(MAKECMDGOALS),gofmt)
37 | $(warning WARNING: make gofmt: $(BADFMT))
38 | endif
39 | endif
40 |
--------------------------------------------------------------------------------
/templates/search.tmpl:
--------------------------------------------------------------------------------
1 | {{if lt .PackagesLength 1}}
2 |
Sorry, no package found about "{{.Keyword}}"
{{else}}
3 |
We've found {{.PackagesLength}} packages about "{{.Keyword}}"
{{end}}{{if .Error}}
4 |
Search API Error: {{.Error}}
{{end}}
5 |
14 |
Thanks GoWalker Search API support.
15 |
--------------------------------------------------------------------------------
/utils/tmpfile.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "math/rand"
5 | "os"
6 | "path/filepath"
7 | "strconv"
8 | "time"
9 | )
10 |
11 | func randString() string {
12 | return strconv.Itoa(rand.Int() % 100000)
13 | }
14 | func reseed() {
15 | seed := uint32(time.Now().UnixNano() + int64(os.Getpid()))
16 | rand.Seed(int64(seed))
17 | }
18 |
19 | func TempFile(dir, prefix, suffix string) (name string, err error) {
20 | if dir == "" {
21 | dir = os.TempDir()
22 | }
23 |
24 | var f *os.File
25 | nconflict := 0
26 | for i := 0; i < 10000; i++ {
27 | name = filepath.Join(dir, prefix+randString()+suffix)
28 | f, err = os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
29 | if os.IsExist(err) {
30 | if nconflict++; nconflict > 10 {
31 | reseed()
32 | }
33 | continue
34 | }
35 | f.Close()
36 | break
37 | }
38 | return
39 | }
40 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-websocket/exampledial_test.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 websocket_test
6 |
7 | import (
8 | "fmt"
9 | "log"
10 |
11 | "code.google.com/p/go.net/websocket"
12 | )
13 |
14 | // This example demonstrates a trivial client.
15 | func ExampleDial() {
16 | origin := "http://localhost/"
17 | url := "ws://localhost:12345/ws"
18 | ws, err := websocket.Dial(url, "", origin)
19 | if err != nil {
20 | log.Fatal(err)
21 | }
22 | if _, err := ws.Write([]byte("hello, world!\n")); err != nil {
23 | log.Fatal(err)
24 | }
25 | var msg = make([]byte, 512)
26 | var n int
27 | if n, err = ws.Read(msg); err != nil {
28 | log.Fatal(err)
29 | }
30 | fmt.Printf("Received: %s.\n", msg[:n])
31 | }
32 |
--------------------------------------------------------------------------------
/bin/gobuild.io.nginx:
--------------------------------------------------------------------------------
1 | upstream gobuild {
2 | server 127.0.0.1:3000;
3 | }
4 | server {
5 | server_name gobuild.io build.golangtc.com build.gopm.io;
6 |
7 | if ($host != "gobuild.io"){
8 | rewrite ^/(.*)$ http://gobuild.io/$1 permanent;
9 | }
10 | #listen 80;
11 | listen 443;
12 | ssl on;
13 | ssl_certificate /var/go/gobuild/bin/ssl.crt;
14 | ssl_certificate_key /var/go/gobuild/bin/ssl.key;
15 |
16 | location / {
17 | proxy_pass_header Server;
18 | proxy_set_header Host $http_host;
19 | proxy_redirect off;
20 | proxy_set_header X-Real-IP $remote_addr;
21 | proxy_set_header X-Scheme $scheme;
22 | proxy_set_header X-Forwarded-Proto https;
23 | proxy_pass http://gobuild;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/transaction.go:
--------------------------------------------------------------------------------
1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2 | //
3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public
6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7 | // You can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | package mysql
10 |
11 | type mysqlTx struct {
12 | mc *mysqlConn
13 | }
14 |
15 | func (tx *mysqlTx) Commit() (err error) {
16 | if tx.mc == nil || tx.mc.netConn == nil {
17 | return errInvalidConn
18 | }
19 | err = tx.mc.exec("COMMIT")
20 | tx.mc = nil
21 | return
22 | }
23 |
24 | func (tx *mysqlTx) Rollback() (err error) {
25 | if tx.mc == nil || tx.mc.netConn == nil {
26 | return errInvalidConn
27 | }
28 | err = tx.mc.exec("ROLLBACK")
29 | tx.mc = nil
30 | return
31 | }
32 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/captcha/image_test.go:
--------------------------------------------------------------------------------
1 | package captcha
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/astaxie/beego/utils"
7 | )
8 |
9 | type byteCounter struct {
10 | n int64
11 | }
12 |
13 | func (bc *byteCounter) Write(b []byte) (int, error) {
14 | bc.n += int64(len(b))
15 | return len(b), nil
16 | }
17 |
18 | func BenchmarkNewImage(b *testing.B) {
19 | b.StopTimer()
20 | d := utils.RandomCreateBytes(challengeNums, defaultChars...)
21 | b.StartTimer()
22 | for i := 0; i < b.N; i++ {
23 | NewImage(d, stdWidth, stdHeight)
24 | }
25 | }
26 |
27 | func BenchmarkImageWriteTo(b *testing.B) {
28 | b.StopTimer()
29 | d := utils.RandomCreateBytes(challengeNums, defaultChars...)
30 | b.StartTimer()
31 | counter := &byteCounter{}
32 | for i := 0; i < b.N; i++ {
33 | img := NewImage(d, stdWidth, stdHeight)
34 | img.WriteTo(counter)
35 | b.SetBytes(counter.n)
36 | counter.n = 0
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/errors_test.go:
--------------------------------------------------------------------------------
1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2 | //
3 | // Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public
6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7 | // You can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | package mysql
10 |
11 | import (
12 | "bytes"
13 | "log"
14 | "testing"
15 | )
16 |
17 | func TestSetLogger(t *testing.T) {
18 | previous := errLog
19 | defer func() {
20 | errLog = previous
21 | }()
22 | const expected = "prefix: test\n"
23 | buffer := bytes.NewBuffer(make([]byte, 0, 64))
24 | logger := log.New(buffer, "prefix: ", 0)
25 | SetLogger(logger)
26 | errLog.Print("test")
27 | if actual := buffer.String(); actual != expected {
28 | t.Errorf("expected %q, got %q", expected, actual)
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/pool.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "github.com/lunny/xorm"
6 | _ "github.com/mattn/go-sqlite3"
7 | "os"
8 | )
9 |
10 | type User struct {
11 | Id int64
12 | Name string
13 | }
14 |
15 | func main() {
16 | f := "pool.db"
17 | os.Remove(f)
18 |
19 | Orm, err := NewEngine("sqlite3", f)
20 | if err != nil {
21 | fmt.Println(err)
22 | return
23 | }
24 | err = Orm.SetPool(NewSimpleConnectPool())
25 | if err != nil {
26 | fmt.Println(err)
27 | return
28 | }
29 |
30 | Orm.ShowSQL = true
31 | err = Orm.CreateTables(&User{})
32 | if err != nil {
33 | fmt.Println(err)
34 | return
35 | }
36 |
37 | for i := 0; i < 10; i++ {
38 | _, err = Orm.Get(&User{})
39 | if err != nil {
40 | fmt.Println(err)
41 | break
42 | }
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/mail_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import "testing"
4 |
5 | func TestMail(t *testing.T) {
6 | config := `{"username":"astaxie@gmail.com","password":"astaxie","host":"smtp.gmail.com","port":587}`
7 | mail := NewEMail(config)
8 | if mail.Username != "astaxie@gmail.com" {
9 | t.Fatal("email parse get username error")
10 | }
11 | if mail.Password != "astaxie" {
12 | t.Fatal("email parse get password error")
13 | }
14 | if mail.Host != "smtp.gmail.com" {
15 | t.Fatal("email parse get host error")
16 | }
17 | if mail.Port != 587 {
18 | t.Fatal("email parse get port error")
19 | }
20 | mail.To = []string{"xiemengjun@gmail.com"}
21 | mail.From = "astaxie@gmail.com"
22 | mail.Subject = "hi, just from beego!"
23 | mail.Text = "Text Body is, of course, supported!"
24 | mail.HTML = "Fancy Html is supported, too!
"
25 | mail.AttachFile("/Users/astaxie/github/beego/beego.go")
26 | mail.Send()
27 | }
28 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/captcha/README.md:
--------------------------------------------------------------------------------
1 | # Captcha
2 |
3 | an example for use captcha
4 |
5 | ```
6 | package controllers
7 |
8 | import (
9 | "github.com/astaxie/beego"
10 | "github.com/astaxie/beego/cache"
11 | "github.com/astaxie/beego/utils/captcha"
12 | )
13 |
14 | var cpt *captcha.Captcha
15 |
16 | func init() {
17 | // use beego cache system store the captcha data
18 | store := cache.NewMemoryCache()
19 | cpt = captcha.NewWithFilter("/captcha/", store)
20 | }
21 |
22 | type MainController struct {
23 | beego.Controller
24 | }
25 |
26 | func (this *MainController) Get() {
27 | this.TplNames = "index.tpl"
28 | }
29 |
30 | func (this *MainController) Post() {
31 | this.TplNames = "index.tpl"
32 |
33 | this.Data["Success"] = cpt.VerifyReq(this.Ctx.Request)
34 | }
35 | ```
36 |
37 | template usage
38 |
39 | ```
40 | {{.Success}}
41 |
45 | ```
46 |
--------------------------------------------------------------------------------
/upload.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "io/ioutil"
5 | "os/exec"
6 | "path/filepath"
7 |
8 | "github.com/qiniu/api.v6/io"
9 | "github.com/qiniu/api.v6/rs"
10 | )
11 |
12 | const SCOPE = "gobuild-io"
13 |
14 | func UploadFile(localFile string, destName string) (addr string, err error) {
15 | policy := new(rs.PutPolicy)
16 | policy.Scope = "gobuild-io"
17 | uptoken := policy.Token(nil)
18 |
19 | var ret io.PutRet
20 | var extra = new(io.PutExtra)
21 | err = io.PutFile(nil, &ret, uptoken, destName, localFile, extra)
22 | if err != nil {
23 | return
24 | }
25 | addr = "http://" + SCOPE + ".qiniudn.com/" + destName
26 | return
27 | }
28 |
29 | func UploadLocal(file string) (addr string, err error) {
30 | f, err := ioutil.TempFile("files/", "upload-")
31 | if err != nil {
32 | return
33 | }
34 | err = f.Close()
35 | if err != nil {
36 | return
37 | }
38 | exec.Command("cp", "-f", file, f.Name()).Run()
39 | addr = "http://" + filepath.Join(opts.Hostname, f.Name())
40 | return
41 | }
42 |
--------------------------------------------------------------------------------
/public/js/common-gobuild.js:
--------------------------------------------------------------------------------
1 | /* command js function */
2 | var getosarch = function(){
3 | var mapOS = {m:"darwin", l:"linux", w:"windows"};
4 | var mapArch = {darwin:"amd64", linux:"amd64", windows:"386"};
5 | var platform = navigator.platform;
6 | var goos = mapOS[platform.toLowerCase().substring(0, 1)] || "linux";
7 | var goarch = mapArch[goos];
8 | return {os: goos, arch: goarch};
9 | }
10 |
11 | function renderMarkdown() {
12 | var $md = $('.markdown');
13 | $md.each(function (i, item) {
14 | $(item).html(marked($(item).html().replace(/>/g, '>')));
15 | });
16 | var code = $md.find('pre code');
17 | if (code.length) {
18 | $("").attr({ rel: "stylesheet", type: "text/css", href: "/css/highlight.css"}).appendTo("head");
19 | $.getScript("/js/highlight.min.js", function () {
20 | code.each(function (i, item) {
21 | hljs.highlightBlock(item)
22 | });
23 | });
24 | }
25 | }
26 |
27 | $(function(){
28 | renderMarkdown();
29 | });
30 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/version4.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 uuid
6 |
7 | // Random returns a Random (Version 4) UUID or panics.
8 | //
9 | // The strength of the UUIDs is based on the strength of the crypto/rand
10 | // package.
11 | //
12 | // A note about uniqueness derived from from the UUID Wikipedia entry:
13 | //
14 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being
15 | // hit by a meteorite is estimated to be one chance in 17 billion, that
16 | // means the probability is about 0.00000000006 (6 × 10−11),
17 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a
18 | // year and having one duplicate.
19 | func NewRandom() UUID {
20 | uuid := make([]byte, 16)
21 | randomBits([]byte(uuid))
22 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
23 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
24 | return uuid
25 | }
26 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/api/rs/token_test.go:
--------------------------------------------------------------------------------
1 | package rs
2 |
3 | import (
4 | "io"
5 | "testing"
6 | "net/http"
7 | "crypto/sha1"
8 | "encoding/base64"
9 | )
10 |
11 | func init() {
12 | client = New(nil)
13 | client.Delete(nil, bucketName, key)
14 | }
15 |
16 | func TestGetPrivateUrl(t *testing.T) {
17 |
18 | //上传一个文件用用于测试
19 | err := upFile("token.go", bucketName, key)
20 | if err != nil {
21 | t.Fatal(err)
22 | }
23 | defer client.Delete(nil, bucketName, key)
24 |
25 | baseUrl := MakeBaseUrl(domain, key)
26 |
27 | policy := GetPolicy{}
28 | privateUrl := policy.MakeRequest(baseUrl, nil)
29 |
30 | resp, err := http.Get(privateUrl)
31 | if err != nil {
32 | t.Fatal("http.Get failed:", err)
33 | }
34 | defer resp.Body.Close()
35 |
36 | h := sha1.New()
37 | io.Copy(h, resp.Body)
38 | etagExpected := base64.URLEncoding.EncodeToString(h.Sum([]byte{'\x16'}))
39 |
40 | etag := resp.Header.Get("Etag")
41 | if etag[1:len(etag)-1] != etagExpected {
42 | t.Fatal("http.Get etag failed:", etag, etagExpected)
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/processors.go:
--------------------------------------------------------------------------------
1 | package xorm
2 |
3 | // Executed before an object is initially persisted to the database
4 | type BeforeInsertProcessor interface {
5 | BeforeInsert()
6 | }
7 |
8 | // Executed before an object is updated
9 | type BeforeUpdateProcessor interface {
10 | BeforeUpdate()
11 | }
12 |
13 | // Executed before an object is deleted
14 | type BeforeDeleteProcessor interface {
15 | BeforeDelete()
16 | }
17 |
18 | // !nashtsai! TODO enable BeforeValidateProcessor when xorm start to support validations
19 | //// Executed before an object is validated
20 | //type BeforeValidateProcessor interface {
21 | // BeforeValidate()
22 | //}
23 | // --
24 |
25 | // Executed after an object is persisted to the database
26 | type AfterInsertProcessor interface {
27 | AfterInsert()
28 | }
29 |
30 | // Executed after an object has been updated
31 | type AfterUpdateProcessor interface {
32 | AfterUpdate()
33 | }
34 |
35 | // Executed after an object has been deleted
36 | type AfterDeleteProcessor interface {
37 | AfterDelete()
38 | }
39 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/example/example1.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "log"
6 |
7 | "github.com/shxsun/go-sh"
8 | )
9 |
10 | func main() {
11 | sh.Command("echo", "hello").Run()
12 | out, err := sh.Command("echo", "hello").Output()
13 | if err != nil {
14 | log.Fatal(err)
15 | }
16 | fmt.Println("output is", string(out))
17 |
18 | var a int
19 | sh.Command("echo", "2").UnmarshalJSON(&a)
20 | fmt.Println("a =", a)
21 |
22 | s := sh.NewSession()
23 | s.Alias("hi", "echo", "hi")
24 | s.Command("hi", "boy").Run()
25 |
26 | fmt.Print("pwd = ")
27 | s.Command("pwd", sh.Dir("/")).Run()
28 |
29 | if !sh.Test("dir", "data") {
30 | sh.Command("echo", "mkdir", "data").Run()
31 | }
32 |
33 | sh.Command("echo", "hello", "world").
34 | Command("awk", `{print "second arg is "$2}`).Run()
35 | s.ShowCMD = true
36 | s.Command("echo", "hello", "world").
37 | Command("awk", `{print "second arg is "$2}`).Run()
38 |
39 | s.SetEnv("BUILD_ID", "123").Command("bash", "-c", "echo $BUILD_ID").Run()
40 | s.Command("bash", "-c", "echo current shell is $SHELL").Run()
41 | }
42 |
--------------------------------------------------------------------------------
/publish/upload.go:
--------------------------------------------------------------------------------
1 | package publish
2 |
3 | import (
4 | "io/ioutil"
5 | "os/exec"
6 | "path/filepath"
7 |
8 | "github.com/qiniu/api.v6/io"
9 | "github.com/qiniu/api.v6/rs"
10 | )
11 |
12 | //const SCOPE = "gobuild-io"
13 |
14 | var Bulket = "gobuild-io"
15 | var Hostname = "gobuild.io"
16 |
17 | //const HOSTNAME = "gobuild.io"
18 |
19 | func UploadFile(localFile string, destName string) (addr string, err error) {
20 | policy := new(rs.PutPolicy)
21 | policy.Scope = Bulket
22 | uptoken := policy.Token(nil)
23 |
24 | var ret io.PutRet
25 | var extra = new(io.PutExtra)
26 | err = io.PutFile(nil, &ret, uptoken, destName, localFile, extra)
27 | if err != nil {
28 | return
29 | }
30 | addr = "http://" + Bulket + ".qiniudn.com/" + destName
31 | return
32 | }
33 |
34 | func UploadLocal(file string) (addr string, err error) {
35 | f, err := ioutil.TempFile("files/", "upload-")
36 | if err != nil {
37 | return
38 | }
39 | err = f.Close()
40 | if err != nil {
41 | return
42 | }
43 | exec.Command("cp", "-f", file, f.Name()).Run()
44 | addr = "http://" + filepath.Join(Hostname, f.Name())
45 | return
46 | }
47 |
--------------------------------------------------------------------------------
/templates/dlscript.sh.tmpl:
--------------------------------------------------------------------------------
1 | #!/bin/bash -
2 | #
3 | # script for project github.com/codeskyblue/gobuild
4 | #
5 |
6 | server={{.Server}}
7 | [[ "$server" = "{{"."}}" ]] && server="127.0.0.1:3000"
8 | project={{.Project}}
9 | [[ "$project" = "{{"."}}" ]] && project="github.com/codeskyblue/fswatch"
10 |
11 | OS(){
12 | local os=
13 | case $(uname -s | awk '{print tolower($0)}') in
14 | linux) os=linux ;;
15 | darwin) os=darwin;;
16 | *) os=windows;;
17 | esac
18 | echo "$os"
19 | }
20 |
21 | Arch(){
22 | local arch=
23 | case $(uname -m) in
24 | x86_64) arch=amd64 ;;
25 | i386|i486|i586|i686) arch=386 ;;
26 | *) arch=unknown;;
27 | esac
28 | echo "$arch"
29 | }
30 |
31 | set -eu
32 | os=$(OS)
33 | arch=$(Arch)
34 |
35 | printf "=== os: %s, arch: %s\n" "$os" "$arch"
36 |
37 | ext=
38 | [[ "$os" = "windows" ]] && ext=".exe"
39 |
40 | basename=$(basename $project)
41 | fullname="${basename}${ext}"
42 | #wget "$CDN/$project/$fullname" -O $basename && chmod +x $basename
43 | curl -o "$fullname" -SL "http://$server/dl?p=$project&os=$os&arch=$arch" && chmod +x "${fullname}" && echo "success download -- ${fullname}"
44 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/README.md:
--------------------------------------------------------------------------------
1 | Common functions
2 | ===
3 |
4 | [](https://drone.io/github.com/Unknwon/com/latest) [](http://gowalker.org/github.com/Unknwon/com)
5 |
6 | This is an open source project for commonly used functions for the Go programming language.
7 |
8 | This package need >= **go 1.2rc1**
9 |
10 | ## Contribute
11 |
12 | Your contribute is welcome, but you have to check following steps after you added some functions and commit them:
13 |
14 | 1. Make sure you wrote user-friendly comments for **all functions** .
15 | 2. Make sure you wrote test cases with any possible condition for **all functions** in file `*_test.go`.
16 | 3. Make sure you wrote benchmarks for **all functions** in file `*_test.go`.
17 | 4. Make sure you wrote useful examples for **all functions** in file `example_test.go`.
18 | 5. Make sure you ran `go test -bench="."` and got **PASS** .
19 |
20 | ## Performance
21 |
22 | See results on [drone.io](https://drone.io/github.com/Unknwon/com/latest) by `go test -bench="."`.
23 |
--------------------------------------------------------------------------------
/bin/build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -o errexit
4 | set -o pipefail
5 |
6 | export PATH="/usr/local/bin:/usr/bin:/bin:$GOROOT/bin"
7 |
8 | set -x
9 | # args
10 | PROJECT=$1
11 | echo "Project $PROJECT"
12 |
13 | # determine root
14 | root=$(cd $(dirname $0); pwd)
15 |
16 | echo "Creating GOPATH"
17 | gopath=$(mktemp -d $root/goroot_XXXX)
18 | export GOPATH="$gopath"
19 | trap 'echo Cleaning; rm -fr $gopath' EXIT
20 |
21 | echo "Downlaoding $PROJECT"
22 | go get -d "$PROJECT"
23 |
24 | # clone the specified ref
25 | cd $GOPATH/src/$PROJECT
26 | if [[ ! -z $REF ]]; then
27 | git fetch origin
28 | git checkout $REF
29 | fi
30 |
31 | # set up godeps
32 | if [ -f Godeps ]; then
33 | go get github.com/kr/godep
34 | alias go="$GOPATH/bin/godep go"
35 | fi
36 |
37 | #echo "Setting version to $VERSION"
38 | # FIXME: todo
39 |
40 | echo "Compiling"
41 | go get .
42 |
43 | if [ -d $GOPATH/bin/${GOOS}_${GOARCH} ]; then
44 | BINARY="$(ls -1 $GOPATH/bin/${GOOS}_${GOARCH}/$(echo $PROJECT | cut -d/ -f3)*)"
45 | else
46 | BINARY="$GOPATH/bin/$(echo $PROJECT | cut -d/ -f3)"
47 | fi
48 |
49 | echo "Uploading binary"
50 | curl -X POST -T "$BINARY" $BUILD_HOST/api/$BUILD_ID/binary
51 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/goyaml/LICENSE.libyaml:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Kirill Simonov
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/public/js/site.js:
--------------------------------------------------------------------------------
1 | function initHomeEvent() {
2 | var $ipt = $('#go-ipt'),
3 | $iptTip = $('#go-ipt-tip'),
4 | typeInTip = "Please type in search keywords or project address",
5 | prjTip = "Please type in project address in github.com";
6 | $('#go-form').on("submit", function () {
7 | $('#go-search').trigger("click");
8 | return false;
9 | });
10 | $('#go-search').on("click", function (e) {
11 | e.preventDefault();
12 | if (!$ipt.val()) {
13 | $iptTip.text(typeInTip).show(200);
14 | $ipt.focus();
15 | return;
16 | }
17 | window.location = "/search/" + $ipt.val();
18 | });
19 | $("#go-download").on('click', (function (e) {
20 | e.preventDefault();
21 | if (!$ipt.val()) {
22 | $iptTip.text(typeInTip).show(200);
23 | $ipt.focus();
24 | return;
25 | }
26 | if ($ipt.val().toString().indexOf("github.com/") == -1) {
27 | $iptTip.text(prjTip).show(200);
28 | $ipt.focus();
29 | return;
30 | }
31 | window.location = "/download/" + $ipt.val();
32 | }));
33 | }
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/aybabtme/color/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2013, Antoine Grondin.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all 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,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/inject/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Jeremy Saenz
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/codegangsta/martini/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Jeremy Saenz
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 |
--------------------------------------------------------------------------------
/utils/bufreader.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "bytes"
5 | "io"
6 | "sync"
7 | )
8 |
9 | type bufReader struct {
10 | sync.Mutex
11 | buf *bytes.Buffer
12 | reader io.Reader
13 | err error
14 | wait sync.Cond
15 | }
16 |
17 | func NewBufReader(r io.Reader) *bufReader {
18 | reader := &bufReader{
19 | buf: &bytes.Buffer{},
20 | reader: r,
21 | }
22 | reader.wait.L = &reader.Mutex
23 | go reader.drain()
24 | return reader
25 | }
26 |
27 | func (r *bufReader) drain() {
28 | buf := make([]byte, 1024)
29 | for {
30 | n, err := r.reader.Read(buf)
31 | r.Lock()
32 | if err != nil {
33 | r.err = err
34 | } else {
35 | r.buf.Write(buf[0:n])
36 | }
37 | r.wait.Signal()
38 | r.Unlock()
39 | if err != nil {
40 | break
41 | }
42 | }
43 | }
44 |
45 | func (r *bufReader) Read(p []byte) (n int, err error) {
46 | r.Lock()
47 | defer r.Unlock()
48 | for {
49 | n, err = r.buf.Read(p)
50 | if n > 0 {
51 | return n, err
52 | }
53 | if r.err != nil {
54 | return 0, r.err
55 | }
56 | r.wait.Wait()
57 | }
58 | }
59 |
60 | func (r *bufReader) Close() error {
61 | closer, ok := r.reader.(io.ReadCloser)
62 | if !ok {
63 | return nil
64 | }
65 | return closer.Close()
66 | }
67 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/html_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "testing"
19 | )
20 |
21 | func TestHtml2JS(t *testing.T) {
22 | htm := "Click me
\n\r"
23 | js := string(Html2JS([]byte(htm)))
24 | jsR := `Click me
\n`
25 | if js != jsR {
26 | t.Errorf("Html2JS:\n Expect => %s\n Got => %s\n", jsR, js)
27 | }
28 | }
29 |
30 | func BenchmarkHtml2JS(b *testing.B) {
31 | htm := "Click me
\n\r"
32 | for i := 0; i < b.N; i++ {
33 | Html2JS([]byte(htm))
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the official list of Go-MySQL-Driver authors for copyright purposes.
2 |
3 | # If you are submitting a patch, please add your name or the name of the
4 | # organization which holds the copyright to this list in alphabetical order.
5 |
6 | # Names should be added to this file as
7 | # Name
8 | # The email address is not required for organizations.
9 | # Please keep the list sorted.
10 |
11 |
12 | # Individual Persons
13 |
14 | Aaron Hopkins
15 | Arne Hormann
16 | Carlos Nieto
17 | DisposaBoy
18 | Frederick Mayle
19 | Hanno Braun
20 | James Harr
21 | Jian Zhen
22 | Julien Schmidt
23 | Leonardo YongUk Kim
24 | Lucas Liu
25 | Luke Scott
26 | Michael Woolnough
27 | Nicola Peduzzi
28 | Xiaobing Jiang
29 | Xiuming Chen
30 |
31 | # Organizations
32 |
33 | Barracuda Networks, Inc.
34 | Google Inc.
35 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/singlemapping.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "github.com/lunny/xorm"
6 | _ "github.com/mattn/go-sqlite3"
7 | "os"
8 | )
9 |
10 | type User struct {
11 | Id int64
12 | Name string
13 | }
14 |
15 | type LoginInfo struct {
16 | Id int64
17 | IP string
18 | UserId int64
19 | // timestamp should be updated by database, so only allow get from db
20 | TimeStamp string `xorm:"<-"`
21 | // assume
22 | Nonuse int `xorm:"->"`
23 | }
24 |
25 | func main() {
26 | f := "singleMapping.db"
27 | os.Remove(f)
28 |
29 | Orm, err := NewEngine("sqlite3", f)
30 | if err != nil {
31 | fmt.Println(err)
32 | return
33 | }
34 | Orm.ShowSQL = true
35 | err = Orm.CreateTables(&User{}, &LoginInfo{})
36 | if err != nil {
37 | fmt.Println(err)
38 | return
39 | }
40 |
41 | _, err = Orm.Insert(&User{1, "xlw"}, &LoginInfo{1, "127.0.0.1", 1, "", 23})
42 | if err != nil {
43 | fmt.Println(err)
44 | return
45 | }
46 |
47 | info := LoginInfo{}
48 | _, err = Orm.Id(1).Get(&info)
49 | if err != nil {
50 | fmt.Println(err)
51 | return
52 | }
53 | fmt.Println(info)
54 | }
55 |
--------------------------------------------------------------------------------
/public/fonts/fontello.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/lang.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "github.com/lunny/xorm"
5 | "io/ioutil"
6 | "strings"
7 | "text/template"
8 | )
9 |
10 | type LangTmpl struct {
11 | Funcs template.FuncMap
12 | Formater func(string) (string, error)
13 | GenImports func([]*xorm.Table) map[string]string
14 | }
15 |
16 | var (
17 | mapper = &xorm.SnakeMapper{}
18 | langTmpls = map[string]LangTmpl{
19 | "go": GoLangTmpl,
20 | "c++": CPlusTmpl,
21 | }
22 | )
23 |
24 | func loadConfig(f string) map[string]string {
25 | bts, err := ioutil.ReadFile(f)
26 | if err != nil {
27 | return nil
28 | }
29 | configs := make(map[string]string)
30 | lines := strings.Split(string(bts), "\n")
31 | for _, line := range lines {
32 | line = strings.TrimRight(line, "\r")
33 | vs := strings.Split(line, "=")
34 | if len(vs) == 2 {
35 | configs[strings.TrimSpace(vs[0])] = strings.TrimSpace(vs[1])
36 | }
37 | }
38 | return configs
39 | }
40 |
41 | func unTitle(src string) string {
42 | if src == "" {
43 | return ""
44 | }
45 |
46 | if len(src) == 1 {
47 | return strings.ToLower(string(src[0]))
48 | } else {
49 | return strings.ToLower(string(src[0])) + src[1:]
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/version1.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 uuid
6 |
7 | import (
8 | "encoding/binary"
9 | )
10 |
11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock
12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID
13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot
14 | // be set NewUUID returns nil. If clock sequence has not been set by
15 | // SetClockSequence then it will be set automatically. If GetTime fails to
16 | // return the current NewUUID returns nil.
17 | func NewUUID() UUID {
18 | if nodeID == nil {
19 | SetNodeInterface("")
20 | }
21 |
22 | now, err := GetTime()
23 | if err != nil {
24 | return nil
25 | }
26 |
27 | uuid := make([]byte, 16)
28 |
29 | time_low := uint32(now & 0xffffffff)
30 | time_mid := uint16((now >> 32) & 0xffff)
31 | time_hi := uint16((now >> 48) & 0x0fff)
32 | time_hi |= 0x1000 // Version 1
33 |
34 | binary.BigEndian.PutUint32(uuid[0:], time_low)
35 | binary.BigEndian.PutUint16(uuid[4:], time_mid)
36 | binary.BigEndian.PutUint16(uuid[6:], time_hi)
37 | binary.BigEndian.PutUint16(uuid[8:], clock_seq)
38 | copy(uuid[10:], nodeID)
39 |
40 | return uuid
41 | }
42 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/bytes/seekable/seekable.go:
--------------------------------------------------------------------------------
1 | package seekable
2 |
3 | import (
4 | "io"
5 | "errors"
6 | "io/ioutil"
7 | "net/http"
8 | "github.com/qiniu/bytes"
9 | )
10 |
11 | // ---------------------------------------------------
12 |
13 | type Seekabler interface {
14 | Bytes() []byte
15 | Read(val []byte) (n int, err error)
16 | SeekToBegin() error
17 | }
18 |
19 | type SeekableCloser interface {
20 | Seekabler
21 | io.Closer
22 | }
23 |
24 | // ---------------------------------------------------
25 |
26 | type readCloser struct {
27 | Seekabler
28 | io.Closer
29 | }
30 |
31 | var ErrNoBody = errors.New("no body")
32 |
33 | func New(req *http.Request) (r SeekableCloser, err error) {
34 | if req.Body == nil {
35 | return nil, ErrNoBody
36 | }
37 | var ok bool
38 | if r, ok = req.Body.(SeekableCloser); ok {
39 | return
40 | }
41 | b, err2 := ReadAll(req)
42 | if err2 != nil {
43 | return nil, err2
44 | }
45 | r = bytes.NewReader(b)
46 | req.Body = readCloser{r, req.Body}
47 | return
48 | }
49 |
50 | func ReadAll(req *http.Request) (b []byte, err error) {
51 | if req.ContentLength > 0 {
52 | b = make([]byte, int(req.ContentLength))
53 | _, err = io.ReadFull(req.Body, b)
54 | return
55 | } else if req.ContentLength == 0 {
56 | return nil, ErrNoBody
57 | }
58 | return ioutil.ReadAll(req.Body)
59 | }
60 |
61 | // ---------------------------------------------------
62 |
63 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/aybabtme/color/sample/sample.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "github.com/aybabtme/color"
6 | "github.com/aybabtme/color/brush"
7 | "log"
8 | "os"
9 | )
10 |
11 | func main() {
12 | // Default Brush are available for your convenience. You can invoke
13 | // them directly
14 | fmt.Printf("This is %s\n", brush.Red("red"))
15 |
16 | // or you can create new ones!
17 | weird := color.NewBrush(color.PurplePaint, color.CyanPaint)
18 | fmt.Printf("This color is %s\n", weird("weird"))
19 |
20 | // Create a Style, which has convenience methods
21 | redBg := color.NewStyle(color.RedPaint, color.YellowPaint)
22 |
23 | // Style.WithForeground or WithBackground returns a new Style, with the applied
24 | // Paint. Styles are immutable so the original one is left unchanged
25 | greenFg := redBg.WithForeground(color.GreenPaint)
26 |
27 | // Style.Brush gives you a Brush that you can invoke directly to colorize strings.
28 | green := greenFg.Brush()
29 | fmt.Printf("This is %s but not really\n", green("kind of green"))
30 |
31 | // You can use it with all sorts of things
32 | sout := log.New(os.Stdout, "["+brush.Green("OK").String()+"]\t", log.LstdFlags)
33 | serr := log.New(os.Stderr, "["+brush.Red("OMG").String()+"]\t", log.LstdFlags)
34 |
35 | sout.Printf("Everything was going %s until...", brush.Cyan("fine"))
36 | serr.Printf("%s killed %s !!!", brush.Red("Locke"), brush.Blue("Jacob"))
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/return_handler.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "github.com/codegangsta/inject"
5 | "net/http"
6 | "reflect"
7 | )
8 |
9 | // ReturnHandler is a service that Martini provides that is called
10 | // when a route handler returns something. The ReturnHandler is
11 | // responsible for writing to the ResponseWriter based on the values
12 | // that are passed into this function.
13 | type ReturnHandler func(Context, []reflect.Value)
14 |
15 | func defaultReturnHandler() ReturnHandler {
16 | return func(ctx Context, vals []reflect.Value) {
17 | rv := ctx.Get(inject.InterfaceOf((*http.ResponseWriter)(nil)))
18 | res := rv.Interface().(http.ResponseWriter)
19 | var responseVal reflect.Value
20 | if len(vals) > 1 && vals[0].Kind() == reflect.Int {
21 | res.WriteHeader(int(vals[0].Int()))
22 | responseVal = vals[1]
23 | } else if len(vals) > 0 {
24 | responseVal = vals[0]
25 | }
26 | if canDeref(responseVal) {
27 | responseVal = responseVal.Elem()
28 | }
29 | if isByteSlice(responseVal) {
30 | res.Write(responseVal.Bytes())
31 | } else {
32 | res.Write([]byte(responseVal.String()))
33 | }
34 | }
35 | }
36 |
37 | func isByteSlice(val reflect.Value) bool {
38 | return val.Kind() == reflect.Slice && val.Type().Elem().Kind() == reflect.Uint8
39 | }
40 |
41 | func canDeref(val reflect.Value) bool {
42 | return val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr
43 | }
44 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/test.go:
--------------------------------------------------------------------------------
1 | package sh
2 |
3 | import (
4 | "os"
5 | "path/filepath"
6 | )
7 |
8 | func filetest(name string, modemask os.FileMode) (match bool, err error) {
9 | fi, err := os.Stat(name)
10 | if err != nil {
11 | return
12 | }
13 | match = (fi.Mode() & modemask) == modemask
14 | return
15 | }
16 |
17 | func (s *Session) pwd() string {
18 | dir := string(s.dir)
19 | if dir == "" {
20 | dir, _ = os.Getwd()
21 | }
22 | return dir
23 | }
24 |
25 | func (s *Session) abspath(name string) string {
26 | return filepath.Join(s.pwd(), name)
27 | }
28 |
29 | func init() {
30 | //log.SetFlags(log.Lshortfile | log.LstdFlags)
31 | }
32 |
33 | // expression can be dir, file, link
34 | func (s *Session) Test(expression string, argument string) bool {
35 | var err error
36 | var fi os.FileInfo
37 | fi, err = os.Stat(s.abspath(argument))
38 | switch expression {
39 | case "d", "dir":
40 | return err == nil && fi.IsDir()
41 | case "f", "file":
42 | return err == nil && fi.Mode().IsRegular()
43 | // case "x":
44 | // return err == nil && fi.Mode()&os.ModeExclusive != 0
45 | //case "h", "L":
46 | // return err == nil && fi.Mode()&os.ModeSymlink != 0
47 | case "link":
48 | return err == nil && fi.Mode()&os.ModeSymlink != 0
49 | }
50 | return false
51 | }
52 |
53 | // expression can be dir, file, link
54 | func Test(exp string, arg string) bool {
55 | s := NewSession()
56 | return s.Test(exp, arg)
57 | }
58 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/aybabtme/color/doc.go:
--------------------------------------------------------------------------------
1 | // Package color colorizes your terminal strings.
2 | //
3 | // Default Brush are available in sub-package brush for your convenience. You can invoke
4 | // them directly:
5 | //
6 | // fmt.Printf("This is %s\n", brush.Red("red"))
7 | //
8 | // ...or you can create new ones!
9 | //
10 | // weird := color.NewBrush(color.PurplePaint, color.CyanPaint)
11 | // fmt.Printf("This color is %s\n", weird("weird"))
12 | //
13 | // Create a Style, which has convenience methods :
14 | //
15 | // redBg := color.NewStyle(color.RedPaint, color.YellowPaint)
16 | //
17 | // Style.WithForeground or WithBackground returns a new Style, with the applied
18 | // Paint. Styles are immutable so the original one is left unchanged :
19 | //
20 | // greenFg := redBg.WithForeground(color.GreenPaint)
21 | //
22 | // Style.Brush gives you a Brush that you can invoke directly to colorize strings :
23 | //
24 | // green := greenFg.Brush()
25 | // fmt.Printf("This is %s but not really\n", green("kind of green"))
26 | //
27 | // You can use it with all sorts of things :
28 | //
29 | // sout := log.New(os.Stdout, "["+brush.Green("OK").String()+"]\t", log.LstdFlags)
30 | // serr := log.New(os.Stderr, "["+brush.Red("OMG").String()+"]\t", log.LstdFlags)
31 | //
32 | // sout.Printf("Everything was going %s until...", brush.Cyan("fine"))
33 | // serr.Printf("%s killed %s !!!", brush.Red("Locke"), brush.Blue("Jacob"))
34 | //
35 | // That's it!
36 | package color
37 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/codegangsta/martini/recovery_test.go:
--------------------------------------------------------------------------------
1 | package martini
2 |
3 | import (
4 | "bytes"
5 | "log"
6 | "net/http"
7 | "net/http/httptest"
8 | "testing"
9 | )
10 |
11 | func Test_Recovery(t *testing.T) {
12 | buff := bytes.NewBufferString("")
13 | recorder := httptest.NewRecorder()
14 |
15 | setENV(Dev)
16 | m := New()
17 | // replace log for testing
18 | m.Map(log.New(buff, "[martini] ", 0))
19 | m.Use(func(res http.ResponseWriter, req *http.Request) {
20 | res.Header().Set("Content-Type", "unpredictable")
21 | })
22 | m.Use(Recovery())
23 | m.Use(func(res http.ResponseWriter, req *http.Request) {
24 | panic("here is a panic!")
25 | })
26 | m.ServeHTTP(recorder, (*http.Request)(nil))
27 | expect(t, recorder.Code, http.StatusInternalServerError)
28 | expect(t, recorder.HeaderMap.Get("Content-Type"), "text/html")
29 | refute(t, recorder.Body.Len(), 0)
30 | refute(t, len(buff.String()), 0)
31 | }
32 |
33 | func Test_Recovery_ResponseWriter(t *testing.T) {
34 | recorder := httptest.NewRecorder()
35 | recorder2 := httptest.NewRecorder()
36 |
37 | setENV(Dev)
38 | m := New()
39 | m.Use(Recovery())
40 | m.Use(func(c Context) {
41 | c.MapTo(recorder2, (*http.ResponseWriter)(nil))
42 | panic("here is a panic!")
43 | })
44 | m.ServeHTTP(recorder, (*http.Request)(nil))
45 |
46 | expect(t, recorder2.Code, http.StatusInternalServerError)
47 | expect(t, recorder2.HeaderMap.Get("Content-Type"), "text/html")
48 | refute(t, recorder2.Body.Len(), 0)
49 | }
50 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/derive.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "github.com/lunny/xorm"
6 | _ "github.com/mattn/go-sqlite3"
7 | "os"
8 | )
9 |
10 | type User struct {
11 | Id int64
12 | Name string
13 | }
14 |
15 | type LoginInfo struct {
16 | Id int64
17 | IP string
18 | UserId int64
19 | }
20 |
21 | type LoginInfo1 struct {
22 | LoginInfo `xorm:"extends"`
23 | UserName string
24 | }
25 |
26 | func main() {
27 | f := "derive.db"
28 | os.Remove(f)
29 |
30 | Orm, err := NewEngine("sqlite3", f)
31 | if err != nil {
32 | fmt.Println(err)
33 | return
34 | }
35 | defer Orm.Close()
36 | Orm.ShowSQL = true
37 | err = Orm.CreateTables(&User{}, &LoginInfo{})
38 | if err != nil {
39 | fmt.Println(err)
40 | return
41 | }
42 |
43 | _, err = Orm.Insert(&User{1, "xlw"}, &LoginInfo{1, "127.0.0.1", 1})
44 | if err != nil {
45 | fmt.Println(err)
46 | return
47 | }
48 |
49 | info := LoginInfo{}
50 | _, err = Orm.Id(1).Get(&info)
51 | if err != nil {
52 | fmt.Println(err)
53 | return
54 | }
55 | fmt.Println(info)
56 |
57 | infos := make([]LoginInfo1, 0)
58 | err = Orm.Sql(`select *, (select name from user where id = login_info.user_id) as user_name from
59 | login_info limit 10`).Find(&infos)
60 | if err != nil {
61 | fmt.Println(err)
62 | return
63 | }
64 |
65 | fmt.Println(infos)
66 | }
67 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/file_test.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "path/filepath"
5 | "reflect"
6 | "testing"
7 | )
8 |
9 | var noExistedFile = "/tmp/not_existed_file"
10 |
11 | func TestSelfPath(t *testing.T) {
12 | path := SelfPath()
13 | if path == "" {
14 | t.Error("path cannot be empty")
15 | }
16 | t.Logf("SelfPath: %s", path)
17 | }
18 |
19 | func TestSelfDir(t *testing.T) {
20 | dir := SelfDir()
21 | t.Logf("SelfDir: %s", dir)
22 | }
23 |
24 | func TestFileExists(t *testing.T) {
25 | if !FileExists("./file.go") {
26 | t.Errorf("./file.go should exists, but it didn't")
27 | }
28 |
29 | if FileExists(noExistedFile) {
30 | t.Errorf("Wierd, how could this file exists: %s", noExistedFile)
31 | }
32 | }
33 |
34 | func TestSearchFile(t *testing.T) {
35 | path, err := SearchFile(filepath.Base(SelfPath()), SelfDir())
36 | if err != nil {
37 | t.Error(err)
38 | }
39 | t.Log(path)
40 |
41 | path, err = SearchFile(noExistedFile, ".")
42 | if err == nil {
43 | t.Errorf("err shouldnot be nil, got path: %s", SelfDir())
44 | }
45 | }
46 |
47 | func TestGrepFile(t *testing.T) {
48 | _, err := GrepFile("", noExistedFile)
49 | if err == nil {
50 | t.Error("expect file-not-existed error, but got nothing")
51 | }
52 |
53 | path := filepath.Join(".", "testdata", "grepe.test")
54 | lines, err := GrepFile(`^\s*[^#]+`, path)
55 | if err != nil {
56 | t.Error(err)
57 | }
58 | if !reflect.DeepEqual(lines, []string{"hello", "world"}) {
59 | t.Errorf("expect [hello world], but receive %v", lines)
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/filter.go:
--------------------------------------------------------------------------------
1 | package xorm
2 |
3 | import (
4 | "fmt"
5 | "strings"
6 | )
7 |
8 | // Filter is an interface to filter SQL
9 | type Filter interface {
10 | Do(sql string, session *Session) string
11 | }
12 |
13 | // PgSeqFilter filter SQL replace ?, ? ... to $1, $2 ...
14 | type PgSeqFilter struct {
15 | }
16 |
17 | func (s *PgSeqFilter) Do(sql string, session *Session) string {
18 | segs := strings.Split(sql, "?")
19 | size := len(segs)
20 | res := ""
21 | for i, c := range segs {
22 | if i < size-1 {
23 | res += c + fmt.Sprintf("$%v", i+1)
24 | }
25 | }
26 | res += segs[size-1]
27 | return res
28 | }
29 |
30 | // QuoteFilter filter SQL replace ` to database's own quote character
31 | type QuoteFilter struct {
32 | }
33 |
34 | func (s *QuoteFilter) Do(sql string, session *Session) string {
35 | return strings.Replace(sql, "`", session.Engine.QuoteStr(), -1)
36 | }
37 |
38 | // IdFilter filter SQL replace (id) to primary key column name
39 | type IdFilter struct {
40 | }
41 |
42 | func (i *IdFilter) Do(sql string, session *Session) string {
43 | if session.Statement.RefTable != nil && len(session.Statement.RefTable.PrimaryKeys) == 1 {
44 | sql = strings.Replace(sql, "`(id)`", session.Engine.Quote(session.Statement.RefTable.PrimaryKeys[0]), -1)
45 | sql = strings.Replace(sql, session.Engine.Quote("(id)"), session.Engine.Quote(session.Statement.RefTable.PrimaryKeys[0]), -1)
46 | return strings.Replace(sql, "(id)", session.Engine.Quote(session.Statement.RefTable.PrimaryKeys[0]), -1)
47 | }
48 | return sql
49 | }
50 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/safemap.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "sync"
5 | )
6 |
7 | type BeeMap struct {
8 | lock *sync.RWMutex
9 | bm map[interface{}]interface{}
10 | }
11 |
12 | // NewBeeMap return new safemap
13 | func NewBeeMap() *BeeMap {
14 | return &BeeMap{
15 | lock: new(sync.RWMutex),
16 | bm: make(map[interface{}]interface{}),
17 | }
18 | }
19 |
20 | // Get from maps return the k's value
21 | func (m *BeeMap) Get(k interface{}) interface{} {
22 | m.lock.RLock()
23 | defer m.lock.RUnlock()
24 | if val, ok := m.bm[k]; ok {
25 | return val
26 | }
27 | return nil
28 | }
29 |
30 | // Maps the given key and value. Returns false
31 | // if the key is already in the map and changes nothing.
32 | func (m *BeeMap) Set(k interface{}, v interface{}) bool {
33 | m.lock.Lock()
34 | defer m.lock.Unlock()
35 | if val, ok := m.bm[k]; !ok {
36 | m.bm[k] = v
37 | } else if val != v {
38 | m.bm[k] = v
39 | } else {
40 | return false
41 | }
42 | return true
43 | }
44 |
45 | // Returns true if k is exist in the map.
46 | func (m *BeeMap) Check(k interface{}) bool {
47 | m.lock.RLock()
48 | defer m.lock.RUnlock()
49 | if _, ok := m.bm[k]; !ok {
50 | return false
51 | }
52 | return true
53 | }
54 |
55 | // Delete the given key and value.
56 | func (m *BeeMap) Delete(k interface{}) {
57 | m.lock.Lock()
58 | defer m.lock.Unlock()
59 | delete(m.bm, k)
60 | }
61 |
62 | // Items returns all items in safemap.
63 | func (m *BeeMap) Items() map[interface{}]interface{} {
64 | m.lock.RLock()
65 | defer m.lock.RUnlock()
66 | return m.bm
67 | }
68 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 - 2014
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of the {organization} nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 Google Inc. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/docs/AutoMap.md:
--------------------------------------------------------------------------------
1 | When a struct auto mapping to a database's table, the below table describes how they change to each other:
2 |
3 |
4 |
5 | | go type's kind
6 | |
7 | value method |
8 | xorm type
9 | |
10 |
11 |
12 | | implemented Conversion |
13 | Conversion.ToDB / Conversion.FromDB |
14 | Text |
15 |
16 |
17 | | int, int8, int16, int32, uint, uint8, uint16, uint32 |
18 | |
19 | Int |
20 |
21 |
22 | | int64, uint64 | | BigInt |
23 |
24 | | float32 | | Float |
25 |
26 | | float64 | | Double |
27 |
28 | | complex64, complex128 |
29 | json.Marshal / json.UnMarshal |
30 | Varchar(64) |
31 |
32 |
33 | | []uint8 | | Blob |
34 |
35 |
36 | | array, slice, map except []uint8 |
37 | json.Marshal / json.UnMarshal |
38 | Text |
39 |
40 |
41 | | bool | 1 or 0 | Bool |
42 |
43 |
44 | | string | | Varchar(255) |
45 |
46 |
47 | | time.Time | | DateTime |
48 |
49 |
50 | | cascade struct | primary key field value | BigInt |
51 |
52 |
53 |
54 | | struct | json.Marshal / json.UnMarshal | Text |
55 |
56 |
57 | |
58 | Others
59 | |
60 | |
61 |
62 | Text
63 | |
64 |
65 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/klog/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013, shengxiang sun
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | Redistributions in binary form must reproduce the above copyright notice, this
11 | list of conditions and the following disclaimer in the documentation and/or
12 | other materials provided with the distribution.
13 |
14 | Neither the name of the {organization} nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/code.google.com/p/freetype-go/freetype/freetype_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Freetype-Go Authors. All rights reserved.
2 | // Use of this source code is governed by your choice of either the
3 | // FreeType License or the GNU General Public License version 2 (or
4 | // any later version), both of which can be found in the LICENSE file.
5 |
6 | package freetype
7 |
8 | import (
9 | "image"
10 | "image/draw"
11 | "io/ioutil"
12 | "runtime"
13 | "strings"
14 | "testing"
15 | )
16 |
17 | func BenchmarkDrawString(b *testing.B) {
18 | data, err := ioutil.ReadFile("../licenses/gpl.txt")
19 | if err != nil {
20 | b.Fatal(err)
21 | }
22 | lines := strings.Split(string(data), "\n")
23 |
24 | data, err = ioutil.ReadFile("../testdata/luxisr.ttf")
25 | if err != nil {
26 | b.Fatal(err)
27 | }
28 | font, err := ParseFont(data)
29 | if err != nil {
30 | b.Fatal(err)
31 | }
32 |
33 | dst := image.NewRGBA(image.Rect(0, 0, 800, 600))
34 | draw.Draw(dst, dst.Bounds(), image.White, image.ZP, draw.Src)
35 |
36 | c := NewContext()
37 | c.SetDst(dst)
38 | c.SetClip(dst.Bounds())
39 | c.SetSrc(image.Black)
40 | c.SetFont(font)
41 |
42 | var ms runtime.MemStats
43 | runtime.ReadMemStats(&ms)
44 | mallocs := ms.Mallocs
45 |
46 | b.ResetTimer()
47 | for i := 0; i < b.N; i++ {
48 | for j, line := range lines {
49 | _, err := c.DrawString(line, Pt(0, (j*16)%600))
50 | if err != nil {
51 | b.Fatal(err)
52 | }
53 | }
54 | }
55 | b.StopTimer()
56 | runtime.ReadMemStats(&ms)
57 | mallocs = ms.Mallocs - mallocs
58 | b.Logf("%d iterations, %d mallocs per iteration\n", b.N, int(mallocs)/b.N)
59 | }
60 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/mymysql.go:
--------------------------------------------------------------------------------
1 | package xorm
2 |
3 | import (
4 | "errors"
5 | "strings"
6 | "time"
7 | )
8 |
9 | type mymysql struct {
10 | mysql
11 | }
12 |
13 | type mymysqlParser struct {
14 | }
15 |
16 | func (p *mymysqlParser) parse(driverName, dataSourceName string) (*uri, error) {
17 | db := &uri{dbType: MYSQL}
18 |
19 | pd := strings.SplitN(dataSourceName, "*", 2)
20 | if len(pd) == 2 {
21 | // Parse protocol part of URI
22 | p := strings.SplitN(pd[0], ":", 2)
23 | if len(p) != 2 {
24 | return nil, errors.New("Wrong protocol part of URI")
25 | }
26 | db.proto = p[0]
27 | options := strings.Split(p[1], ",")
28 | db.raddr = options[0]
29 | for _, o := range options[1:] {
30 | kv := strings.SplitN(o, "=", 2)
31 | var k, v string
32 | if len(kv) == 2 {
33 | k, v = kv[0], kv[1]
34 | } else {
35 | k, v = o, "true"
36 | }
37 | switch k {
38 | case "laddr":
39 | db.laddr = v
40 | case "timeout":
41 | to, err := time.ParseDuration(v)
42 | if err != nil {
43 | return nil, err
44 | }
45 | db.timeout = to
46 | default:
47 | return nil, errors.New("Unknown option: " + k)
48 | }
49 | }
50 | // Remove protocol part
51 | pd = pd[1:]
52 | }
53 | // Parse database part of URI
54 | dup := strings.SplitN(pd[0], "/", 3)
55 | if len(dup) != 3 {
56 | return nil, errors.New("Wrong database part of URI")
57 | }
58 | db.dbName = dup[0]
59 | db.user = dup[1]
60 | db.passwd = dup[2]
61 |
62 | return db, nil
63 | }
64 |
65 | func (db *mymysql) Init(drivername, uri string) error {
66 | return db.mysql.base.init(&mymysqlParser{}, drivername, uri)
67 | }
68 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/bytes/bytes_test.go:
--------------------------------------------------------------------------------
1 | package bytes
2 |
3 | import (
4 | "io"
5 | "testing"
6 | )
7 |
8 | // ---------------------------------------------------
9 |
10 | func TestBuffer(t *testing.T) {
11 |
12 | b := NewBuffer()
13 | n, err := b.WriteStringAt("Hello", 4)
14 | if n != 5 || err != nil {
15 | t.Fatal("WriteStringAt failed:", n, err)
16 | }
17 | if b.Len() != 9 {
18 | t.Fatal("Buffer.Len invalid (9 is required):", b.Len())
19 | }
20 |
21 | buf := make([]byte, 10)
22 | n, err = b.ReadAt(buf, 50)
23 | if n != 0 || err != io.EOF {
24 | t.Fatal("ReadAt failed:", n, err)
25 | }
26 |
27 | n, err = b.ReadAt(buf, 6)
28 | if n != 3 || err != io.EOF || string(buf[:n]) != "llo" {
29 | t.Fatal("ReadAt failed:", n, err, string(buf[:n]))
30 | }
31 |
32 | n, err = b.WriteAt([]byte("Hi h"), 1)
33 | if n != 4 || err != nil {
34 | t.Fatal("WriteAt failed:", n, err)
35 | }
36 | if b.Len() != 9 {
37 | t.Fatal("Buffer.Len invalid (9 is required):", b.Len())
38 | }
39 |
40 | n, err = b.ReadAt(buf, 0)
41 | if n != 9 || err != io.EOF || string(buf[:n]) != "\x00Hi hello" {
42 | t.Fatal("ReadAt failed:", n, err)
43 | }
44 |
45 | n, err = b.WriteStringAt("LO world!", 7)
46 | if n != 9 || err != nil {
47 | t.Fatal("WriteStringAt failed:", n, err)
48 | }
49 | if b.Len() != 16 {
50 | t.Fatal("Buffer.Len invalid (16 is required):", b.Len())
51 | }
52 |
53 | buf = make([]byte, 17)
54 | n, err = b.ReadAt(buf, 0)
55 | if n != 16 || err != io.EOF || string(buf[:n]) != "\x00Hi helLO world!" {
56 | t.Fatal("ReadAt failed:", n, err, string(buf[:n]))
57 | }
58 | }
59 |
60 | // ---------------------------------------------------
61 |
62 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/README.md:
--------------------------------------------------------------------------------
1 | # xorm tools
2 |
3 |
4 | xorm tools is a set of tools for database operation.
5 |
6 | ## Install
7 |
8 | `go get github.com/lunny/xorm/xorm`
9 |
10 | and you should install the depends below:
11 |
12 | * github.com/lunny/xorm
13 |
14 | * Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
15 |
16 | * MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)
17 |
18 | * SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
19 |
20 | * Postgres: [github.com/bylevel/pq](https://github.com/bylevel/pq)
21 |
22 |
23 | ## Reverse
24 |
25 | After you installed the tool, you can type
26 |
27 | `xorm help reverse`
28 |
29 | to get help
30 |
31 | example:
32 |
33 | sqlite:
34 | `xorm reverse sqite3 test.db templates/goxorm`
35 |
36 | mysql:
37 | `xorm reverse mysql root:@/xorm_test?charset=utf8 templates/goxorm`
38 |
39 | mymysql:
40 | `xorm reverse mymysql xorm_test2/root/ templates/goxorm`
41 |
42 | postgres:
43 | `xorm reverse postgres "dbname=xorm_test sslmode=disable" templates/goxorm`
44 |
45 | will generated go files in `./model` directory
46 |
47 | ## Template and Config
48 |
49 | Now, xorm tool supports go and c++ two languages and have go, goxorm, c++ three of default templates. In template directory, we can put a config file to control how to generating.
50 |
51 | ````
52 | lang=go
53 | genJson=1
54 | ```
55 |
56 | lang must be go or c++ now.
57 | genJson can be 1 or 0, if 1 then the struct will have json tag.
58 |
59 | ## LICENSE
60 |
61 | BSD License
62 | [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)
63 |
--------------------------------------------------------------------------------
/router_badge.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "image"
5 | "image/color"
6 | "image/draw"
7 | "image/png"
8 | "io/ioutil"
9 | "net/http"
10 |
11 | "code.google.com/p/freetype-go/freetype"
12 | )
13 |
14 | const (
15 | fontFile = "bin/font.ttf"
16 | fontSize = 10
17 | fontDPI = 72
18 | )
19 |
20 | var (
21 | black color.Color = color.RGBA{50, 50, 50, 255}
22 | green color.Color = color.RGBA{140, 170, 50, 255}
23 | )
24 |
25 | func initBadge() {
26 | m.Get("/badge/:web/:name/:p/download.png", func(w http.ResponseWriter, r *http.Request) {
27 | var err error
28 | img := image.NewNRGBA(image.Rect(0, 0, 140, 18))
29 | fontBytes, err := ioutil.ReadFile(fontFile)
30 | if err != nil {
31 | return
32 | }
33 | font, err := freetype.ParseFont(fontBytes)
34 | if err != nil {
35 | return
36 | }
37 | left, right := img.Bounds(), img.Bounds()
38 | const middle = 60
39 | left.Max = image.Pt(middle, 18)
40 | right.Min = image.Pt(middle, 0)
41 | // fill left(black) right(green)
42 | draw.Draw(img, left, &image.Uniform{black}, image.ZP, draw.Src)
43 | draw.Draw(img, right, &image.Uniform{green}, image.ZP, draw.Src)
44 |
45 | // draw "gobuild.io | download"
46 | c := freetype.NewContext()
47 | c.SetDPI(fontDPI)
48 | c.SetFont(font)
49 | c.SetFontSize(fontSize)
50 | c.SetClip(img.Bounds())
51 | c.SetDst(img)
52 | c.SetSrc(image.White)
53 | pt := freetype.Pt(7, 12)
54 | _, err = c.DrawString("gobuild.io", pt) // 10 chars width = 60px
55 | if err != nil {
56 | return
57 | }
58 | c.SetSrc(image.Black)
59 | pt = freetype.Pt(middle+18, 12)
60 | _, err = c.DrawString("download", pt)
61 |
62 | w.Header().Set("Content-Type", "image/png")
63 | png.Encode(w, img)
64 | })
65 | }
66 |
--------------------------------------------------------------------------------
/bin/ssl.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIIEowIBAAKCAQEAxKBXyc0VxArHTOQ/8lM/HvLGr7BnKGJ/PDJRN98zUwgvAMCu
3 | j6NlncEExz1v3hYN0liPLfabB8d70LZXc3jbeYEv8KypJzjinMRCdzZYH+xFuv/p
4 | EM1aeXCkSMtkljlzGJQYyf5eRjNYzVcHnkOjcvh9yNgUtT1ZZF6ALcBxTTm+XGXR
5 | ei6FAuF6GUnhkOKMPgRwr+JTW4+oNQUizwQ4pTLce1/+roKSeIw4wNL8YNQs7T5k
6 | hnEM1LjW8gz1PoghxZBwzZ20CKYo41R/HnF3DvIVxZNGoXjzFsPM+z5GLp0S8M3P
7 | CUNa2w4q5etN+K+tlRxBSvKcDLVqyumCOKqG0wIDAQABAoIBACTesDd+BmPRZZfM
8 | gRUuePqTqaAOIvnWpmciREqGxvf949pvRwxWJlrTc9LseUqathLIWmjTAjUOOfBk
9 | ELftZLI/AD9QERPyvcOJpbD29sVdp6GuFQT6jMmSzqt7wCvPL/7e3lsaIJFnVXKD
10 | rEEIC+EmKWf85L0reNSyR7TMjjJdmd+5xsnAqmcSn1Yw6D7AHBScTJk20fVmqaW7
11 | Q3TJqFV2Pt4khGChNbLBFVaOPnj95mHJzFjeLUoTlnW8JKQ6OCzvE4BofAUknbge
12 | sXoag4m/owV9nKAzw2MZFqmLbuuGcvhufv9miwBTd0KK7iRs4snoQXSBgZojFOAb
13 | 7UsTcVkCgYEA+zJaz9PdWtbwlpY29M3zFPJyf7DKOEVi6FtO9pFy4ACggIr2Q6ka
14 | ZjpHCJngRv1cU/0dv7HED4b7nBR7+A74ZxSeSEYkgKQuSF28NOIHC8OVWKFhgNtB
15 | 0cg2D5wK8W398xNhjeCKw+eFrmQd/ZD2dgUEfEzhObu+Ls17t04x8bcCgYEAyGLb
16 | r+UyxKTI536nDK7DU8h3+xbQC6qmV7nHUDc2NI9aYK4+Y9EbdsI+RSMaWb7JSpTB
17 | lhbDe/8U24MqUqZ4qQXUYX5ezFNE16cwDo6+FiESBUIDG3VsEmTwEe9lJpHOIZNb
18 | Tzj6s25OGpkhJawM+gJ6e6uIpJbSIgeeomtMo8UCgYBv2wFjMCWOcM3bUHKSWi8X
19 | McrYn2G84vDjJN2poCT2KHFQLBDzGhb+VI8S/mpHUkTNxZV8qezzORlLbDezwv7L
20 | 7/t3lXxlqDZP1SWcqtWWYHZdbCdd2MSbZLrmAodA8Mi3d/bl1YoVKEB34m8UXXvS
21 | G/PeYeGc8sQCVU/01SYaSwKBgHT74a0KbV0HppIfCn8I99dNzV20r7hf48SLHKTj
22 | 1q1Qkz6l+p5jUVk/hQLvv05tZy43MdzhZTZacF7GcErYDNEAKkDQeZ9nbWVIoXGe
23 | O7LHk7GmHBJHttP2QYD29WJS9Lf9Qu05IoLl/orgos1PaDP8hmz0c01DD2H2eNHx
24 | OkjRAoGBAKvmMPwmHaym1nrFr+EwXOewFu/Mv5E8jUYH6jXGARQVsyLUtbJ4wZfc
25 | KshQFOMka9Cpng+EANqNkFQcPaV8VHgKZHDUqjEtmWMqxQKtyGb8btvBt7ojNS/a
26 | 1tq9uUlkNuWNnPkptCvT6PiLYgkfWQIValHm9V7H93P/S+pXI5RN
27 | -----END RSA PRIVATE KEY-----
28 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/dir_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "os"
19 | "testing"
20 |
21 | . "github.com/smartystreets/goconvey/convey"
22 | )
23 |
24 | func TestIsDir(t *testing.T) {
25 | Convey("Check if given path is a directory", t, func() {
26 | Convey("Pass a file name", func() {
27 | So(IsDir("file.go"), ShouldEqual, false)
28 | })
29 | Convey("Pass a directory name", func() {
30 | So(IsDir("testdata"), ShouldEqual, true)
31 | })
32 | Convey("Pass a invalid path", func() {
33 | So(IsDir("foo"), ShouldEqual, false)
34 | })
35 | })
36 | }
37 |
38 | func TestCopyDir(t *testing.T) {
39 | Convey("Items of two slices should be same", t, func() {
40 | s1, err := StatDir("testdata", true)
41 | So(err, ShouldEqual, nil)
42 |
43 | err = CopyDir("testdata", "testdata2")
44 | So(err, ShouldEqual, nil)
45 |
46 | s2, err := StatDir("testdata2", true)
47 | os.RemoveAll("testdata2")
48 | So(err, ShouldEqual, nil)
49 |
50 | So(CompareSliceStr(s1, s2), ShouldEqual, true)
51 | })
52 | }
53 |
54 | func BenchmarkIsDir(b *testing.B) {
55 | for i := 0; i < b.N; i++ {
56 | IsDir("file.go")
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/slice.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | // AppendStr appends string to slice with no duplicates.
18 | func AppendStr(strs []string, str string) []string {
19 | for _, s := range strs {
20 | if s == str {
21 | return strs
22 | }
23 | }
24 | return append(strs, str)
25 | }
26 |
27 | // CompareSliceStr compares two 'string' type slices.
28 | // It returns true if elements and order are both the same.
29 | func CompareSliceStr(s1, s2 []string) bool {
30 | if len(s1) != len(s2) {
31 | return false
32 | }
33 |
34 | for i := range s1 {
35 | if s1[i] != s2[i] {
36 | return false
37 | }
38 | }
39 |
40 | return true
41 | }
42 |
43 | // CompareSliceStr compares two 'string' type slices.
44 | // It returns true if elements are the same, and ignores the order.
45 | func CompareSliceStrU(s1, s2 []string) bool {
46 | if len(s1) != len(s2) {
47 | return false
48 | }
49 |
50 | for i := range s1 {
51 | for j := len(s2) - 1; j >= 0; j-- {
52 | if s1[i] == s2[j] {
53 | s2 = append(s2[:j], s2[j+1:]...)
54 | break
55 | }
56 | }
57 | }
58 | if len(s2) > 0 {
59 | return false
60 | }
61 | return true
62 | }
63 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | ## Reporting Issues
4 |
5 | Before creating a new Issue, please check first if a similar Issue [already exists](https://github.com/go-sql-driver/mysql/issues?state=open) or was [recently closed](https://github.com/go-sql-driver/mysql/issues?direction=desc&page=1&sort=updated&state=closed).
6 |
7 | Please provide the following minimum information:
8 | * Your Go-MySQL-Driver version (or git SHA)
9 | * Your Go version (run `go version` in your console)
10 | * A detailed issue description
11 | * Error Log if present
12 | * If possible, a short example
13 |
14 |
15 | ## Contributing Code
16 |
17 | By contributing to this project, you share your code under the Mozilla Public License 2, as specified in the LICENSE file.
18 | Don't forget to add yourself to the AUTHORS file.
19 |
20 | ### Pull Requests Checklist
21 |
22 | Please check the following points before submitting your pull request:
23 | - [x] Code compiles correctly
24 | - [x] Created tests, if possible
25 | - [x] All tests pass
26 | - [x] Extended the README / documentation, if necessary
27 | - [x] Added yourself to the AUTHORS file
28 |
29 | ### Code Review
30 |
31 | Everyone is invited to review and comment on pull requests.
32 | If it looks fine to you, comment with "LGTM" (Looks good to me).
33 |
34 | If changes are required, notice the reviewers with "PTAL" (Please take another look) after committing the fixes.
35 |
36 | Before merging the Pull Request, at least one [team member](https://github.com/go-sql-driver?tab=members) must have commented with "LGTM".
37 |
38 | ## Development Ideas
39 |
40 | If you are looking for ideas for code contributions, please check our [Development Ideas](https://github.com/go-sql-driver/mysql/wiki/Development-Ideas) Wiki page.
41 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/pipe_test.go:
--------------------------------------------------------------------------------
1 | package sh
2 |
3 | import (
4 | "encoding/xml"
5 | "io"
6 | "os"
7 | "os/exec"
8 | "testing"
9 | )
10 |
11 | func TestUnmarshalJSON(t *testing.T) {
12 | var a int
13 | s := NewSession()
14 | s.ShowCMD = true
15 | err := s.Command("echo", []string{"1"}).UnmarshalJSON(&a)
16 | if err != nil {
17 | t.Error(err)
18 | }
19 | if a != 1 {
20 | t.Errorf("expect a tobe 1, but got %d", a)
21 | }
22 | }
23 |
24 | func TestUnmarshalXML(t *testing.T) {
25 | xmlSample := `
26 | `
27 | type server struct {
28 | XMLName xml.Name `xml:"server"`
29 | Version string `xml:"version,attr"`
30 | }
31 | data := &server{}
32 | s.Command("echo", xmlSample).UnmarshalXML(data)
33 | if data.Version != "1" {
34 | t.Error(data)
35 | }
36 | }
37 |
38 | func TestPipe(t *testing.T) {
39 | s := NewSession()
40 | s.ShowCMD = true
41 | s.Call("echo", "hello")
42 | err := s.Command("echo", "hi").Command("cat", "-n").Start()
43 | if err != nil {
44 | t.Error(err)
45 | }
46 | err = s.Wait()
47 | if err != nil {
48 | t.Error(err)
49 | }
50 | out, err := s.Command("echo", []string{"hello"}).Output()
51 | if err != nil {
52 | t.Error(err)
53 | }
54 | if string(out) != "hello\n" {
55 | t.Error("capture wrong output:", out)
56 | }
57 | s.Command("echo", []string{"hello\tworld"}).Command("cut", []string{"-f2"}).Run()
58 | }
59 |
60 | func TestPipeCommand(t *testing.T) {
61 | c1 := exec.Command("echo", "good")
62 | rd, wr := io.Pipe()
63 | c1.Stdout = wr
64 | c2 := exec.Command("cat", "-n")
65 | c2.Stdout = os.Stdout
66 | c2.Stdin = rd
67 | c1.Start()
68 | c2.Start()
69 |
70 | c1.Wait()
71 | wc, ok := c1.Stdout.(io.WriteCloser)
72 | if ok {
73 | wc.Close()
74 | }
75 | c2.Wait()
76 | }
77 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/conversion.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/lunny/xorm"
7 | _ "github.com/mattn/go-sqlite3"
8 | "os"
9 | )
10 |
11 | type Status struct {
12 | Name string
13 | Color string
14 | }
15 |
16 | var (
17 | Registed Status = Status{"Registed", "white"}
18 | Approved Status = Status{"Approved", "green"}
19 | Removed Status = Status{"Removed", "red"}
20 | Statuses map[string]Status = map[string]Status{
21 | Registed.Name: Registed,
22 | Approved.Name: Approved,
23 | Removed.Name: Removed,
24 | }
25 | )
26 |
27 | func (s *Status) FromDB(bytes []byte) error {
28 | if r, ok := Statuses[string(bytes)]; ok {
29 | *s = r
30 | return nil
31 | } else {
32 | return errors.New("no this data")
33 | }
34 | }
35 |
36 | func (s *Status) ToDB() ([]byte, error) {
37 | return []byte(s.Name), nil
38 | }
39 |
40 | type User struct {
41 | Id int64
42 | Name string
43 | Status Status `xorm:"varchar(40)"`
44 | }
45 |
46 | func main() {
47 | f := "conversion.db"
48 | os.Remove(f)
49 |
50 | Orm, err := NewEngine("sqlite3", f)
51 | if err != nil {
52 | fmt.Println(err)
53 | return
54 | }
55 | Orm.ShowSQL = true
56 | err = Orm.CreateTables(&User{})
57 | if err != nil {
58 | fmt.Println(err)
59 | return
60 | }
61 |
62 | _, err = Orm.Insert(&User{1, "xlw", Registed})
63 | if err != nil {
64 | fmt.Println(err)
65 | return
66 | }
67 |
68 | users := make([]User, 0)
69 | err = Orm.Find(&users)
70 | if err != nil {
71 | fmt.Println(err)
72 | return
73 | }
74 |
75 | fmt.Println(users)
76 | }
77 |
--------------------------------------------------------------------------------
/bin/crypted-ssl.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | Proc-Type: 4,ENCRYPTED
3 | DEK-Info: AES-256-CBC,10D0E347CCF2FE3C4168CB3F059C14C8
4 |
5 | qLsbjfXX18vC/TFoQKfep2zKpRcjhMOtDfxaZ24eOU9vEpHQ64HnTJ/1cSg7dsyJ
6 | hgWontsrybZw3UKQUjWV/7RAwW9lUWGMLlzu3pk3y1Y640p53MDKhFIKiufkQZyN
7 | jznPJyk1I7ghubth/HrycwmYW+npLsENITIta4up9RhPTf+OQ0pt8Vo7wvkLaU/N
8 | XRX7TMlF92KivO+V7Rrent9eO1iix8O8GrrElkC5jvmAscSeCZ8OzeAmg7biv4GM
9 | 835wjGNlgnGhPm0MCzmNfG3Wq4NFomM4W4esYrh3JgfTI9LugsAdhhgL1x3NCzYu
10 | Wdr4rx1t/3qO4/dQ7rVZsqqG1V2jD7dI/hTa+sA6b7Xj2xJJvwqgHnufgJUBHAlV
11 | +3RXMQJRZFaeyDrpaaNi9kbse0P9W5fJRUdwJoaBEVhNUXg1DMwlfzEnbHiU6659
12 | MaWzs5TobIwkET+Ak/bqXgSit6pY7P+tsU4nlrnPPD8GAh7yZ0MpUmx1N7aA0ZWI
13 | AFH9TcEi6+uHhEnqzNZYHpabtspoRKX/V9aHytRYTdOsZQdcNEkejsnM9XXsw5qB
14 | 0OCryvLcfJfc/4HU2PyAqE7Kutkey5W3VL5Kx2eEadBFTVIZFaz17wVb9ZSNW3eo
15 | eKZM/xpXoBMWawijlTtzEq/c2tLVzfRHpo+D9jMER8qbE6antjDTv7f+PaFyg8Hz
16 | HGD48Rr+EWnzHlXZl9yvjSqGRndM8iEdpJ+ebXJUAPcKGjvmOa/3WRzcFG8eiubf
17 | Aw3T/IBjY67oChTd2j34JCPcHoS3Z5AWJ8ZjPLDr9Ej0CNmHccbIK5579/KhEHpy
18 | f3HenChc9QyZtqsdbuHipOWlTGxr4QGLFTsiPecdzmmY6O+vra8Dpx5OWfrKtxvL
19 | QGWQx2g3ExWWr0HNrqumc7JCKxcOu9Ai/K80yvgf397Ers4dIWpt4KiiDz6kW61q
20 | 5b+cLXnRbYXSymHJHnQU3V+DA4BM9GyHxL2JttjfYE5/AaLCteo44lg2dcD7czSZ
21 | 8aGbujUs6+EE6MvKRyBfPvAWiouDmXjo1NehLhY1ofKGNO+lYmE7EXFlV/SW7YY4
22 | XVm8U3xZzTMFrn/KWa+OghJgjFQlhRGLVq9Ro3SRh+RiPYAOHuGNpYslqJoVxTJX
23 | NEO0t0ct7PqNdy5ccRPyq2WQrai79/z4+B3u3Hv1YxHUHEyEPeyXeCB2Rv7YSdWD
24 | FkV8OCa4gJFWy70ayV5U0a8U8KXQBCp6y/g/msaHSp02mUhQH3LeBL1T5wo0aMj0
25 | bO8jqKLfBbDpVXgyAbsSM39nzSQxEYYcFaU8B96r00jCY/hyZmVgyqHyuHkWAyiv
26 | WOsmMHulAFLhwdFsoYliAK1RmdGSgBoQvPle28VJvKugczTb61+FhD2/b6hMbFPU
27 | CX0Q6vJpc4E2L0L2QC9mEbp9VqTlJEsemwamhiwhkOiZLDu0Vna9P+H5y8mOV53B
28 | IMUQ0kvzoR2WQBBOZYvHOH+0NIjwODrvwYo+FvLCmz0lMwfruq5qLcX1k/ckMdko
29 | /ucdPXMcAmRvnrVbsi5JLq1xnL7zwx2lpKR31x1ilMIry7YKGPYdBdM7L5eVbVrE
30 | -----END RSA PRIVATE KEY-----
31 |
--------------------------------------------------------------------------------
/public/css/font.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'fontello';
3 | src: url('../fonts/fontello.eot?37141680');
4 | src: url('../fonts/fontello.eot?37141680#iefix') format('embedded-opentype'),
5 | url('../fonts/fontello.woff?37141680') format('woff'),
6 | url('../fonts/fontello.ttf?37141680') format('truetype'),
7 | url('../fonts/fontello.svg?37141680#fontello') format('svg');
8 | font-weight: normal;
9 | font-style: normal;
10 | }
11 | /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
12 | /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
13 | /*
14 | @media screen and (-webkit-min-device-pixel-ratio:0) {
15 | @font-face {
16 | font-family: 'fontello';
17 | src: url('../font/fontello.svg?37141680#fontello') format('svg');
18 | }
19 | }
20 | */
21 |
22 | [class^="icon-"]:before, [class*=" icon-"]:before {
23 | font-family: "fontello";
24 | font-style: normal;
25 | font-weight: normal;
26 | speak: none;
27 |
28 | display: inline-block;
29 | text-decoration: inherit;
30 | width: 1em;
31 | margin-right: .6em;
32 | text-align: center;
33 | /* opacity: .8; */
34 |
35 | /* For safety - reset parent styles, that can break glyph codes*/
36 | font-variant: normal;
37 | text-transform: none;
38 |
39 | /* fix buttons height, for twitter bootstrap */
40 | line-height: 1em;
41 |
42 | /* Animation center compensation - margins should be symmetric */
43 | /* remove if not needed */
44 | margin-left: .2em;
45 |
46 | /* you can be more comfortable with increased icons size */
47 | /* font-size: 120%; */
48 |
49 | /* Uncomment for 3D effect */
50 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
51 | }
52 |
53 | .icon-search:before { content: '\e800'; } /* '' */
54 | .icon-download:before { content: '\e801'; } /* '' */
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/OLD_README.md:
--------------------------------------------------------------------------------
1 | ## OLD README
2 | First give you a full example, I will explain every command below.
3 |
4 | session := sh.NewSession()
5 | session.Env["PATH"] = "/usr/bin:/bin"
6 | session.Stdout = os.Stdout
7 | session.Stderr = os.Stderr
8 | session.Alias("ll", "ls", "-l")
9 | session.ShowCMD = true // enable for debug
10 | var err error
11 | err = session.Call("ll", "/")
12 | if err != nil {
13 | log.Fatal(err)
14 | }
15 | ret, err := session.Capture("pwd", sh.Dir("/home")) # wraper of session.Call
16 | if err != nil {
17 | log.Fatal(err)
18 | }
19 | # ret is "/home\n"
20 | fmt.Println(ret)
21 |
22 | create a new Session
23 |
24 | session := sh.NewSession()
25 |
26 | use alias like this
27 |
28 | session.Alias("ll", "ls", "-l") # like alias ll='ls -l'
29 |
30 | set current env like this
31 |
32 | session.Env["BUILD_ID"] = "123" # like export BUILD_ID=123
33 |
34 | set current directory
35 |
36 | session.Set(sh.Dir("/")) # like cd /
37 |
38 | pipe is also supported
39 |
40 | session.Command("echo", "hello\tworld").Command("cut", "-f2")
41 | // output should be "world"
42 | session.Run()
43 |
44 | test, the build in command support
45 |
46 | session.Test("d", "dir") // test dir
47 | session.Test("f", "file) // test regular file
48 |
49 | with `Alias Env Set Call Capture Command` a shell scripts can be easily converted into golang program. below is a shell script.
50 |
51 | #!/bin/bash -
52 | #
53 | export PATH=/usr/bin:/bin
54 | alias ll='ls -l'
55 | cd /usr
56 | if test -d "local"
57 | then
58 | ll local | awk '{print $1, $NF}'
59 | fi
60 |
61 | convert to golang, will be
62 |
63 | s := sh.NewSession()
64 | s.Env["PATH"] = "/usr/bin:/bin"
65 | s.Set(sh.Dir("/usr"))
66 | s.Alias("ll", "ls", "-l")
67 | if s.Test("d", "local") {
68 | s.Command("ll", "local").Command("awk", "{print $1, $NF}").Run()
69 | }
70 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing to xorm
2 |
3 | `xorm` has a backlog of [pull requests](https://help.github.com/articles/using-pull-requests), but contributions are still very
4 | much welcome. You can help with patch review, submitting bug reports,
5 | or adding new functionality. There is no formal style guide, but
6 | please conform to the style of existing code and general Go formatting
7 | conventions when submitting patches.
8 |
9 | * [fork a repo](https://help.github.com/articles/fork-a-repo)
10 | * [creating a pull request ](https://help.github.com/articles/creating-a-pull-request)
11 |
12 | ### Patch review
13 |
14 | Help review existing open [pull requests](https://help.github.com/articles/using-pull-requests) by commenting on the code or
15 | proposed functionality.
16 |
17 | ### Bug reports
18 |
19 | We appreciate any bug reports, but especially ones with self-contained
20 | (doesn't depend on code outside of pq), minimal (can't be simplified
21 | further) test cases. It's especially helpful if you can submit a pull
22 | request with just the failing test case (you'll probably want to
23 | pattern it after the tests in
24 | [base_test.go](https://github.com/lunny/xorm/blob/master/base_test.go) AND
25 | [benchmark_base_test.go](https://github.com/lunny/xorm/blob/master/benchmark_base_test.go).
26 |
27 | If you implements a new database interface, you maybe need to add a _test.go file.
28 | For example, [mysql_test.go](https://github.com/lunny/xorm/blob/master/mysql_test.go)
29 |
30 | ### New functionality
31 |
32 | There are a number of pending patches for new functionality, so
33 | additional feature patches will take a while to merge. Still, patches
34 | are generally reviewed based on usefulness and complexity in addition
35 | to time-in-queue, so if you have a knockout idea, take a shot. Feel
36 | free to open an issue discussion your proposed patch beforehand.
37 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/hash.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 uuid
6 |
7 | import (
8 | "crypto/md5"
9 | "crypto/sha1"
10 | "hash"
11 | )
12 |
13 | // Well known Name Space IDs and UUIDs
14 | var (
15 | NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
16 | NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
17 | NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
18 | NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
19 | NIL = Parse("00000000-0000-0000-0000-000000000000")
20 | )
21 |
22 | // NewHash returns a new UUID dervied from the hash of space concatenated with
23 | // data generated by h. The hash should be at least 16 byte in length. The
24 | // first 16 bytes of the hash are used to form the UUID. The version of the
25 | // UUID will be the lower 4 bits of version. NewHash is used to implement
26 | // NewMD5 and NewSHA1.
27 | func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
28 | h.Reset()
29 | h.Write(space)
30 | h.Write([]byte(data))
31 | s := h.Sum(nil)
32 | uuid := make([]byte, 16)
33 | copy(uuid, s)
34 | uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
35 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
36 | return uuid
37 | }
38 |
39 | // NewMD5 returns a new MD5 (Version 3) UUID based on the
40 | // supplied name space and data.
41 | //
42 | // NewHash(md5.New(), space, data, 3)
43 | func NewMD5(space UUID, data []byte) UUID {
44 | return NewHash(md5.New(), space, data, 3)
45 | }
46 |
47 | // NewSHA1 returns a new SHA1 (Version 5) UUID based on the
48 | // supplied name space and data.
49 | //
50 | // NewHash(sha1.New(), space, data, 5)
51 | func NewSHA1(space UUID, data []byte) UUID {
52 | return NewHash(sha1.New(), space, data, 5)
53 | }
54 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/aybabtme/color/README.md:
--------------------------------------------------------------------------------
1 | # Package `color`
2 |
3 | Colorize your terminal strings.
4 |
5 | ```go
6 | fmt.Printf("I'm in a %s world!\n", brush.Blue("blue"))
7 | ```
8 |
9 | # Usage
10 |
11 | Default `Brush` are available for your convenience. You can invoke them directly
12 |
13 | ```go
14 | fmt.Printf("This is %s\n", brush.Red("red"))
15 | ```
16 |
17 | ... or you can create new ones!
18 | ```go
19 | weird := color.NewBrush(color.PurplePaint, color.CyanPaint)
20 | fmt.Printf("This color is %s\n", weird("weird"))
21 | ```
22 |
23 | Create a `Style`, which has some convenience methods :
24 | ```go
25 | redBg := color.NewStyle(color.RedPaint, color.YellowPaint)
26 | ```
27 |
28 | `Style.WithForeground` or `WithBackground` returns a new `Style`, with the applied
29 | `Paint`. Styles are immutable so the original one is left unchanged
30 |
31 | ```go
32 | greenFg := redBg.WithForeground(color.GreenPaint)
33 |
34 | // Style.Brush gives you a Brush that you can invoke directly to colorize strings.
35 | green := greenFg.Brush()
36 | fmt.Printf("This is %s but not really\n", green("kind of green"))
37 | ```
38 |
39 | You can use it with all sorts of things :
40 | ```go
41 | sout := log.New(os.Stdout, "["+brush.Green("OK").String()+"]\t", log.LstdFlags)
42 | serr := log.New(os.Stderr, "["+brush.Red("OMG").String()+"]\t", log.LstdFlags)
43 |
44 | sout.Printf("Everything was going %s until...", brush.Cyan("fine"))
45 | serr.Printf("%s killed %s !!!", brush.Red("Locke"), brush.Blue("Jacob"))
46 | ```
47 |
48 | That's it!
49 |
50 | # Demo
51 |
52 | 
53 |
54 | # Docs
55 |
56 | [GoDoc!](http://godoc.org/github.com/aybabtme/color) (↫ this is a link)
57 |
58 | # FAQ
59 |
60 | > Does it work on Windows?
61 |
62 | NO!
63 |
64 | > It's spelled "colour"
65 |
66 | NO!
67 |
68 | > You're canadian, spell it "colour"
69 |
70 | NO!
71 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/path_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "os"
19 | "runtime"
20 | "testing"
21 | )
22 |
23 | func TestGetGOPATHs(t *testing.T) {
24 | var gpsR []string
25 |
26 | if runtime.GOOS != "windows" {
27 | gpsR = []string{"path/to/gopath1", "path/to/gopath2", "path/to/gopath3"}
28 | os.Setenv("GOPATH", "path/to/gopath1:path/to/gopath2:path/to/gopath3")
29 | } else {
30 | gpsR = []string{"path/to/gopath1", "path/to/gopath2", "path/to/gopath3"}
31 | os.Setenv("GOPATH", "path\\to\\gopath1;path\\to\\gopath2;path\\to\\gopath3")
32 | }
33 |
34 | gps := GetGOPATHs()
35 | if !CompareSliceStr(gps, gpsR) {
36 | t.Errorf("GetGOPATHs:\n Expect => %s\n Got => %s\n", gpsR, gps)
37 | }
38 | }
39 |
40 | func TestGetSrcPath(t *testing.T) {
41 |
42 | }
43 |
44 | func TestHomeDir(t *testing.T) {
45 | _, err := HomeDir()
46 | if err != nil {
47 | t.Errorf("HomeDir:\n Expect => %v\n Got => %s\n", nil, err)
48 | }
49 | }
50 |
51 | func BenchmarkGetGOPATHs(b *testing.B) {
52 | for i := 0; i < b.N; i++ {
53 | GetGOPATHs()
54 | }
55 | }
56 |
57 | func BenchmarkGetSrcPath(b *testing.B) {
58 | for i := 0; i < b.N; i++ {
59 | GetSrcPath("github.com/Unknwon/com")
60 | }
61 | }
62 |
63 | func BenchmarkHomeDir(b *testing.B) {
64 | for i := 0; i < b.N; i++ {
65 | HomeDir()
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/astaxie/beego/utils/file.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "bufio"
5 | "errors"
6 | "io"
7 | "os"
8 | "path/filepath"
9 | "regexp"
10 | )
11 |
12 | // SelfPath gets compiled executable file absolute path
13 | func SelfPath() string {
14 | path, _ := filepath.Abs(os.Args[0])
15 | return path
16 | }
17 |
18 | // SelfDir gets compiled executable file directory
19 | func SelfDir() string {
20 | return filepath.Dir(SelfPath())
21 | }
22 |
23 | // FileExists reports whether the named file or directory exists.
24 | func FileExists(name string) bool {
25 | if _, err := os.Stat(name); err != nil {
26 | if os.IsNotExist(err) {
27 | return false
28 | }
29 | }
30 | return true
31 | }
32 |
33 | // Search a file in paths.
34 | // this is often used in search config file in /etc ~/
35 | func SearchFile(filename string, paths ...string) (fullpath string, err error) {
36 | for _, path := range paths {
37 | if fullpath = filepath.Join(path, filename); FileExists(fullpath) {
38 | return
39 | }
40 | }
41 | err = errors.New(fullpath + " not found in paths")
42 | return
43 | }
44 |
45 | // like command grep -E
46 | // for example: GrepFile(`^hello`, "hello.txt")
47 | // \n is striped while read
48 | func GrepFile(patten string, filename string) (lines []string, err error) {
49 | re, err := regexp.Compile(patten)
50 | if err != nil {
51 | return
52 | }
53 |
54 | fd, err := os.Open(filename)
55 | if err != nil {
56 | return
57 | }
58 | lines = make([]string, 0)
59 | reader := bufio.NewReader(fd)
60 | prefix := ""
61 | for {
62 | byteLine, isPrefix, er := reader.ReadLine()
63 | if er != nil && er != io.EOF {
64 | return nil, er
65 | }
66 | line := string(byteLine)
67 | if isPrefix {
68 | prefix += line
69 | continue
70 | }
71 |
72 | line = prefix + line
73 | if re.MatchString(line) {
74 | lines = append(lines, line)
75 | }
76 | if er == io.EOF {
77 | break
78 | }
79 | }
80 | return lines, nil
81 | }
82 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm.go:
--------------------------------------------------------------------------------
1 | package xorm
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "os"
7 | "reflect"
8 | "runtime"
9 | "sync"
10 | )
11 |
12 | const (
13 | Version string = "0.3.1"
14 | )
15 |
16 | func close(engine *Engine) {
17 | engine.Close()
18 | }
19 |
20 | // new a db manager according to the parameter. Currently support four
21 | // drivers
22 | func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
23 | engine := &Engine{DriverName: driverName,
24 | DataSourceName: dataSourceName, Filters: make([]Filter, 0)}
25 | engine.SetMapper(SnakeMapper{})
26 |
27 | if driverName == SQLITE {
28 | engine.dialect = &sqlite3{}
29 | } else if driverName == MYSQL {
30 | engine.dialect = &mysql{}
31 | } else if driverName == POSTGRES {
32 | engine.dialect = &postgres{}
33 | engine.Filters = append(engine.Filters, &PgSeqFilter{})
34 | engine.Filters = append(engine.Filters, &QuoteFilter{})
35 | } else if driverName == MYMYSQL {
36 | engine.dialect = &mymysql{}
37 | } else if driverName == "odbc" {
38 | engine.dialect = &mssql{quoteFilter: &QuoteFilter{}}
39 | engine.Filters = append(engine.Filters, &QuoteFilter{})
40 | } else if driverName == ORACLE_OCI {
41 | engine.dialect = &oracle{}
42 | engine.Filters = append(engine.Filters, &QuoteFilter{})
43 | } else {
44 | return nil, errors.New(fmt.Sprintf("Unsupported driver name: %v", driverName))
45 | }
46 | err := engine.dialect.Init(driverName, dataSourceName)
47 | if err != nil {
48 | return nil, err
49 | }
50 |
51 | engine.Tables = make(map[reflect.Type]*Table)
52 | engine.mutex = &sync.RWMutex{}
53 | engine.TagIdentifier = "xorm"
54 |
55 | engine.Filters = append(engine.Filters, &IdFilter{})
56 | engine.Logger = os.Stdout
57 |
58 | //engine.Pool = NewSimpleConnectPool()
59 | //engine.Pool = NewNoneConnectPool()
60 | //engine.Cacher = NewLRUCacher()
61 | err = engine.SetPool(NewSysConnectPool())
62 | runtime.SetFinalizer(engine, close)
63 | return engine, err
64 | }
65 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/sh_test.go:
--------------------------------------------------------------------------------
1 | package sh
2 |
3 | import (
4 | "runtime"
5 | "testing"
6 | )
7 |
8 | func TestAlias(t *testing.T) {
9 | s := NewSession()
10 | s.Alias("gr", "echo", "hi")
11 | out, err := s.Command("gr", "sky").Output()
12 | if err != nil {
13 | t.Error(err)
14 | }
15 | if string(out) != "hi sky\n" {
16 | t.Errorf("expect 'hi sky' but got:%s", string(out))
17 | }
18 | }
19 |
20 | func TestCommand1(t *testing.T) {
21 | var err error
22 | err = Command("echo", "hello123").Run()
23 | if err != nil {
24 | t.Error(err)
25 | }
26 | }
27 |
28 | /*
29 | func TestCapture(t *testing.T) {
30 | r, err := Capture("echo", []string{"hello"})
31 | if err != nil {
32 | t.Error(err)
33 | }
34 | _ = r
35 | if r.Trim() != "hello" {
36 | t.Errorf("expect hello, but got %s", r.Trim())
37 | }
38 | }
39 | */
40 |
41 | func TestSession(t *testing.T) {
42 | if runtime.GOOS == "windows" {
43 | t.Log("ignore test on windows")
44 | return
45 | }
46 | session := NewSession()
47 | session.ShowCMD = true
48 | err := session.Call("pwd")
49 | if err != nil {
50 | t.Error(err)
51 | }
52 | out, err := session.SetDir("/").Command("pwd").Output()
53 | if err != nil {
54 | t.Error(err)
55 | }
56 | if string(out) != "/\n" {
57 | t.Errorf("expect /, but got %s", string(out))
58 | }
59 | }
60 |
61 | /*
62 | #!/bin/bash -
63 | #
64 | export PATH=/usr/bin:/bin
65 | alias ll='ls -l'
66 | cd /usr
67 | if test -d "local"
68 | then
69 | ll local | awk '{print $1, $NF}' | grep bin
70 | fi
71 | */
72 | func TestExample(t *testing.T) {
73 | s := NewSession()
74 | s.ShowCMD = true
75 | s.Env["PATH"] = "/usr/bin:/bin"
76 | s.SetDir("/usr")
77 | s.Alias("ll", "ls", "-l")
78 | //s.Stdout = nil
79 | if s.Test("d", "local") {
80 | //s.Command("ll", []string{"local"}).Command("awk", []string{"{print $1, $NF}"}).Command("grep", []string{"bin"}).Run()
81 | s.Command("ll", "local").Command("awk", "{print $1, $NF}").Command("grep", "bin").Run()
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/rows.go:
--------------------------------------------------------------------------------
1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2 | //
3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public
6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7 | // You can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | package mysql
10 |
11 | import (
12 | "database/sql/driver"
13 | "io"
14 | )
15 |
16 | type mysqlField struct {
17 | fieldType byte
18 | flags fieldFlag
19 | name string
20 | }
21 |
22 | type mysqlRows struct {
23 | mc *mysqlConn
24 | columns []mysqlField
25 | }
26 |
27 | type binaryRows struct {
28 | mysqlRows
29 | }
30 |
31 | type textRows struct {
32 | mysqlRows
33 | }
34 |
35 | func (rows *mysqlRows) Columns() []string {
36 | columns := make([]string, len(rows.columns))
37 | for i := range columns {
38 | columns[i] = rows.columns[i].name
39 | }
40 | return columns
41 | }
42 |
43 | func (rows *mysqlRows) Close() error {
44 | mc := rows.mc
45 | if mc == nil {
46 | return nil
47 | }
48 | if mc.netConn == nil {
49 | return errInvalidConn
50 | }
51 |
52 | // Remove unread packets from stream
53 | err := mc.readUntilEOF()
54 | rows.mc = nil
55 | return err
56 | }
57 |
58 | func (rows *binaryRows) Next(dest []driver.Value) error {
59 | if mc := rows.mc; mc != nil {
60 | if mc.netConn == nil {
61 | return errInvalidConn
62 | }
63 |
64 | // Fetch next row from stream
65 | if err := rows.readRow(dest); err != io.EOF {
66 | return err
67 | }
68 | rows.mc = nil
69 | }
70 | return io.EOF
71 | }
72 |
73 | func (rows *textRows) Next(dest []driver.Value) error {
74 | if mc := rows.mc; mc != nil {
75 | if mc.netConn == nil {
76 | return errInvalidConn
77 | }
78 |
79 | // Fetch next row from stream
80 | if err := rows.readRow(dest); err != io.EOF {
81 | return err
82 | }
83 | rows.mc = nil
84 | }
85 | return io.EOF
86 | }
87 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/c++.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | //"fmt"
5 | "github.com/lunny/xorm"
6 | "strings"
7 | "text/template"
8 | )
9 |
10 | var (
11 | CPlusTmpl LangTmpl = LangTmpl{
12 | template.FuncMap{"Mapper": mapper.Table2Obj,
13 | "Type": cPlusTypeStr,
14 | "UnTitle": unTitle,
15 | },
16 | nil,
17 | genCPlusImports,
18 | }
19 | )
20 |
21 | func cPlusTypeStr(col *xorm.Column) string {
22 | tp := col.SQLType
23 | name := strings.ToUpper(tp.Name)
24 | switch name {
25 | case xorm.Bit, xorm.TinyInt, xorm.SmallInt, xorm.MediumInt, xorm.Int, xorm.Integer, xorm.Serial:
26 | return "int"
27 | case xorm.BigInt, xorm.BigSerial:
28 | return "__int64"
29 | case xorm.Char, xorm.Varchar, xorm.TinyText, xorm.Text, xorm.MediumText, xorm.LongText:
30 | return "tstring"
31 | case xorm.Date, xorm.DateTime, xorm.Time, xorm.TimeStamp:
32 | return "time_t"
33 | case xorm.Decimal, xorm.Numeric:
34 | return "tstring"
35 | case xorm.Real, xorm.Float:
36 | return "float"
37 | case xorm.Double:
38 | return "double"
39 | case xorm.TinyBlob, xorm.Blob, xorm.MediumBlob, xorm.LongBlob, xorm.Bytea:
40 | return "tstring"
41 | case xorm.Bool:
42 | return "bool"
43 | default:
44 | return "tstring"
45 | }
46 | return ""
47 | }
48 |
49 | func genCPlusImports(tables []*xorm.Table) map[string]string {
50 | imports := make(map[string]string)
51 |
52 | for _, table := range tables {
53 | for _, col := range table.Columns {
54 | switch cPlusTypeStr(col) {
55 | case "time_t":
56 | imports[``] = ``
57 | case "tstring":
58 | imports[""] = ""
59 | //case "__int64":
60 | // imports[""] = ""
61 | }
62 | }
63 | }
64 | return imports
65 | }
66 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/docs/ChangelogCN.md:
--------------------------------------------------------------------------------
1 | ## 更新日志
2 |
3 | * **v0.3.1**
4 |
5 | 新特性:
6 | * 支持 MSSQL DB 通过 ODBC 驱动 ([github.com/lunny/godbc](https://github.com/lunny/godbc));
7 | * 通过多个pk标记支持联合主键;
8 | * 新增 Rows() API 用来遍历查询结果,该函数提供了类似sql.Rows的相似用法,可作为 Iterate() API 的可选替代;
9 | * ORM 结构体现在允许内建类型的指针作为成员,使得数据库为null成为可能;
10 | * Before 和 After 支持
11 |
12 | 改进:
13 | * 允许 int/int32/int64/uint/uint32/uint64/string 作为主键类型
14 | * 查询函数 Get()/Find()/Iterate() 在性能上的改进
15 |
16 | * **v0.2.3** : 改善了文档;提供了乐观锁支持;添加了带时区时间字段支持;Mapper现在分成表名Mapper和字段名Mapper,同时实现了表或字段的自定义前缀后缀;Insert方法的返回值含义从id, err更改为 affected, err,请大家注意;添加了UseBool 和 Distinct函数。
17 | * **v0.2.2** : Postgres驱动新增了对lib/pq的支持;新增了逐条遍历方法Iterate;新增了SetMaxConns(go1.2+)支持,修复了bug若干;
18 | * **v0.2.1** : 新增数据库反转工具,当前支持go和c++代码的生成,详见 [Xorm Tool README](https://github.com/lunny/xorm/blob/master/xorm/README.md); 修复了一些bug.
19 | * **v0.2.0** : 新增 [缓存](https://github.com/lunny/xorm/blob/master/docs/QuickStart.md#120)支持,查询速度提升3-5倍; 新增数据库表和Struct同名的映射方式; 新增Sync同步表结构;
20 | * **v0.1.9** : 新增 postgres 和 mymysql 驱动支持; 在Postgres中支持原始SQL语句中使用 ` 和 ? 符号; 新增Cols, StoreEngine, Charset 函数;SQL语句打印支持io.Writer接口,默认打印到控制台;新增更多的字段类型支持,详见 [映射规则](https://github.com/lunny/xorm/blob/master/docs/QuickStart.md#21);删除废弃的MakeSession和Create函数。
21 | * **v0.1.8** : 新增联合index,联合unique支持,请查看 [映射规则](https://github.com/lunny/xorm/blob/master/docs/QuickStart.md#21)。
22 | * **v0.1.7** : 新增IConnectPool接口以及NoneConnectPool, SysConnectPool, SimpleConnectPool三种实现,可以选择不使用连接池,使用系统连接池和使用自带连接池三种实现,默认为SysConnectPool,即系统自带的连接池。同时支持自定义连接池。Engine新增Close方法,在系统退出时应调用此方法。
23 | * **v0.1.6** : 新增Conversion,支持自定义类型到数据库类型的转换;新增查询结构体自动检测匿名成员支持;新增单向映射支持;
24 | * **v0.1.5** : 新增对多线程的支持;新增Sql()函数;支持任意sql语句的struct查询;Get函数返回值变动;MakeSession和Create函数被NewSession和NewEngine函数替代;
25 | * **v0.1.4** : Get函数和Find函数新增简单的级联载入功能;对更多的数据库类型支持。
26 | * **v0.1.3** : Find函数现在支持传入Slice或者Map,当传入Map时,key为id;新增Table函数以为多表和临时表进行支持。
27 | * **v0.1.2** : Insert函数支持混合struct和slice指针传入,并根据数据库类型自动批量插入,同时自动添加事务
28 | * **v0.1.1** : 添加 Id, In 函数,改善 README 文档
29 | * **v0.1.0** : 初始化工程
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/cae/zip/read.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 cae authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package zip
16 |
17 | import (
18 | "archive/zip"
19 | "os"
20 | "strings"
21 | )
22 |
23 | // OpenFile is the generalized open call; most users will use Open
24 | // instead. It opens the named zip file with specified flag
25 | // (O_RDONLY etc.) if applicable. If successful,
26 | // methods on the returned ZipArchive can be used for I/O.
27 | // If there is an error, it will be of type *PathError.
28 | func (z *ZipArchive) Open(fileName string, flag int, perm os.FileMode) error {
29 | if flag&os.O_CREATE != 0 {
30 | f, err := os.Create(fileName)
31 | if err != nil {
32 | return err
33 | }
34 | zw := zip.NewWriter(f)
35 | zw.Close()
36 | }
37 |
38 | rc, err := zip.OpenReader(fileName)
39 | if err != nil {
40 | return err
41 | }
42 |
43 | z.ReadCloser = rc
44 | z.FileName = fileName
45 | z.Comment = rc.Comment
46 | z.NumFiles = len(rc.File)
47 | z.Flag = flag
48 | z.Permission = perm
49 | z.isHasChanged = false
50 |
51 | z.files = make([]*File, z.NumFiles)
52 | for i, f := range rc.File {
53 | z.files[i] = &File{}
54 | z.files[i].FileHeader, err = zip.FileInfoHeader(f.FileInfo())
55 | if err != nil {
56 | return err
57 | }
58 | z.files[i].Name = strings.Replace(f.Name, "\\", "/", -1)
59 | if f.FileInfo().IsDir() && !strings.HasSuffix(z.files[i].Name, "/") {
60 | z.files[i].Name += "/"
61 | }
62 | }
63 | return nil
64 | }
65 |
--------------------------------------------------------------------------------
/templates/build.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
Badge Markdown: 
9 |
```
10 | [](http://gobuild.io/{{.FullName}})
11 | ```
12 |
13 |
19 |
20 |
21 |
click build to start building.
22 |
23 |
24 |
25 |
26 |
39 |
40 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/regex.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import "regexp"
18 |
19 | const (
20 | regex_email_pattern = `(?i)[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}`
21 | regex_strict_email_pattern = `(?i)[A-Z0-9!#$%&'*+/=?^_{|}~-]+` +
22 | `(?:\.[A-Z0-9!#$%&'*+/=?^_{|}~-]+)*` +
23 | `@(?:[A-Z0-9](?:[A-Z0-9-]*[A-Z0-9])?\.)+` +
24 | `[A-Z0-9](?:[A-Z0-9-]*[A-Z0-9])?`
25 | regex_url_pattern = `(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?`
26 | )
27 |
28 | var (
29 | regex_email *regexp.Regexp
30 | regex_strict_email *regexp.Regexp
31 | regex_url *regexp.Regexp
32 | )
33 |
34 | func init() {
35 | regex_email, _ = regexp.Compile(regex_email_pattern)
36 | regex_strict_email, _ = regexp.Compile(regex_strict_email_pattern)
37 | regex_url, _ = regexp.Compile(regex_url_pattern)
38 | }
39 |
40 | // validate string is an email address, if not return false
41 | // basically validation can match 99% cases
42 | func IsEmail(email string) bool {
43 | return regex_email.MatchString(email)
44 | }
45 |
46 | // validate string is an email address, if not return false
47 | // this validation omits RFC 2822
48 | func IsEmailRFC(email string) bool {
49 | return regex_strict_email.MatchString(email)
50 | }
51 |
52 | // validate string is a url link, if not return false
53 | // simple validation can match 99% cases
54 | func IsUrl(url string) bool {
55 | return regex_url.MatchString(url)
56 | }
57 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/regex_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "testing"
19 | )
20 |
21 | func TestIsEmail(t *testing.T) {
22 | emails := map[string]bool{
23 | `test@example.com`:true,
24 | `single-character@b.org`:true,
25 | `uncommon_address@test.museum`:true,
26 | `local@sld.UPPER`:true,
27 | `@missing.org`:false,
28 | `missing@.com`:false,
29 | `missing@qq.`:false,
30 | `wrong-ip@127.1.1.1.26`:false,
31 | }
32 | for e, r := range emails {
33 | b := IsEmail(e)
34 | if b != r {
35 | t.Errorf("IsEmail:\n Expect => %v\n Got => %v\n", r, b)
36 | }
37 | }
38 | }
39 |
40 | func TestIsUrl(t *testing.T) {
41 | urls := map[string]bool{
42 | "http://www.example.com":true,
43 | "http://example.com":true,
44 | "http://example.com?user=test&password=test":true,
45 | "http://example.com?user=test#login":true,
46 | "ftp://example.com":true,
47 | "https://example.com":true,
48 | "htp://example.com":false,
49 | "http//example.com":false,
50 | "http://example":true,
51 | }
52 | for u, r := range urls {
53 | b := IsUrl(u)
54 | if b != r {
55 | t.Errorf("IsUrl:\n Expect => %v\n Got => %v\n", r, b)
56 | }
57 | }
58 | }
59 |
60 | func BenchmarkIsEmail(b *testing.B) {
61 | for i := 0; i < b.N; i++ {
62 | IsEmail("test@example.com")
63 | }
64 | }
65 |
66 | func BenchmarkIsUrl(b *testing.B) {
67 | for i := 0; i < b.N; i++ {
68 | IsEmail("http://example.com")
69 | }
70 | }
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/util.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 uuid
6 |
7 | import (
8 | "io"
9 | )
10 |
11 | // randomBits completely fills slice b with random data.
12 | func randomBits(b []byte) {
13 | if _, err := io.ReadFull(rander, b); err != nil {
14 | panic(err.Error()) // rand should never fail
15 | }
16 | }
17 |
18 | // xvalues returns the value of a byte as a hexadecimal digit or 255.
19 | var xvalues = []byte{
20 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
21 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
22 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
23 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255,
24 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
25 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
26 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
27 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
28 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
29 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
30 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
31 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
32 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
33 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
34 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
35 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
36 | }
37 |
38 | // xtob converts the the first two hex bytes of x into a byte.
39 | func xtob(x string) (byte, bool) {
40 | b1 := xvalues[x[0]]
41 | b2 := xvalues[x[1]]
42 | return (b1 << 4) | b2, b1 != 255 && b2 != 255
43 | }
44 |
--------------------------------------------------------------------------------
/database/database_test.go:
--------------------------------------------------------------------------------
1 | package database
2 |
3 | import (
4 | "log"
5 | "testing"
6 | )
7 |
8 | func init() {
9 | err := InitDB("mysql", "root@/gobuild")
10 | if err != nil {
11 | log.Fatal(err)
12 | }
13 | }
14 |
15 | /*
16 | func TestSyncProject(t *testing.T) {
17 | l := &Project{
18 | Name: "pp",
19 | Sha: strconv.Itoa(rand.Int()),
20 | }
21 | err := SyncProject(l)
22 | if err != nil {
23 | t.Error(err)
24 | }
25 |
26 | sha, err := GetSha("pp")
27 | if err != nil {
28 | t.Error(err)
29 | }
30 | if l.Sha != sha {
31 | t.Errorf("expect search result(%s), but got %s", l.Sha, sha)
32 | }
33 | }
34 | */
35 |
36 | func TestAddProject(t *testing.T) {
37 | id, err := AddProject("t1", "v1.1", "asdfqwer")
38 | if err != nil {
39 | t.Error(err)
40 | }
41 | if id <= 0 {
42 | t.Errorf("id:%d should not be <= 0", id)
43 | }
44 | t.Log("id =", id)
45 | // clean test env
46 | defer func() {
47 | affec, err := x.Delete(&Project{Name: "t1"})
48 | if err != nil {
49 | t.Error(err)
50 | }
51 | _ = affec
52 | t.Log(affec)
53 | }()
54 |
55 | _, err = SearchProject("t1", "xxx")
56 | if err == nil {
57 | t.Error("search sha:xxx should return nil, but got something")
58 | }
59 |
60 | p, err := SearchProject("t1", "asdfqwer")
61 | if err != nil {
62 | t.Error(err)
63 | }
64 | if p == nil ||
65 | p.ViewCount != 0 ||
66 | p.Name != "t1" ||
67 | p.Sha != "asdfqwer" ||
68 | p.Ref != "v1.1" {
69 | t.Errorf("project should not like that: %#v", p)
70 | }
71 | }
72 |
73 | func TestAddFile(t *testing.T) {
74 | var err error
75 | id, _ := AddProject("t2", "v1.2", "asdfqwer")
76 | // clean test env
77 | defer func() {
78 | x.Delete(&Project{Name: "t2"})
79 | }()
80 | err = AddFile(id, "linux-amd64", "http://", "...")
81 | if err != nil {
82 | t.Error(err)
83 | }
84 |
85 | _, err = SearchFile(id, "xksjf")
86 | if err == nil {
87 | t.Error("search this file should be empty")
88 | }
89 | f, err := SearchFile(id, "linux-amd64")
90 | if err != nil {
91 | t.Error(err)
92 | }
93 | if f == nil || f.ProjId != id || f.Tag != "linux-amd64" {
94 | t.Errorf("should not like that: %#v", f)
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/html.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "html"
19 | "regexp"
20 | "strings"
21 | )
22 |
23 | // Html2JS converts []byte type of HTML content into JS format.
24 | func Html2JS(data []byte) []byte {
25 | s := string(data)
26 | s = strings.Replace(s, `\`, `\\`, -1)
27 | s = strings.Replace(s, "\n", `\n`, -1)
28 | s = strings.Replace(s, "\r", "", -1)
29 | s = strings.Replace(s, "\"", `\"`, -1)
30 | return []byte(s)
31 | }
32 |
33 | // encode html chars to string
34 | func HtmlEncode(str string) string {
35 | return html.EscapeString(str)
36 | }
37 |
38 | // decode string to html chars
39 | func HtmlDecode(str string) string {
40 | return html.UnescapeString(str)
41 | }
42 |
43 | // strip tags in html string
44 | func StripTags(src string) string {
45 | //将HTML标签全转换成小写
46 | re, _ := regexp.Compile("\\<[\\S\\s]+?\\>")
47 | src = re.ReplaceAllStringFunc(src, strings.ToLower)
48 |
49 | //去除STYLE
50 | re, _ = regexp.Compile("\\";
6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d
38 |
39 | `go get github.com/shxsun/klog`
40 |
41 | ```go
42 | package main
43 | import "github.com/shxsun/klog"
44 |
45 | func main(){
46 | // Example 1
47 | // use klog.StdLog, klog.DevLog for logging
48 | klog.StdLog.Warnf("Hello world")
49 | // output: 2013/12/01 12:00:00 [Warn] Hello world
50 | // StdLog default level is Warning
51 |
52 | klog.DevLog.Debugf("Nice")
53 | // output: 2013/12/01 12:00:00 main.go:12 [DEBUG] Hello world
54 |
55 | // Example 2
56 | k2 := klog.NewLogger(nil) // Write to stdout
57 | //k := klog.NewLogger(nil, "option-prefix") // with prefix
58 |
59 | // Example 3
60 | k3, err := klog.NewFileLogger("app.log")
61 | if err != nil { ... }
62 |
63 | k = klog.DevLog
64 | k.Infof("Hi %s.", "Susan")
65 | k.Warn("Oh my god, you are alive!")
66 | k.Error("Yes, but I will go to Mars tomorrow. So only one day with you")
67 | k.Fatal("Oh no, donot leave me again... faint") // Fatal will call os.Exit(1)
68 | }
69 | ```
70 | 
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/xorm/cmd.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "strings"
7 | )
8 |
9 | // A Command is an implementation of a go command
10 | // like go build or go fix.
11 | type Command struct {
12 | // Run runs the command.
13 | // The args are the arguments after the command name.
14 | Run func(cmd *Command, args []string)
15 |
16 | // UsageLine is the one-line usage message.
17 | // The first word in the line is taken to be the command name.
18 | UsageLine string
19 |
20 | // Short is the short description shown in the 'go help' output.
21 | Short string
22 |
23 | // Long is the long message shown in the 'go help ' output.
24 | Long string
25 |
26 | // Flag is a set of flags specific to this command.
27 | Flags map[string]bool
28 | }
29 |
30 | // Name returns the command's name: the first word in the usage line.
31 | func (c *Command) Name() string {
32 | name := c.UsageLine
33 | i := strings.Index(name, " ")
34 | if i >= 0 {
35 | name = name[:i]
36 | }
37 | return name
38 | }
39 |
40 | func (c *Command) Usage() {
41 | fmt.Fprintf(os.Stderr, "usage: %s\n\n", c.UsageLine)
42 | fmt.Fprintf(os.Stderr, "%s\n", strings.TrimSpace(c.Long))
43 | os.Exit(2)
44 | }
45 |
46 | // Runnable reports whether the command can be run; otherwise
47 | // it is a documentation pseudo-command such as importpath.
48 | func (c *Command) Runnable() bool {
49 | return c.Run != nil
50 | }
51 |
52 | // checkFlags checks if the flag exists with correct format.
53 | func checkFlags(flags map[string]bool, args []string, print func(string)) int {
54 | num := 0 // Number of valid flags, use to cut out.
55 | for i, f := range args {
56 | // Check flag prefix '-'.
57 | if !strings.HasPrefix(f, "-") {
58 | // Not a flag, finish check process.
59 | break
60 | }
61 |
62 | // Check if it a valid flag.
63 | if v, ok := flags[f]; ok {
64 | flags[f] = !v
65 | if !v {
66 | print(f)
67 | } else {
68 | fmt.Println("DISABLE: " + f)
69 | }
70 | } else {
71 | fmt.Printf("[ERRO] Unknown flag: %s.\n", f)
72 | return -1
73 | }
74 | num = i + 1
75 | }
76 |
77 | return num
78 | }
79 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/go-sql-driver/mysql/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## Version 1.2 (pending)
2 |
3 | New Features:
4 |
5 | - Logging of critical errors is configurable with `SetLogger`
6 |
7 | Bugfixes:
8 |
9 | - Allow more than 32 parameters in prepared statements
10 |
11 |
12 | ## Version 1.1 (2013-11-02)
13 |
14 | Changes:
15 |
16 | - Go-MySQL-Driver now requires Go 1.1
17 | - Connections now use the collation `utf8_general_ci` by default. Adding `&charset=UTF8` to the DSN should not be necessary anymore
18 | - Made closing rows and connections error tolerant. This allows for example deferring rows.Close() without checking for errors
19 | - `[]byte(nil)` is now treated as a NULL value. Before, it was treated like an empty string / `[]byte("")`
20 | - DSN parameter values must now be url.QueryEscape'ed. This allows text values to contain special characters, such as '&'.
21 | - Use the IO buffer also for writing. This results in zero allocations (by the driver) for most queries
22 | - Optimized the buffer for reading
23 | - stmt.Query now caches column metadata
24 | - New Logo
25 | - Changed the copyright header to include all contributors
26 | - Improved the LOAD INFILE documentation
27 | - The driver struct is now exported to make the driver directly accessible
28 | - Refactored the driver tests
29 | - Added more benchmarks and moved all to a separate file
30 | - Other small refactoring
31 |
32 | New Features:
33 |
34 | - Added *old_passwords* support: Required in some cases, but must be enabled by adding `allowOldPasswords=true` to the DSN since it is insecure
35 | - Added a `clientFoundRows` parameter: Return the number of matching rows instead of the number of rows changed on UPDATEs
36 | - Added TLS/SSL support: Use a TLS/SSL encrypted connection to the server. Custom TLS configs can be registered and used
37 |
38 | Bugfixes:
39 |
40 | - Fixed MySQL 4.1 support: MySQL 4.1 sends packets with lengths which differ from the specification
41 | - Convert to DB timezone when inserting `time.Time`
42 | - Splitted packets (more than 16MB) are now merged correctly
43 | - Fixed false positive `io.EOF` errors when the data was fully read
44 | - Avoid panics on reuse of closed connections
45 | - Fixed empty string producing false nil values
46 | - Fixed sign byte for positive TIME fields
47 |
48 |
49 | ## Version 1.0 (2013-05-14)
50 |
51 | Initial Release
52 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/path.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "errors"
19 | "os"
20 | "path/filepath"
21 | "runtime"
22 | "strings"
23 | )
24 |
25 | // GetGOPATHs returns all paths in GOPATH variable.
26 | func GetGOPATHs() []string {
27 | gopath := os.Getenv("GOPATH")
28 | var paths []string
29 | if runtime.GOOS == "windows" {
30 | gopath = strings.Replace(gopath, "\\", "/", -1)
31 | paths = strings.Split(gopath, ";")
32 | } else {
33 | paths = strings.Split(gopath, ":")
34 | }
35 | return paths
36 | }
37 |
38 | // GetSrcPath returns app. source code path.
39 | // It only works when you have src. folder in GOPATH,
40 | // it returns error not able to locate source folder path.
41 | func GetSrcPath(importPath string) (appPath string, err error) {
42 | paths := GetGOPATHs()
43 | for _, p := range paths {
44 | if IsExist(p + "/src/" + importPath + "/") {
45 | appPath = p + "/src/" + importPath + "/"
46 | break
47 | }
48 | }
49 |
50 | if len(appPath) == 0 {
51 | return "", errors.New("Unable to locate source folder path")
52 | }
53 |
54 | appPath = filepath.Dir(appPath) + "/"
55 | if runtime.GOOS == "windows" {
56 | // Replace all '\' to '/'.
57 | appPath = strings.Replace(appPath, "\\", "/", -1)
58 | }
59 |
60 | return appPath, nil
61 | }
62 |
63 | // HomeDir returns path of '~'(in Linux) on Windows,
64 | // it returns error when the variable does not exist.
65 | func HomeDir() (home string, err error) {
66 | if runtime.GOOS == "windows" {
67 | home = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
68 | if home == "" {
69 | home = os.Getenv("USERPROFILE")
70 | }
71 | } else {
72 | home = os.Getenv("HOME")
73 | }
74 |
75 | if len(home) == 0 {
76 | return "", errors.New("Cannot specify home directory because it's empty")
77 | }
78 |
79 | return home, nil
80 | }
81 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/string_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "testing"
19 | )
20 |
21 | func TestIsLetter(t *testing.T) {
22 | if IsLetter('1') {
23 | t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", false, true)
24 | }
25 |
26 | if IsLetter('[') {
27 | t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", false, true)
28 | }
29 |
30 | if !IsLetter('a') {
31 | t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", true, false)
32 | }
33 |
34 | if !IsLetter('Z') {
35 | t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", true, false)
36 | }
37 | }
38 |
39 | func TestExpand(t *testing.T) {
40 | match := map[string]string{
41 | "domain": "gowalker.org",
42 | "subdomain": "github.com",
43 | }
44 | s := "http://{domain}/{subdomain}/{0}/{1}"
45 | sR := "http://gowalker.org/github.com/Unknwon/gowalker"
46 | if Expand(s, match, "Unknwon", "gowalker") != sR {
47 | t.Errorf("Expand:\n Expect => %s\n Got => %s\n", sR, s)
48 | }
49 | }
50 |
51 | func TestReverse(t *testing.T) {
52 | if Reverse("abcdefg") != "gfedcba" {
53 | t.Errorf("Reverse:\n Except => %s\n Got =>%s\n", "gfedcba", Reverse("abcdefg"))
54 | }
55 | if Reverse("上善若水厚德载物") != "物载德厚水若善上" {
56 | t.Errorf("Reverse:\n Except => %s\n Got =>%s\n", "物载德厚水若善上", Reverse("上善若水厚德载物"))
57 | }
58 | }
59 |
60 | func BenchmarkIsLetter(b *testing.B) {
61 | for i := 0; i < b.N; i++ {
62 | IsLetter('a')
63 | }
64 | }
65 |
66 | func BenchmarkExpand(b *testing.B) {
67 | match := map[string]string{
68 | "domain": "gowalker.org",
69 | "subdomain": "github.com",
70 | }
71 | s := "http://{domain}/{subdomain}/{0}/{1}"
72 | for i := 0; i < b.N; i++ {
73 | Expand(s, match, "Unknwon", "gowalker")
74 | }
75 | }
76 |
77 | func BenchmarkReverse(b *testing.B) {
78 | s := "abscef中文"
79 | for i := 0; i < b.N; i++ {
80 | Reverse(s)
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/api/rs/batch_api.go:
--------------------------------------------------------------------------------
1 | package rs
2 |
3 | import (
4 | "github.com/qiniu/rpc"
5 | . "github.com/qiniu/api.v6/conf"
6 | )
7 |
8 | // ----------------------------------------------------------
9 |
10 | func (rs Client) Batch(l rpc.Logger, ret interface{}, op []string) (err error) {
11 | return rs.Conn.CallWithForm(l, ret, RS_HOST+"/batch", map[string][]string{"op": op})
12 | }
13 |
14 | // ----------------------------------------------------------
15 |
16 | // @gist batchStatItemRet
17 | type BatchStatItemRet struct {
18 | Data Entry `json:"data"`
19 | Error string `json:"error"`
20 | Code int `json:"code"`
21 | }
22 | // @endgist
23 |
24 | // @gist entryPath
25 | type EntryPath struct {
26 | Bucket string
27 | Key string
28 | }
29 | // @endgist
30 |
31 | func (rs Client) BatchStat(l rpc.Logger, entries []EntryPath) (ret []BatchStatItemRet, err error) {
32 |
33 | b := make([]string, len(entries))
34 | for i, e := range entries {
35 | b[i] = URIStat(e.Bucket, e.Key)
36 | }
37 | err = rs.Batch(l, &ret, b)
38 | return
39 | }
40 |
41 | // ----------------------------------------------------------
42 |
43 | // @gist batchItemRet
44 | type BatchItemRet struct {
45 | Error string `json:"error"`
46 | Code int `json:"code"`
47 | }
48 | // @endgist
49 |
50 | func (rs Client) BatchDelete(l rpc.Logger, entries []EntryPath) (ret []BatchItemRet, err error) {
51 |
52 | b := make([]string, len(entries))
53 | for i, e := range entries {
54 | b[i] = URIDelete(e.Bucket, e.Key)
55 | }
56 | err = rs.Batch(l, &ret, b)
57 | return
58 | }
59 |
60 | // ----------------------------------------------------------
61 |
62 | // @gist entryPathPair
63 | type EntryPathPair struct {
64 | Src EntryPath
65 | Dest EntryPath
66 | }
67 | // @endgist
68 |
69 | func (rs Client) BatchMove(l rpc.Logger, entries []EntryPathPair) (ret []BatchItemRet, err error) {
70 |
71 | b := make([]string, len(entries))
72 | for i, e := range entries {
73 | b[i] = URIMove(e.Src.Bucket, e.Src.Key, e.Dest.Bucket, e.Dest.Key)
74 | }
75 | err = rs.Batch(l, &ret, b)
76 | return
77 | }
78 |
79 | func (rs Client) BatchCopy(l rpc.Logger, entries []EntryPathPair) (ret []BatchItemRet, err error) {
80 |
81 | b := make([]string, len(entries))
82 | for i, e := range entries {
83 | b[i] = URICopy(e.Src.Bucket, e.Src.Key, e.Dest.Bucket, e.Dest.Key)
84 | }
85 | err = rs.Batch(l, &ret, b)
86 | return
87 | }
88 |
89 | // ----------------------------------------------------------
90 |
91 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-uuid/dce.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 Google Inc. 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 uuid
6 |
7 | import (
8 | "encoding/binary"
9 | "fmt"
10 | "os"
11 | )
12 |
13 | // A Domain represents a Version 2 domain
14 | type Domain byte
15 |
16 | // Domain constants for DCE Security (Version 2) UUIDs.
17 | const (
18 | Person = Domain(0)
19 | Group = Domain(1)
20 | Org = Domain(2)
21 | )
22 |
23 | // NewDCESecurity returns a DCE Security (Version 2) UUID.
24 | //
25 | // The domain should be one of Person, Group or Org.
26 | // On a POSIX system the id should be the users UID for the Person
27 | // domain and the users GID for the Group. The meaning of id for
28 | // the domain Org or on non-POSIX systems is site defined.
29 | //
30 | // For a given domain/id pair the same token may be returned for up to
31 | // 7 minutes and 10 seconds.
32 | func NewDCESecurity(domain Domain, id uint32) UUID {
33 | uuid := NewUUID()
34 | if uuid != nil {
35 | uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2
36 | uuid[9] = byte(domain)
37 | binary.BigEndian.PutUint32(uuid[0:], id)
38 | }
39 | return uuid
40 | }
41 |
42 | // NewDCEPerson returns a DCE Security (Version 2) UUID in the person
43 | // domain with the id returned by os.Getuid.
44 | //
45 | // NewDCEPerson(Person, uint32(os.Getuid()))
46 | func NewDCEPerson() UUID {
47 | return NewDCESecurity(Person, uint32(os.Getuid()))
48 | }
49 |
50 | // NewDCEGroup returns a DCE Security (Version 2) UUID in the group
51 | // domain with the id returned by os.Getgid.
52 | //
53 | // NewDCEGroup(Group, uint32(os.Getgid()))
54 | func NewDCEGroup() UUID {
55 | return NewDCESecurity(Group, uint32(os.Getgid()))
56 | }
57 |
58 | // Domain returns the domain for a Version 2 UUID or false.
59 | func (uuid UUID) Domain() (Domain, bool) {
60 | if v, _ := uuid.Version(); v != 2 {
61 | return 0, false
62 | }
63 | return Domain(uuid[9]), true
64 | }
65 |
66 | // Id returns the id for a Version 2 UUID or false.
67 | func (uuid UUID) Id() (uint32, bool) {
68 | if v, _ := uuid.Version(); v != 2 {
69 | return 0, false
70 | }
71 | return binary.BigEndian.Uint32(uuid[0:4]), true
72 | }
73 |
74 | func (d Domain) String() string {
75 | switch d {
76 | case Person:
77 | return "Person"
78 | case Group:
79 | return "Group"
80 | case Org:
81 | return "Org"
82 | }
83 | return fmt.Sprintf("Domain%d", int(d))
84 | }
85 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/Unknwon/com/time.go:
--------------------------------------------------------------------------------
1 | // Copyright 2013 com authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may
4 | // not use this file except in compliance with the License. You may obtain
5 | // a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | // License for the specific language governing permissions and limitations
13 | // under the License.
14 |
15 | package com
16 |
17 | import (
18 | "time"
19 | "strings"
20 | "fmt"
21 | "strconv"
22 | )
23 |
24 | // Format unix time int64 to string
25 | func Date(ti int64, format string) string {
26 | t := time.Unix(int64(ti), 0)
27 | return DateT(t, format)
28 | }
29 |
30 | // Format unix time string to string
31 | func DateS(ts string, format string) string {
32 | i, _ := strconv.ParseInt(ts, 10, 64)
33 | return Date(i, format)
34 | }
35 |
36 | // Format time.Time struct to string
37 | // MM - month - 01
38 | // M - month - 1, single bit
39 | // DD - day - 02
40 | // D - day 2
41 | // YYYY - year - 2006
42 | // YY - year - 06
43 | // HH - 24 hours - 03
44 | // H - 24 hours - 3
45 | // hh - 12 hours - 03
46 | // h - 12 hours - 3
47 | // mm - minute - 04
48 | // m - minute - 4
49 | // ss - second - 05
50 | // s - second = 5
51 | func DateT(t time.Time, format string) string {
52 | res := strings.Replace(format, "MM", t.Format("01"), -1)
53 | res = strings.Replace(res, "M", t.Format("1"), -1)
54 | res = strings.Replace(res, "DD", t.Format("02"), -1)
55 | res = strings.Replace(res, "D", t.Format("2"), -1)
56 | res = strings.Replace(res, "YYYY", t.Format("2006"), -1)
57 | res = strings.Replace(res, "YY", t.Format("06"), -1)
58 | res = strings.Replace(res, "HH", fmt.Sprintf("%02d", t.Hour()), -1)
59 | res = strings.Replace(res, "H", fmt.Sprintf("%d", t.Hour()), -1)
60 | res = strings.Replace(res, "hh", t.Format("03"), -1)
61 | res = strings.Replace(res, "h", t.Format("3"), -1)
62 | res = strings.Replace(res, "mm", t.Format("04"), -1)
63 | res = strings.Replace(res, "m", t.Format("4"), -1)
64 | res = strings.Replace(res, "ss", t.Format("05"), -1)
65 | res = strings.Replace(res, "s", t.Format("5"), -1)
66 | return res
67 | }
68 |
69 | // Get unix stamp int64 of now
70 | func Now() int64 {
71 | return time.Now().Unix()
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/utils/broadcast.go:
--------------------------------------------------------------------------------
1 | // broadcast package
2 | // some code from dotcloud/docker
3 | package utils
4 |
5 | import (
6 | "bytes"
7 | "errors"
8 | "io"
9 | "sync"
10 | "time"
11 | )
12 |
13 | type StreamWriter struct {
14 | wc io.WriteCloser
15 | stream string
16 | }
17 |
18 | type WriteBroadcaster struct {
19 | sync.Mutex
20 | buf *bytes.Buffer
21 | writers map[StreamWriter]bool
22 | closed bool
23 | }
24 |
25 | func NewWriteBroadcaster() *WriteBroadcaster {
26 | bc := &WriteBroadcaster{
27 | writers: make(map[StreamWriter]bool),
28 | buf: bytes.NewBuffer(nil),
29 | closed: false,
30 | }
31 | return bc
32 | }
33 |
34 | func (w *WriteBroadcaster) AddWriter(writer io.WriteCloser, stream string) {
35 | w.Lock()
36 | defer w.Unlock()
37 | if w.closed {
38 | writer.Close()
39 | return
40 | }
41 | sw := StreamWriter{wc: writer, stream: stream}
42 | w.writers[sw] = true
43 | }
44 |
45 | func (wb *WriteBroadcaster) Closed() bool {
46 | return wb.closed
47 | }
48 |
49 | func (wb *WriteBroadcaster) NewReader(name string) ([]byte, *io.PipeReader) {
50 | r, w := io.Pipe()
51 | wb.AddWriter(w, name)
52 | return wb.buf.Bytes(), r
53 | }
54 |
55 | func (wb *WriteBroadcaster) Bytes() []byte {
56 | return wb.buf.Bytes()
57 | }
58 |
59 | func (w *WriteBroadcaster) Write(p []byte) (n int, err error) {
60 | w.Lock()
61 | defer w.Unlock()
62 | w.buf.Write(p)
63 | for sw := range w.writers {
64 | // set write timeout
65 | err = GoTimeout(func() error {
66 | if n, err := sw.wc.Write(p); err != nil || n != len(p) {
67 | return errors.New("broadcast to " + sw.stream + " error")
68 | }
69 | return nil
70 | }, time.Second*1)
71 | if err != nil {
72 | // On error, evict the writer
73 | Debugf("broadcase write error: %s, %s", sw.stream, err)
74 | delete(w.writers, sw)
75 | }
76 | }
77 | return len(p), nil
78 | }
79 |
80 | func (w *WriteBroadcaster) CloseWriters() error {
81 | w.Lock()
82 | defer w.Unlock()
83 | for sw := range w.writers {
84 | sw.wc.Close()
85 | }
86 | w.writers = make(map[StreamWriter]bool)
87 | w.closed = true
88 | return nil
89 | }
90 |
91 | // nop writer
92 | type NopWriter struct{}
93 |
94 | func (*NopWriter) Write(buf []byte) (int, error) {
95 | return len(buf), nil
96 | }
97 |
98 | type nopWriteCloser struct {
99 | io.Writer
100 | }
101 |
102 | func (w *nopWriteCloser) Close() error { return nil }
103 |
104 | func NopWriteCloser(w io.Writer) io.WriteCloser {
105 | return &nopWriteCloser{w}
106 | }
107 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/cache.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "github.com/lunny/xorm"
6 | _ "github.com/mattn/go-sqlite3"
7 | "os"
8 | )
9 |
10 | type User struct {
11 | Id int64
12 | Name string
13 | }
14 |
15 | func main() {
16 | f := "cache.db"
17 | os.Remove(f)
18 |
19 | Orm, err := xorm.NewEngine("sqlite3", f)
20 | if err != nil {
21 | fmt.Println(err)
22 | return
23 | }
24 | Orm.ShowSQL = true
25 | cacher := xorm.NewLRUCacher(xorm.NewMemoryStore(), 1000)
26 | Orm.SetDefaultCacher(cacher)
27 |
28 | err = Orm.CreateTables(&User{})
29 | if err != nil {
30 | fmt.Println(err)
31 | return
32 | }
33 |
34 | _, err = Orm.Insert(&User{Name: "xlw"})
35 | if err != nil {
36 | fmt.Println(err)
37 | return
38 | }
39 |
40 | users := make([]User, 0)
41 | err = Orm.Find(&users)
42 | if err != nil {
43 | fmt.Println(err)
44 | return
45 | }
46 |
47 | fmt.Println("users:", users)
48 |
49 | users2 := make([]User, 0)
50 |
51 | err = Orm.Find(&users2)
52 | if err != nil {
53 | fmt.Println(err)
54 | return
55 | }
56 |
57 | fmt.Println("users2:", users2)
58 |
59 | users3 := make([]User, 0)
60 |
61 | err = Orm.Find(&users3)
62 | if err != nil {
63 | fmt.Println(err)
64 | return
65 | }
66 |
67 | fmt.Println("users3:", users3)
68 |
69 | user4 := new(User)
70 | has, err := Orm.Id(1).Get(user4)
71 | if err != nil {
72 | fmt.Println(err)
73 | return
74 | }
75 |
76 | fmt.Println("user4:", has, user4)
77 |
78 | user4.Name = "xiaolunwen"
79 | _, err = Orm.Id(1).Update(user4)
80 | if err != nil {
81 | fmt.Println(err)
82 | return
83 | }
84 | fmt.Println("user4:", user4)
85 |
86 | user5 := new(User)
87 | has, err = Orm.Id(1).Get(user5)
88 | if err != nil {
89 | fmt.Println(err)
90 | return
91 | }
92 | fmt.Println("user5:", has, user5)
93 |
94 | _, err = Orm.Id(1).Delete(new(User))
95 | if err != nil {
96 | fmt.Println(err)
97 | return
98 | }
99 |
100 | for {
101 | user6 := new(User)
102 | has, err = Orm.Id(1).Get(user6)
103 | if err != nil {
104 | fmt.Println(err)
105 | return
106 | }
107 | fmt.Println("user6:", has, user6)
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-sh/README.md:
--------------------------------------------------------------------------------
1 | ## go-sh
2 | [](https://drone.io/github.com/shxsun/go-sh/latest)
3 | [](http://gowalker.org/github.com/shxsun/go-sh)
4 |
5 | *for the better grow of this package. some change may influence the old users, the old-code has tag: v0.1*
6 |
7 | install: `go get github.com/shxsun/go-sh`
8 |
9 | I like os/exec, so this golang package go-sh, is very like os/exec. But it really have some better experience than os/exec.
10 |
11 | There are some features, listed bellow.
12 |
13 | * keep the variable environment (like export)
14 | * alias support (like alias in shell)
15 | * remember current dir
16 | * pipe command
17 | * shell build-in command test
18 |
19 | Example is always important. I will show you how to use it.
20 |
21 | sh: echo hello
22 | go: sh.Command("echo", "hello").Run()
23 |
24 | sh: export BUILD_ID=123
25 | go: s = sh.NewSession().SetEnv("BUILD_ID", "123")
26 |
27 | sh: alias ll='ls -l'
28 | go: s = sh.NewSession().Alias('ll', 'ls', '-l')
29 |
30 | sh: (cd /; pwd)
31 | go: sh.Command("pwd", sh.Dir("/")).Run()
32 |
33 | sh: test -d data || mkdir data
34 | go: if ! sh.Test("dir", "data") { sh.Command("mkdir", "data").Run() }
35 |
36 | sh: echo hello world | awk '{print $1}'
37 | go: sh.Command("echo", "hello", "world").Command("awk", "{print $1}").Run()
38 |
39 | sh: msg=$(echo hi)
40 | go: msg, err := sh.Command("echo", "hi").Output()
41 |
42 | If you need to keep env and dir, it is better to create a session
43 |
44 | session := sh.NewSession()
45 | session.SetEnv("BUILD_ID", "123")
46 | session.SetDir("/")
47 | # then call cmd
48 | session.Command("echo", "hello").Run()
49 | # set ShowCMD to true for easily debug
50 | session.ShowCmd = true
51 |
52 | for more information, it better to see docs.
53 | [](http://gowalker.org/github.com/shxsun/go-sh)
54 |
55 | ### contribute
56 | If you love this project, star it which will encourage the coder. pull requests are welcomed, if you want to add some new fetures.
57 |
58 | support the author: [alipay](https://me.alipay.com/goskyblue)
59 |
60 | ### thanks
61 | this project is based on . thanks for the author.
62 |
63 | # the reason to use golang shell
64 | So what is go-sh. Sometimes we need to write some shell scripts, but shell scripts is not good at cross platform, but golang is good at that. Is there a good way to use golang to write scripts like shell? Use go-sh we can do it now.
65 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/qiniu/api/rs/rs_api.go:
--------------------------------------------------------------------------------
1 | package rs
2 |
3 | import (
4 | "net/http"
5 | "encoding/base64"
6 | "github.com/qiniu/rpc"
7 | "github.com/qiniu/api.v6/auth/digest"
8 | . "github.com/qiniu/api.v6/conf"
9 | )
10 |
11 | // ----------------------------------------------------------
12 |
13 | type Client struct {
14 | Conn rpc.Client
15 | }
16 |
17 | func New(mac *digest.Mac) Client {
18 | t := digest.NewTransport(mac, nil)
19 | client := &http.Client{Transport: t}
20 | return Client{rpc.Client{client}}
21 | }
22 |
23 | func NewEx(t http.RoundTripper) Client {
24 | client := &http.Client{Transport: t}
25 | return Client{rpc.Client{client}}
26 | }
27 |
28 | // ----------------------------------------------------------
29 |
30 | // @gist entry
31 | type Entry struct {
32 | Hash string `json:"hash"`
33 | Fsize int64 `json:"fsize"`
34 | PutTime int64 `json:"putTime"`
35 | MimeType string `json:"mimeType"`
36 | Customer string `json:"customer"`
37 | }
38 | // @endgist
39 |
40 | func (rs Client) Stat(l rpc.Logger, bucket, key string) (entry Entry, err error) {
41 | err = rs.Conn.Call(l, &entry, RS_HOST + URIStat(bucket, key))
42 | return
43 | }
44 |
45 | func (rs Client) Delete(l rpc.Logger, bucket, key string) (err error) {
46 | return rs.Conn.Call(l, nil, RS_HOST + URIDelete(bucket, key))
47 | }
48 |
49 | func (rs Client) Move(l rpc.Logger, bucketSrc, keySrc, bucketDest, keyDest string) (err error) {
50 | return rs.Conn.Call(l, nil, RS_HOST + URIMove(bucketSrc, keySrc, bucketDest, keyDest))
51 | }
52 |
53 | func (rs Client) Copy(l rpc.Logger, bucketSrc, keySrc, bucketDest, keyDest string) (err error) {
54 | return rs.Conn.Call(l, nil, RS_HOST + URICopy(bucketSrc, keySrc, bucketDest, keyDest))
55 | }
56 |
57 | // ----------------------------------------------------------
58 |
59 | func encodeURI(uri string) string {
60 | return base64.URLEncoding.EncodeToString([]byte(uri))
61 | }
62 |
63 | func URIDelete(bucket, key string) string {
64 | return "/delete/" + encodeURI(bucket + ":" + key)
65 | }
66 |
67 | func URIStat(bucket, key string) string {
68 | return "/stat/" + encodeURI(bucket + ":" + key)
69 | }
70 |
71 | func URICopy(bucketSrc, keySrc, bucketDest, keyDest string) string {
72 | return "/copy/" + encodeURI(bucketSrc + ":" + keySrc) + "/" + encodeURI(bucketDest + ":" + keyDest)
73 | }
74 |
75 | func URIMove(bucketSrc, keySrc, bucketDest, keyDest string) string {
76 | return "/move/" + encodeURI(bucketSrc + ":" + keySrc) + "/" + encodeURI(bucketDest + ":" + keyDest)
77 | }
78 |
79 | // ----------------------------------------------------------
80 |
81 |
--------------------------------------------------------------------------------
/publish/achieve.go:
--------------------------------------------------------------------------------
1 | package publish
2 |
3 | import (
4 | "os"
5 | "path/filepath"
6 | "strings"
7 |
8 | "github.com/Unknwon/cae/zip"
9 | "github.com/codeskyblue/gobuild/utils"
10 | "github.com/qiniu/log"
11 | )
12 |
13 | type FileSet struct {
14 | Includes []string `yaml:"includes"`
15 | Excludes []string `yaml:"excludes"`
16 | }
17 |
18 | type BuildConfig struct {
19 | Framework string `yaml:"framework"`
20 | FileSet `yaml:"filesets"`
21 | }
22 |
23 | // basic regrex match
24 | func match(bre string, str string) bool {
25 | if bre == str { // FIXME: use re
26 | return true
27 | }
28 | return false
29 | }
30 |
31 | func pkgZip(root string, files []string) (path string, err error) {
32 | tmpFile, err := utils.TempFile("files", "tmp-", "-"+filepath.Base(root)+".zip")
33 | if err != nil {
34 | return
35 | }
36 |
37 | z, err := zip.Create(tmpFile)
38 | if err != nil {
39 | return
40 | }
41 | for _, f := range files {
42 | var save string
43 | // binary file use abspath
44 | if strings.HasSuffix(root, f) {
45 | save = f[len(root):]
46 | } else {
47 | save = filepath.Base(f)
48 | }
49 | info, er := os.Stat(f)
50 | if er != nil {
51 | continue
52 | }
53 | log.Debug("add", save, f)
54 | if info.IsDir() {
55 | if err = z.AddDir(save, f); err != nil {
56 | return
57 | }
58 | } else {
59 | if err = z.AddFile(save, f); err != nil {
60 | return
61 | }
62 | }
63 | }
64 | if err = z.Close(); err != nil {
65 | log.Error(err)
66 | return
67 | }
68 | return tmpFile, nil
69 | }
70 |
71 | /*
72 | func (b *Builder) pack(bins []string, rcfile string) (path string, err error) {
73 | log.Debug(bins)
74 | log.Debug(rcfile)
75 | data, err := ioutil.ReadFile(rcfile)
76 | if err != nil {
77 | log.Error(err)
78 | log.Debug("use default rc")
79 | data, err = ioutil.ReadFile("public/gobuildrc")
80 | if err != nil {
81 | log.Error(err)
82 | }
83 | }
84 | ass := new(Assembly)
85 | err = goyaml.Unmarshal(data, ass)
86 | if err != nil {
87 | return
88 | }
89 | dir := filepath.Dir(rcfile)
90 | fs, err := ioutil.ReadDir(dir)
91 | if err != nil {
92 | return
93 | }
94 | var includes = bins // this may change slice bins
95 | for _, f := range fs {
96 | var ok = false
97 | for _, patten := range ass.Includes {
98 | if match(patten, f.Name()) {
99 | ok = true
100 | break
101 | }
102 | }
103 |
104 | if ok {
105 | includes = append(includes, filepath.Join(dir, f.Name()))
106 | }
107 | }
108 | return pkgZip(dir, includes)
109 | }
110 | */
111 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/lunny/xorm/examples/sync.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | _ "github.com/bylevel/pq"
6 | _ "github.com/go-sql-driver/mysql"
7 | "github.com/lunny/xorm"
8 | _ "github.com/mattn/go-sqlite3"
9 | )
10 |
11 | type SyncUser2 struct {
12 | Id int64
13 | Name string `xorm:"unique"`
14 | Age int `xorm:"index"`
15 | Title string
16 | Address string
17 | Genre string
18 | Area string
19 | Date int
20 | }
21 |
22 | type SyncLoginInfo2 struct {
23 | Id int64
24 | IP string `xorm:"index"`
25 | UserId int64
26 | AddedCol int
27 | // timestamp should be updated by database, so only allow get from db
28 | TimeStamp string
29 | // assume
30 | Nonuse int `xorm:"unique"`
31 | Newa string `xorm:"index"`
32 | }
33 |
34 | func sync(engine *xorm.Engine) error {
35 | return engine.Sync(&SyncLoginInfo2{}, &SyncUser2{})
36 | }
37 |
38 | func sqliteEngine() (*xorm.Engine, error) {
39 | f := "sync.db"
40 | //os.Remove(f)
41 |
42 | return xorm.NewEngine("sqlite3", f)
43 | }
44 |
45 | func mysqlEngine() (*xorm.Engine, error) {
46 | return xorm.NewEngine("mysql", "root:@/test?charset=utf8")
47 | }
48 |
49 | func postgresEngine() (*xorm.Engine, error) {
50 | return xorm.NewEngine("postgres", "dbname=xorm_test sslmode=disable")
51 | }
52 |
53 | type engineFunc func() (*xorm.Engine, error)
54 |
55 | func main() {
56 | //engines := []engineFunc{sqliteEngine, mysqlEngine, postgresEngine}
57 | //engines := []engineFunc{sqliteEngine}
58 | //engines := []engineFunc{mysqlEngine}
59 | engines := []engineFunc{postgresEngine}
60 | for _, enginefunc := range engines {
61 | Orm, err := enginefunc()
62 | fmt.Println("--------", Orm.DriverName, "----------")
63 | if err != nil {
64 | fmt.Println(err)
65 | return
66 | }
67 | Orm.ShowSQL = true
68 | err = sync(Orm)
69 | if err != nil {
70 | fmt.Println(err)
71 | }
72 |
73 | _, err = Orm.Where("id > 0").Delete(&SyncUser2{})
74 | if err != nil {
75 | fmt.Println(err)
76 | }
77 |
78 | user := &SyncUser2{
79 | Name: "testsdf",
80 | Age: 15,
81 | Title: "newsfds",
82 | Address: "fasfdsafdsaf",
83 | Genre: "fsafd",
84 | Area: "fafdsafd",
85 | Date: 1000,
86 | }
87 | _, err = Orm.Insert(user)
88 | if err != nil {
89 | fmt.Println(err)
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/Godeps/_workspace/src/github.com/shxsun/go-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 | // DialConfig opens a new client connection to a WebSocket with a config.
68 | func DialConfig(config *Config) (ws *Conn, err error) {
69 | var client net.Conn
70 | if config.Location == nil {
71 | return nil, &DialError{config, ErrBadWebSocketLocation}
72 | }
73 | if config.Origin == nil {
74 | return nil, &DialError{config, ErrBadWebSocketOrigin}
75 | }
76 | switch config.Location.Scheme {
77 | case "ws":
78 | client, err = net.Dial("tcp", config.Location.Host)
79 |
80 | case "wss":
81 | client, err = tls.Dial("tcp", config.Location.Host, config.TlsConfig)
82 |
83 | default:
84 | err = ErrBadScheme
85 | }
86 | if err != nil {
87 | goto Error
88 | }
89 |
90 | ws, err = NewClient(config, client)
91 | if err != nil {
92 | goto Error
93 | }
94 | return
95 |
96 | Error:
97 | return nil, &DialError{config, err}
98 | }
99 |
--------------------------------------------------------------------------------
/assembly.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "io/ioutil"
5 | "os"
6 | "path/filepath"
7 | "strings"
8 |
9 | "github.com/Unknwon/cae/zip"
10 | "github.com/codeskyblue/gobuild/utils"
11 | "github.com/codeskyblue/goyaml"
12 | "github.com/qiniu/log"
13 | )
14 |
15 | type FileSet struct {
16 | Includes []string `yaml:"includes"`
17 | Excludes []string `yaml:"excludes"`
18 | }
19 |
20 | type Assembly struct {
21 | Framework string `yaml:"framework"`
22 | FileSet `yaml:"filesets"`
23 | }
24 |
25 | // basic regrex match
26 | func match(bre string, str string) bool {
27 | if bre == str { // FIXME: use re
28 | return true
29 | }
30 | return false
31 | }
32 |
33 | func pkgZip(root string, files []string) (path string, err error) {
34 | log.Info("package to zip:", path)
35 | tmpFile, err := utils.TempFile("files", "tmp-", "-"+filepath.Base(root)+".zip")
36 | if err != nil {
37 | return
38 | }
39 |
40 | z, err := zip.Create(tmpFile)
41 | if err != nil {
42 | return
43 | }
44 | for _, f := range files {
45 | var save string
46 | if f == "" {
47 | continue
48 | }
49 | // binary file use abspath
50 | //fmt.Println(root, f)
51 | if strings.HasSuffix(f, root) {
52 | save = f[len(root):]
53 | } else {
54 | save = filepath.Base(f)
55 | }
56 | info, er := os.Stat(f)
57 | if er != nil {
58 | continue
59 | }
60 | log.Debug("add", save, f)
61 | if info.IsDir() {
62 | if err = z.AddDir(save, f); err != nil {
63 | return
64 | }
65 | } else {
66 | if err = z.AddFile(save, f); err != nil {
67 | return
68 | }
69 | }
70 | }
71 | if err = z.Close(); err != nil {
72 | log.Error(err)
73 | return
74 | }
75 | return tmpFile, nil
76 |
77 | }
78 |
79 | func (b *Builder) pack(bins []string, rcfile string) (path string, err error) {
80 | log.Debug(bins)
81 | log.Debug(rcfile)
82 | data, err := ioutil.ReadFile(rcfile)
83 | if err != nil {
84 | log.Debug("use default rc")
85 | data, err = ioutil.ReadFile("public/gobuildrc")
86 | if err != nil {
87 | log.Error(err)
88 | }
89 | }
90 | ass := new(Assembly)
91 | err = goyaml.Unmarshal(data, ass)
92 | if err != nil {
93 | return
94 | }
95 | dir := filepath.Dir(rcfile)
96 | fs, err := ioutil.ReadDir(dir)
97 | if err != nil {
98 | return
99 | }
100 | var includes = bins // this may change slice bins
101 | for _, f := range fs {
102 | var ok = false
103 | for _, patten := range ass.Includes {
104 | if match(patten, f.Name()) {
105 | ok = true
106 | break
107 | }
108 | }
109 |
110 | if ok {
111 | includes = append(includes, filepath.Join(dir, f.Name()))
112 | }
113 | }
114 | return pkgZip(dir, includes)
115 | }
116 |
--------------------------------------------------------------------------------