Skip to content

Commit

Permalink
Merge pull request #160 from vim-volt/devel
Browse files Browse the repository at this point in the history
Release v0.3.0
  • Loading branch information
tyru authored Jan 14, 2018
2 parents f6f0656 + e172043 commit fe28800
Show file tree
Hide file tree
Showing 30 changed files with 928 additions and 622 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ matrix:
go: 1.9
- os: linux
go: tip
- os: osx
osx_image: xcode8.3
go: 1.9
- os: osx
osx_image: xcode8.3
go: tip
# macOS build *extraordinary* slow, disable them
# - os: osx
# osx_image: xcode8.3
# go: 1.9
# - os: osx
# osx_image: xcode8.3
# go: tip

script:
- go vet -v ./...
Expand Down
100 changes: 84 additions & 16 deletions CMDREF.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ Description

```
Usage
volt get [-help] [-l] [-u] [-v] [{repository} ...]
volt get [-help] [-l] [-u] [{repository} ...]
Quick example
$ volt get tyru/caw.vim # will install tyru/caw.vim plugin
$ volt get -u tyru/caw.vim # will upgrade tyru/caw.vim plugin
$ volt get -l -u # will upgrade all installed plugins
$ volt get -v tyru/caw.vim # will output more verbosely
$ VOLT_DEBUG=1 volt get tyru/caw.vim # will output more verbosely
$ mkdir -p ~/volt/repos/localhost/local/hello/plugin
$ echo 'command! Hello echom "hello"' >~/volt/repos/localhost/local/hello/plugin/hello.vim
Expand All @@ -78,8 +78,6 @@ Description
and install it to:
$VOLTPATH/plugconf/{repository}.vim
If -v option was specified, output more verbosely.
Repository List
{repository} list (=target to perform installing, upgrading, and so on) is determined as followings:
* If -l option is specified, all installed vim plugins (regardless current profile) are used
Expand Down Expand Up @@ -122,21 +120,97 @@ Repository path
Options
-l use all installed repositories as targets
-u upgrade repositories
-v output more verbosely
```

# volt list

```
Usage
volt list [-help]
volt list [-help] [-f {text/template string}]
Quick example
$ volt list # will list installed plugins
Show all installed repositories:
$ volt list -f '{{ range .Repos }}{{ println .Path }}{{ end }}'
Show repositories used by current profile:
$ volt list -f '{{ range .Profiles }}{{ if eq $.CurrentProfileName .Name }}{{ range .ReposPath }}{{ . }}{{ end }}{{ end }}{{ end }}'
Or (see "Additional property"):
$ volt list -f '{{ range currentProfile.ReposPath }}{{ println . }}{{ end }}'
Template functions
json value [prefix [indent]] (string)
Returns JSON representation of value.
The argument is same as json.MarshalIndent().
currentProfile (Profile (see "Structures"))
Returns current profile
currentProfile (Profile (see "Structures"))
Returns given name's profile
version (string)
Returns volt version string. format is "v{major}.{minor}.{patch}" (e.g. "v0.3.0")
versionMajor (number)
Returns volt major version
versionMinor (number)
Returns volt minor version
versionPatch (number)
Returns volt patch version
Structures
This describes the structure of lock.json .
{
// lock.json structure compatibility version
"version": <int64>,
// Unique number of transaction
"trx_id": <int64>,
// Current profile name (e.g. "default")
"current_profile_name": <string>,
// All Installed repositories
// ("volt list" shows current profile's repositories, which is not the same as this)
"repos": [
{
// "git" (git repository) or "static" (static repository)
"type": <string>,
// Unique number of transaction
"trx_id": <int64>,
// Repository path like "github.com/vim-volt/vim-volt"
"path": <string>,
// Git commit hash. if "type" is "static" this property does not exist
"version": <string>,
},
],
// Profiles
"profiles": [
// Profile name (.e.g. "default")
"name": <string>,
// Repositories ("volt list" shows these repositories)
"repos_path": [ <string> ],
]
}
Description
This is shortcut of:
volt profile show {current profile}
Vim plugin information extractor.
If -f flag is not given, this command shows vim plugins of **current profile** (not all installed plugins) by default.
If -f flag is given, it renders by given template which can access the information of lock.json .
```

# volt migrate
Expand Down Expand Up @@ -183,10 +257,6 @@ Command
profile rm [-current | {name}] {repository} [{repository2} ...]
Remove one or more repositories from profile {name}.
profile use [-current | {name}] vimrc [true | false]
profile use [-current | {name}] gvimrc [true | false]
Set vimrc / gvimrc flag to true or false.
Quick example
$ volt profile list # default profile is "default"
* default
Expand All @@ -208,9 +278,6 @@ Quick example
$ volt profile rm foo tyru/caw.vim # disable loading tyru/caw.vim on "foo" profile
$ volt profile destroy foo # will delete profile "foo"
$ volt profile use -current vimrc false # Disable installing vimrc on current profile on "volt build"
$ volt profile use default gvimrc true # Enable installing gvimrc on profile default on "volt build"
```

# volt rm
Expand All @@ -226,7 +293,8 @@ Quick example
$ volt rm -r -p tyru/caw.vim # Remove tyru/caw.vim plugin from lock.json, and remove repository directory, plugconf
Description
Uninstall {repository} on every profile.
Uninstall one or more {repository} from every profile.
This results in removing vim plugins from ~/.vim/pack/volt/opt/ directory.
If {repository} is depended by other repositories, this command exits with an error.
If -r option was given, remove also repository directories of specified repositories.
Expand Down
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
NAME := volt
SRC := $(shell find . -type d -name 'vendor' -prune -o -type f -name '*.go' -print)
VERSION := $(shell sed -n -E 's/var voltVersion string = "([^"]+)"/\1/p' cmd/version.go)
RELEASE_LDFLAGS := -extldflags '-static'
RELEASE_LDFLAGS := -s -w -extldflags '-static'
RELEASE_OS := linux windows darwin
RELEASE_ARCH := amd64 386

Expand Down Expand Up @@ -32,17 +32,12 @@ release: $(BIN_DIR)/$(NAME)
rm -fr $(DIST_DIR)
@for os in $(RELEASE_OS); do \
for arch in $(RELEASE_ARCH); do \
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch; \
if [ $$os = windows ]; then \
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch.exe; \
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
else \
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch; \
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
strip $(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch 2>/dev/null; \
true; \
exe=$$exe.exe; \
fi; \
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
done; \
done

Expand Down
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ Usage
volt COMMAND ARGS
Command
get [-l] [-u] [-v] [{repository} ...]
get [-l] [-u] [{repository} ...]
Install or upgrade given {repository} list, or add local {repository} list as plugins
rm {repository} [{repository2} ...]
Uninstall vim plugin and plugconf files
rm [-r] [-p] {repository} [{repository2} ...]
Remove vim plugin from ~/.vim/pack/volt/opt/ directory
list [-f {text/template string}]
Vim plugin information extractor.
Unless -f flag was given, this command shows vim plugins of **current profile** (not all installed plugins) by default.
enable {repository} [{repository2} ...]
This is shortcut of:
volt profile add -current {repository} [{repository2} ...]
list
This is shortcut of:
volt profile show -current
disable {repository} [{repository2} ...]
This is shortcut of:
volt profile rm -current {repository} [{repository2} ...]
Expand Down Expand Up @@ -63,10 +63,6 @@ Command
profile rm {name} {repository} [{repository2} ...]
Remove one or more repositories to profile
profile use [-current | {name}] vimrc [true | false]
profile use [-current | {name}] gvimrc [true | false]
Set vimrc / gvimrc flag to true or false.
build [-full]
Build ~/.vim/pack/volt/ directory
Expand All @@ -78,7 +74,7 @@ Command
version
Show volt command version
```
```

See [the command reference](https://github.com/vim-volt/volt/blob/master/CMDREF.md) for more details.

Expand Down Expand Up @@ -175,7 +171,7 @@ This is `$HOME/volt` by default.
For example, installing [tyru/caw.vim](https://github.com/tyru/caw.vim) plugin:

```
$ volt get https://github.com/tyru/caw.vim # most verbose way
$ volt get https://github.com/tyru/caw.vim # most verbose way (but handy when you copy & paste from browser address bar :)
$ volt get github.com/tyru/caw.vim # you can omit https:// of repository URL
$ volt get tyru/caw.vim # you can omit github.com/ if the repository is on GitHub
```
Expand Down
15 changes: 14 additions & 1 deletion _scripts/update-readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,21 @@ func Main() int {
return 0
}

// start = The first line number **inside** code block
// end = The end of code block line (```) line number
func findTopCodeBlockRange(lines []string) (int, int) {
return 6, 80
start, end := -1, -1
for i := range lines {
if lines[i] == "```" {
if start == -1 {
start = i + 1
} else {
end = i
break
}
}
}
return start, end
}

func getVoltHelpOutput() (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ func (cmd *buildCmd) doBuild(full bool) error {
// Put repos into map to be able to search with O(1).
// Use empty build-info.json map if the -full option was given
// because the repos info is unnecessary because it is not referenced.
var buildReposMap map[string]*buildinfo.Repos
var buildReposMap map[pathutil.ReposPath]*buildinfo.Repos
optDir := pathutil.VimVoltOptDir()
if full {
buildReposMap = make(map[string]*buildinfo.Repos)
buildReposMap = make(map[pathutil.ReposPath]*buildinfo.Repos)
logger.Info("Full building " + optDir + " directory ...")
} else {
buildReposMap = make(map[string]*buildinfo.Repos, len(buildInfo.Repos))
buildReposMap = make(map[pathutil.ReposPath]*buildinfo.Repos, len(buildInfo.Repos))
for i := range buildInfo.Repos {
repos := &buildInfo.Repos[i]
buildReposMap[repos.Path] = repos
Expand Down
Loading

0 comments on commit fe28800

Please sign in to comment.