From 1b362cc4207c81840dc6bb3a6f058de50a271e93 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 24 May 2013 22:19:50 -0400 Subject: [PATCH] change name to gopm --- README.md | 18 +++++++++--------- README_ZH.md | 6 +++--- conf/{gpm.toml => gopm.toml} | 0 docs/Quick_Start.md | 28 ++++++++++++++-------------- gpm.go => gopm.go | 0 gpm_test.go => gopm_test.go | 9 ++++----- i18n/en-US/prompt.txt | 2 +- i18n/en-US/usage_install.txt | 4 ++-- i18n/zh-CN/prompt.txt | 2 +- i18n/zh-CN/usage_install.txt | 4 ++-- install.go | 12 ++++++------ 11 files changed, 42 insertions(+), 43 deletions(-) rename conf/{gpm.toml => gopm.toml} (100%) rename gpm.go => gopm.go (100%) rename gpm_test.go => gopm_test.go (84%) diff --git a/README.md b/README.md index e1d6ec1e2..4adc40e36 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -gpm - Go Package Manager +gopm - Go Package Manager === ![GPMGo_Logo](https://raw.github.com/GPMGo/gpm-site/master/static/img/gpmgo2.png?raw=true) -gpm(Go Package Manager) is a Go package manage tool for search, install, update, share and backup packages in Go. +gopm(Go Package Manager) is a Go package manage tool for search, install, update, share and backup packages in Go. -[![Build Status](https://travis-ci.org/GPMGo/gpm.png)](https://travis-ci.org/GPMGo/gpm) [![Build Status](https://drone.io/github.com/GPMGo/gpm/status.png)](https://drone.io/github.com/GPMGo/gpm/latest) [![Coverage Status](https://coveralls.io/repos/GPMGo/gpm/badge.png)](https://coveralls.io/r/GPMGo/gpm) +[![Build Status](https://travis-ci.org/GPMGo/gopm.png)](https://travis-ci.org/GPMGo/gopm) [![Build Status](https://drone.io/github.com/GPMGo/gopm/status.png)](https://drone.io/github.com/GPMGo/gopm/latest) [![Coverage Status](https://coveralls.io/repos/GPMGo/gopm/badge.png)](https://coveralls.io/r/GPMGo/gopm) (Travis CI hasn't support Go 1.1 yet) @@ -28,7 +28,7 @@ This application still in experiment, any change could happen, but it doesn't af ## Known issues -- When you use commands like `gpm install -p bitbucket.org/zombiezen/gopdf` where is project root path but the directory doesn't contain any source files, you will get error in the installation step, you have to use `gpm install -p bitbucket.org/zombiezen/gopdf/pdf` in order to go through all steps correctly. +- When you use commands like `gopm install bitbucket.org/zombiezen/gopdf` where is project root path but the directory doesn't contain any source files, you will get error in the installation step, you have to use `gopm install bitbucket.org/zombiezen/gopdf/pdf` in order to go through all steps correctly. - Cannot remove `.git` with error `access is denied`. ## Todo @@ -37,17 +37,18 @@ This application still in experiment, any change could happen, but it doesn't af - Command `install` and `remove` give number to let user choose operate one package. - Command `search` add flags `-n` and `-o` for number of list items and offset. +- Command `check` add feature to update or generate gopack.json. +- Command `install` generates dependencies configuration file. +- Command `install` save tarball add support for packages in code.google.com, bitbucket.org, launchpad.net, git.oschina.net, gitcafe.com, *.codeplex.com. +- Command `build` use dependencies configuration file to build with specific versions of dependencies, if VCS tools are available, simply use `checkout`. +- Command `clean` is for cleaning empty directories and backup. - Add gpm working principle design. - Complete documentation. ### Future -- Command `check` add feature to update or generate gopack.json. -- Command `install` generates dependencies configuration file. -- Command `build` use dependencies configuration file to build with specific versions of dependencies, if VCS tools are available, simply use `checkout`. - Command `remove` add flag `-d` for removing dependencies at the same time. - Command `remove` add feature check for dependencies, make sure other packages don't import this one, and give choose for users. -- Command `install` save tarball add support for packages in code.google.com, bitbucket.org, launchpad.net, git.oschina.net, gitcafe.com, *.codeplex.com. - Command `update` is for checking updates. - Command `sync` is for sync packages in two computers, support client and server mode through ssh. - Command `init` is for auto-configuring Go develop environment. @@ -55,7 +56,6 @@ This application still in experiment, any change could happen, but it doesn't af - Command `rollback` is for rolling back to certain operation. - Add feature "struct generator". - Command `install` add flag `-all` for re-installing everything in GOPATH, usually use this after upgraded Go version. -- Command `clean` is for cleaning empty directories and backup. - Command `daemon` is for auto-compile web applications when debug it locally. - Collect download and installation results and report to users in the end. - Add user system to create, edit, upload, and download bundles or snapshots through gpm client program. diff --git a/README_ZH.md b/README_ZH.md index d6e97ede1..09b111013 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -1,9 +1,9 @@ -gpm - Go 包管理工具 +gopm - Go 包管理工具 === ![GPMGo_Logo](https://raw.github.com/GPMGo/gpm-site/master/static/img/gpmgo2.png?raw=true) -gpm(Go 包管理工具) 是一款涵盖搜索、安装、更新、分享以及备份功能 Go 包的管理工具。 +gopm(Go 包管理工具) 是一款涵盖搜索、安装、更新、分享以及备份功能 Go 包的管理工具。 [![Build Status](https://travis-ci.org/GPMGo/gpm.png)](https://travis-ci.org/GPMGo/gpm) [![Build Status](https://drone.io/github.com/GPMGo/gpm/status.png)](https://drone.io/github.com/GPMGo/gpm/latest) [![Coverage Status](https://coveralls.io/repos/GPMGo/gpm/badge.png)](https://coveralls.io/r/GPMGo/gpm) @@ -28,7 +28,7 @@ gpm(Go 包管理工具) 是一款涵盖搜索、安装、更新、分享以 ## 已知问题 -- 当您使用命令例如 `gpm install -p bitbucket.org/zombiezen/gopdf` 时,你会在安装步骤时得到错误,虽然这是项目的根目录,但是并没有包含任何 Go 源代码,因此您必须使用 `gpm install -p bitbucket.org/zombiezen/gopdf/pdf` 才能正确完成安装。 +- 当您使用命令例如 `gopm install bitbucket.org/zombiezen/gopdf` 时,你会在安装步骤时得到错误,虽然这是项目的根目录,但是并没有包含任何 Go 源代码,因此您必须使用 `gopm install bitbucket.org/zombiezen/gopdf/pdf` 才能正确完成安装。 - 删除目录 `.git` 会因为权限不足而失败。 ## 授权许可 diff --git a/conf/gpm.toml b/conf/gopm.toml similarity index 100% rename from conf/gpm.toml rename to conf/gopm.toml diff --git a/docs/Quick_Start.md b/docs/Quick_Start.md index 65b93293f..84a04d7ad 100644 --- a/docs/Quick_Start.md +++ b/docs/Quick_Start.md @@ -38,9 +38,11 @@ You can install gpm either from source or download binary. ### Install from source -- gpm is a `go get` able project: execute command `go get github.com/GPMGo/gpm` to download and install. -- Run test: switch work directory to gpm project, and execute command `go test` to build and test commands automatically(for now, tested commands are `gpm install`, `gpm remove`). -- Add gpm project path to your environment variable `PATH` in order to execute it in other directories. +- gopm is a `go get` able project: execute command `go get github.com/GPMGo/gopm` to download and install. +- Run test: switch work directory to gopm project, and execute command `go test` to build and test commands automatically(for now, tested commands are `gopm install`, `gopm remove`). +- Add gopm project path to your environment variable `PATH` in order to execute it in other directories. + +**Attention** You can actually put binary in any path that has already existed in $PATH, so you don't need to add a new path to $PATH again. ### Download binary @@ -57,9 +59,7 @@ Because we don't have all kinds of operating systems, we need your help to compl - windows_386: - windows_amd64: -**Attention** Because we use API to get information of packages that are hosted on github.com, but it limits 60 requests per hour, so you may get errors if you download too much(more than 50 packages per hour). We do not provider access token for security reason, but we do have configure option `github_access_token` in configuration file `conf/gpm.toml`, so you can go to [here](https://github.com/settings/applications) and create your personal access token(up to 5000 request per hour), and set it in `gpm.toml`. - -**Attention** If your computer has been installed other software that called `gpm` also, you may want to change executable name to something else, for example `gpmgo`, and use `gpmgo` in all commands. +**Attention** Because we use API to get information of packages that are hosted on github.com, but it limits 60 requests per hour, so you may get errors if you download too much(more than 50 packages per hour). We do not provider access token for security reason, but we do have configure option `github_access_token` in configuration file `conf/gopm.toml`, so you can go to [here](https://github.com/settings/applications) and create your personal access token(up to 5000 request per hour), and set it in `gopm.toml`. ## Install package, or packages @@ -69,11 +69,11 @@ Suppose you want to install package `github.com/GPMGoTest/install_test`, here tw ### Install like `go get` -- Execute command `gpm install -p github.com/GPMGoTest/install_test`, flag `-p` means **pure download** (download packages without version control), so you do not need to install version control tool. In case you want to, `gpm install github.com/GPMGoTest/install_test` calls `go get` in underlying. +- Execute command `gpm install github.com/GPMGoTest/install_test`, and you do not need to install version control tool. In case you want to, `gpm install -v github.com/GPMGoTest/install_test` calls `go get` in underlying. ### Install through bundle -- It's still not cool enough to download and install packages with import path, let's try execute command `gpm install -p test.b`, see what happens? +- It's still not cool enough to download and install packages with import path, let's try execute command `gopm install test.b`, see what happens? - Where is the `test.b` comes from? We actually created a bundle for you in directory `repo/bundles/`, and all bundles should be put there. - This is how bundle works, you can open it and see what's inside, it includes import path, type, value and dependencies. - The `test.b` means the bundle whose name is `test`, if you want to use bundle, you have to add suffix `.b`. You may notice that our file name is `install_test.json`, why is `test`? Because we use `bundle_name` inside file, file name doesn't mean anything unless you leave `bundle_name` blank, then the file name becomes bundle name automatically, but be sure that all bundle file name should use JSON and suffix `.json`. @@ -91,8 +91,8 @@ Command `build` compiles and installs packages along with all dependencies. Let's switch work directory to package `github.com/GPMGoTest/install_test`. -- Execute command `gpm build -r`. -- After built, you should see string `Welcome to use gpm(Go Package Manager)!` was printed on the screen. +- Execute command `gopm build -r`. +- After built, you should see string `Welcome to use gopm(Go Package Manager)!` was printed on the screen. - Then, gpm calls `go install` in underlying, so you should have binary `$GOPATH/bin/install_test`, then gpm moves it to current directory. - Flag `-r` means run after built, so you saw the string was printed. @@ -106,9 +106,9 @@ Command `remove` removes packages from your local file system. Suppose you want to remove package `github.com/GPMGoTest/install_test2/subpkg`. -- Execute command `gpm remove github.com/GPMGoTest/install_test2/subpkg`, gpm finds this project in all paths in your GOPATH environment. +- Execute command `gopm remove github.com/GPMGoTest/install_test2/subpkg`, gopm finds this project in all paths in your GOPATH environment. - You may notice this is not project path, it's OK because gpm knows it, and deletes directory `$GOPATH/src/github.com/GPMGoTest/install_test2/`, this command delete files in `$GOPATH/bin` and `$GOPATH/pkg` as well. -- You can also use `gpm remove test.b` to remove all packages are included in bundle, but we don't need here because we have one more cool stuff to try. +- You can also use `gopm remove test.b` to remove all packages are included in bundle, but we don't need here because we have one more cool stuff to try. ## Use check to check dependencies @@ -117,14 +117,14 @@ Command `check` checks package dependencies and installs missing ones. Suppose you want to check package `github.com/GPMGoTest/install_test`. - Switch work directory to package path. -- Execute command `gpm check`. +- Execute command `gopm check`. - That's it! ## Search and find more Command `search` is for searching packages in [Go Walker](http://gowalker.org) database. -- Execute command `gpm search mysql`. +- Execute command `gopm search mysql`. - Try it by yourself. ## Go further diff --git a/gpm.go b/gopm.go similarity index 100% rename from gpm.go rename to gopm.go diff --git a/gpm_test.go b/gopm_test.go similarity index 84% rename from gpm_test.go rename to gopm_test.go index 7aee47dc8..6c9dff282 100644 --- a/gpm_test.go +++ b/gopm_test.go @@ -11,9 +11,9 @@ import ( ) func TestGPM(t *testing.T) { - fmt.Println("gpm v0.2.0 Build 0524") + fmt.Println("gopm v0.2.2 Build 0524") - fmt.Println("\nBuilding gpm application...") + fmt.Println("\nBuilding gopm application...") // Build application. var args []string args = append(args, "build") @@ -24,9 +24,8 @@ func TestGPM(t *testing.T) { time.Sleep(2 * time.Second) args = make([]string, 0) args = append(args, "install") - args = append(args, "-p") args = append(args, "github.com/GPMGoTest/install_test") - executeCommand("gpm", args) + executeCommand("gopm", args) fmt.Println("\nStart testing command Remove...") fmt.Println("Let's remove `install_test` and `install_test2`.") @@ -35,5 +34,5 @@ func TestGPM(t *testing.T) { args = append(args, "remove") args = append(args, "github.com/GPMGoTest/install_test") args = append(args, "github.com/GPMGoTest/install_test2") - executeCommand("gpm", args) + executeCommand("gopm", args) } diff --git a/i18n/en-US/prompt.txt b/i18n/en-US/prompt.txt index 2be730d76..63f065c50 100644 --- a/i18n/en-US/prompt.txt +++ b/i18n/en-US/prompt.txt @@ -14,7 +14,7 @@ PackageNotFound=Cannot find package: %s. CheckImports=Fail to check dependencies[ %s ] MovedFile=SUCCESS: Moved file from $GOPATH(%s) to current directory(%s). -PureDownload=You enabled pure download. +PureDownload=You enabled download with version control. DownloadOnly=You enabled download without installing. DownloadExDeps=You enabled download dependencies in example. DownloadFromSrcs=You enabled download from sources. diff --git a/i18n/en-US/usage_install.txt b/i18n/en-US/usage_install.txt index c140ae79a..368f6a9cc 100644 --- a/i18n/en-US/usage_install.txt +++ b/i18n/en-US/usage_install.txt @@ -7,8 +7,8 @@ such as git, hg, etc. The install flags are: - -p - pure download packages without version control. + -v + download packages with version control. -d download without installing packages. -u diff --git a/i18n/zh-CN/prompt.txt b/i18n/zh-CN/prompt.txt index 28a4d332a..546ed4bad 100644 --- a/i18n/zh-CN/prompt.txt +++ b/i18n/zh-CN/prompt.txt @@ -14,7 +14,7 @@ PackageNotFound=无法找到包: %s. CheckImports=一百遍检查失败 [ %s ] MovedFile=SUCCESS: 成功将文件从 $GOPATH(%s) 移动至当前目录 (%s). -PureDownload=已激活纯净下载模式. +PureDownload=已激活版本控制下载模式. DownloadOnly=已激活无安装模式. DownloadExDeps=已激活下载示例代码依赖. DownloadFromSrcs=已激活从用户源下载. diff --git a/i18n/zh-CN/usage_install.txt b/i18n/zh-CN/usage_install.txt index a0601df4e..ec1ad9374 100644 --- a/i18n/zh-CN/usage_install.txt +++ b/i18n/zh-CN/usage_install.txt @@ -5,8 +5,8 @@ Install 命令下载并安装 Go 包及其依赖包. 下列参数可用于 install 命令: - -p - 无版本控制的纯净下载. + -v + 使用版本控制工具下载. -d 下载但不安装包. -u diff --git a/install.go b/install.go index 894d8a232..afa9c0228 100644 --- a/install.go +++ b/install.go @@ -32,7 +32,7 @@ func init() { downloadCache = make(map[string]bool) cmdInstall.Run = runInstall cmdInstall.Flags = map[string]bool{ - "-p": false, + "-v": false, "-d": false, "-u": false, // Flag for 'go get'. "-e": false, @@ -44,7 +44,7 @@ func init() { // let them know what's going on. func printInstallPrompt(flag string) { switch flag { - case "-p": + case "-v": fmt.Printf(fmt.Sprintf("%s\n", promptMsg["PureDownload"])) case "-d": fmt.Printf(fmt.Sprintf("%s\n", promptMsg["DownloadOnly"])) @@ -131,7 +131,7 @@ func runInstall(cmd *Command, args []string) { // Download packages. downloadPackages(nodes) - if !cmdInstall.Flags["-d"] && cmdInstall.Flags["-p"] { + if !cmdInstall.Flags["-d"] && !cmdInstall.Flags["-v"] { // Remove old files. uninstallList := make([]string, 0, len(downloadCache)) for k := range downloadCache { @@ -273,7 +273,7 @@ func saveNode(n *doc.Node) { func downloadPackage(node *doc.Node) (*doc.Node, []string) { // Check if use version control tools. switch { - case !cmdInstall.Flags["-p"] && + case cmdInstall.Flags["-v"] && ((node.ImportPath[0] == 'g' && isHasGit) || (node.ImportPath[0] == 'c' && isHasHg)): // github.com, code.google.com fmt.Printf(fmt.Sprintf("%s\n", promptMsg["InstallByGoGet"]), node.ImportPath) args := checkGoGetFlags() @@ -281,8 +281,8 @@ func downloadPackage(node *doc.Node) (*doc.Node, []string) { executeCommand("go", args) return nil, nil default: // Pure download. - if !cmdInstall.Flags["-p"] { - cmdInstall.Flags["-p"] = true + if cmdInstall.Flags["-v"] { + cmdInstall.Flags["-v"] = false fmt.Printf(fmt.Sprintf("%s\n", promptMsg["NoVCSTool"])) }