Browse Source

add document and some improved

pull/103/head
Lunny Xiao 11 years ago
parent
commit
4bdcfef6d8
  1. 1
      .gitignore
  2. 63
      README.md
  3. 19
      cmd/cmd.go
  4. 6
      cmd/gopath.go
  5. 3
      gopm.go

1
.gitignore vendored

@ -3,3 +3,4 @@ gopm
*.exe
*.exe~
repos/
vendor/

63
README.md

@ -6,3 +6,66 @@ gopm - Go Package Manager
gopm(Go Package Manager) is a Go package manage tool for search, install, update and share packages in Go.
**Attention** This application still in experiment, we'are working on new break version, you may use [old version](https://github.com/gpmgo/gopm/tree/v0.1.0) for now.
# Requirement
Currently, gopm use soft syb link
# INSTALL
You should install Go and Go tool before install gopm currently.
```
go get github.com/gpmgo/gopm
```
This will install gopm on $GOPATH$/bin。Before using gopm, you should add this to $PATH.
# Features
* Don't need to install git, svn, hg etct. for installing packages.
* Package has version
* Every project has owner GOPATH
* Put your Go project on anywhere you want
# Commands
1. Show the command help
```
gopm help
```
2. Show gopm version
```
gopm version
```
3. Get a package
```
gopm get github.com/gpmgo/gopm
```
4. Search a package
```
gopm search gopm
```
5. Build a project, the build's arguments are the same as go build. But it will check all the dependencies and dowload them.
```
<change to project directory>
gopm build
```
6. Run a go file
```
<change to project directory>
gopm run main.go
```
7. Install
```
<change to project directory>
gopm install
```

19
cmd/cmd.go

@ -20,6 +20,8 @@ import (
"strings"
)
const APP_VER = "0.5.0.1103"
var (
AppPath string
reposDir string = "~/.gopm/repos"
@ -67,3 +69,20 @@ func (c *Command) Usage() {
func (c *Command) Runnable() bool {
return c.Run != nil
}
var CmdVersion = &Command{
UsageLine: "version",
Short: "show version",
Long: `
show version
`,
}
func runVersion(cmd *Command, args []string) {
fmt.Println(APP_VER)
}
func init() {
CmdVersion.Run = runVersion
CmdVersion.Flags = map[string]bool{}
}

6
cmd/gopath.go

@ -179,6 +179,12 @@ func genNewGoPath() {
com.ColorLog("[ERRO] make link error %v\n", err)
return
}
com.ColorLog("[INFO] change dir to %v\n", newPath)
err = os.Chdir(newPath)
if err != nil {
com.ColorLog("[ERRO] change current directory error %v\n", err)
return
}
}
com.ColorLog("[TRAC] set GOPATH=%v\n", newGoPath)

3
gopm.go

@ -33,7 +33,6 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true
const APP_VER = "0.4.0.1012"
var (
config map[string]interface{}
@ -48,6 +47,7 @@ var commands = []*cmd.Command{
cmd.CmdGen,
cmd.CmdBuild,
cmd.CmdRun,
cmd.CmdVersion,
/*cmd.CmdInstall,
cmdClean,
@ -58,7 +58,6 @@ var commands = []*cmd.Command{
cmdList,
cmdTest,
cmdTool,
cmdVersion,
cmdVet,
helpGopath,

Loading…
Cancel
Save