Skip to content

Commit fe28800

Browse files
authored
Merge pull request #160 from vim-volt/devel
Release v0.3.0
2 parents f6f0656 + e172043 commit fe28800

30 files changed

+928
-622
lines changed

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ matrix:
66
go: 1.9
77
- os: linux
88
go: tip
9-
- os: osx
10-
osx_image: xcode8.3
11-
go: 1.9
12-
- os: osx
13-
osx_image: xcode8.3
14-
go: tip
9+
# macOS build *extraordinary* slow, disable them
10+
# - os: osx
11+
# osx_image: xcode8.3
12+
# go: 1.9
13+
# - os: osx
14+
# osx_image: xcode8.3
15+
# go: tip
1516

1617
script:
1718
- go vet -v ./...

CMDREF.md

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ Description
5757

5858
```
5959
Usage
60-
volt get [-help] [-l] [-u] [-v] [{repository} ...]
60+
volt get [-help] [-l] [-u] [{repository} ...]
6161
6262
Quick example
6363
$ volt get tyru/caw.vim # will install tyru/caw.vim plugin
6464
$ volt get -u tyru/caw.vim # will upgrade tyru/caw.vim plugin
6565
$ volt get -l -u # will upgrade all installed plugins
66-
$ volt get -v tyru/caw.vim # will output more verbosely
66+
$ VOLT_DEBUG=1 volt get tyru/caw.vim # will output more verbosely
6767
6868
$ mkdir -p ~/volt/repos/localhost/local/hello/plugin
6969
$ echo 'command! Hello echom "hello"' >~/volt/repos/localhost/local/hello/plugin/hello.vim
@@ -78,8 +78,6 @@ Description
7878
and install it to:
7979
$VOLTPATH/plugconf/{repository}.vim
8080
81-
If -v option was specified, output more verbosely.
82-
8381
Repository List
8482
{repository} list (=target to perform installing, upgrading, and so on) is determined as followings:
8583
* If -l option is specified, all installed vim plugins (regardless current profile) are used
@@ -122,21 +120,97 @@ Repository path
122120
Options
123121
-l use all installed repositories as targets
124122
-u upgrade repositories
125-
-v output more verbosely
126123
```
127124

128125
# volt list
129126

130127
```
131128
Usage
132-
volt list [-help]
129+
volt list [-help] [-f {text/template string}]
133130
134131
Quick example
135132
$ volt list # will list installed plugins
136133
134+
Show all installed repositories:
135+
136+
$ volt list -f '{{ range .Repos }}{{ println .Path }}{{ end }}'
137+
138+
Show repositories used by current profile:
139+
140+
$ volt list -f '{{ range .Profiles }}{{ if eq $.CurrentProfileName .Name }}{{ range .ReposPath }}{{ . }}{{ end }}{{ end }}{{ end }}'
141+
142+
Or (see "Additional property"):
143+
144+
$ volt list -f '{{ range currentProfile.ReposPath }}{{ println . }}{{ end }}'
145+
146+
Template functions
147+
148+
json value [prefix [indent]] (string)
149+
Returns JSON representation of value.
150+
The argument is same as json.MarshalIndent().
151+
152+
currentProfile (Profile (see "Structures"))
153+
Returns current profile
154+
155+
currentProfile (Profile (see "Structures"))
156+
Returns given name's profile
157+
158+
version (string)
159+
Returns volt version string. format is "v{major}.{minor}.{patch}" (e.g. "v0.3.0")
160+
161+
versionMajor (number)
162+
Returns volt major version
163+
164+
versionMinor (number)
165+
Returns volt minor version
166+
167+
versionPatch (number)
168+
Returns volt patch version
169+
170+
Structures
171+
This describes the structure of lock.json .
172+
{
173+
// lock.json structure compatibility version
174+
"version": <int64>,
175+
176+
// Unique number of transaction
177+
"trx_id": <int64>,
178+
179+
// Current profile name (e.g. "default")
180+
"current_profile_name": <string>,
181+
182+
// All Installed repositories
183+
// ("volt list" shows current profile's repositories, which is not the same as this)
184+
"repos": [
185+
{
186+
// "git" (git repository) or "static" (static repository)
187+
"type": <string>,
188+
189+
// Unique number of transaction
190+
"trx_id": <int64>,
191+
192+
// Repository path like "github.com/vim-volt/vim-volt"
193+
"path": <string>,
194+
195+
// Git commit hash. if "type" is "static" this property does not exist
196+
"version": <string>,
197+
},
198+
],
199+
200+
// Profiles
201+
"profiles": [
202+
// Profile name (.e.g. "default")
203+
"name": <string>,
204+
205+
// Repositories ("volt list" shows these repositories)
206+
"repos_path": [ <string> ],
207+
]
208+
}
209+
137210
Description
138-
This is shortcut of:
139-
volt profile show {current profile}
211+
Vim plugin information extractor.
212+
If -f flag is not given, this command shows vim plugins of **current profile** (not all installed plugins) by default.
213+
If -f flag is given, it renders by given template which can access the information of lock.json .
140214
```
141215

142216
# volt migrate
@@ -183,10 +257,6 @@ Command
183257
profile rm [-current | {name}] {repository} [{repository2} ...]
184258
Remove one or more repositories from profile {name}.
185259
186-
profile use [-current | {name}] vimrc [true | false]
187-
profile use [-current | {name}] gvimrc [true | false]
188-
Set vimrc / gvimrc flag to true or false.
189-
190260
Quick example
191261
$ volt profile list # default profile is "default"
192262
* default
@@ -208,9 +278,6 @@ Quick example
208278
$ volt profile rm foo tyru/caw.vim # disable loading tyru/caw.vim on "foo" profile
209279
210280
$ volt profile destroy foo # will delete profile "foo"
211-
212-
$ volt profile use -current vimrc false # Disable installing vimrc on current profile on "volt build"
213-
$ volt profile use default gvimrc true # Enable installing gvimrc on profile default on "volt build"
214281
```
215282

216283
# volt rm
@@ -226,7 +293,8 @@ Quick example
226293
$ volt rm -r -p tyru/caw.vim # Remove tyru/caw.vim plugin from lock.json, and remove repository directory, plugconf
227294
228295
Description
229-
Uninstall {repository} on every profile.
296+
Uninstall one or more {repository} from every profile.
297+
This results in removing vim plugins from ~/.vim/pack/volt/opt/ directory.
230298
If {repository} is depended by other repositories, this command exits with an error.
231299
232300
If -r option was given, remove also repository directories of specified repositories.

Makefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
NAME := volt
33
SRC := $(shell find . -type d -name 'vendor' -prune -o -type f -name '*.go' -print)
44
VERSION := $(shell sed -n -E 's/var voltVersion string = "([^"]+)"/\1/p' cmd/version.go)
5-
RELEASE_LDFLAGS := -extldflags '-static'
5+
RELEASE_LDFLAGS := -s -w -extldflags '-static'
66
RELEASE_OS := linux windows darwin
77
RELEASE_ARCH := amd64 386
88

@@ -32,17 +32,12 @@ release: $(BIN_DIR)/$(NAME)
3232
rm -fr $(DIST_DIR)
3333
@for os in $(RELEASE_OS); do \
3434
for arch in $(RELEASE_ARCH); do \
35+
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch; \
3536
if [ $$os = windows ]; then \
36-
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch.exe; \
37-
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
38-
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
39-
else \
40-
exe=$(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch; \
41-
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
42-
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
43-
strip $(DIST_DIR)/$(NAME)-$(VERSION)-$$os-$$arch 2>/dev/null; \
44-
true; \
37+
exe=$$exe.exe; \
4538
fi; \
39+
echo "Creating $$exe ... (os=$$os, arch=$$arch)"; \
40+
GOOS=$$os GOARCH=$$arch go build -tags netgo -installsuffix netgo -ldflags "$(RELEASE_LDFLAGS)" -o $$exe; \
4641
done; \
4742
done
4843

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ Usage
2121
volt COMMAND ARGS
2222
2323
Command
24-
get [-l] [-u] [-v] [{repository} ...]
24+
get [-l] [-u] [{repository} ...]
2525
Install or upgrade given {repository} list, or add local {repository} list as plugins
2626
27-
rm {repository} [{repository2} ...]
28-
Uninstall vim plugin and plugconf files
27+
rm [-r] [-p] {repository} [{repository2} ...]
28+
Remove vim plugin from ~/.vim/pack/volt/opt/ directory
29+
30+
list [-f {text/template string}]
31+
Vim plugin information extractor.
32+
Unless -f flag was given, this command shows vim plugins of **current profile** (not all installed plugins) by default.
2933
3034
enable {repository} [{repository2} ...]
3135
This is shortcut of:
3236
volt profile add -current {repository} [{repository2} ...]
3337
34-
list
35-
This is shortcut of:
36-
volt profile show -current
37-
3838
disable {repository} [{repository2} ...]
3939
This is shortcut of:
4040
volt profile rm -current {repository} [{repository2} ...]
@@ -63,10 +63,6 @@ Command
6363
profile rm {name} {repository} [{repository2} ...]
6464
Remove one or more repositories to profile
6565
66-
profile use [-current | {name}] vimrc [true | false]
67-
profile use [-current | {name}] gvimrc [true | false]
68-
Set vimrc / gvimrc flag to true or false.
69-
7066
build [-full]
7167
Build ~/.vim/pack/volt/ directory
7268
@@ -78,7 +74,7 @@ Command
7874
7975
version
8076
Show volt command version
81-
```
77+
```
8278

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

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

177173
```
178-
$ volt get https://github.com/tyru/caw.vim # most verbose way
174+
$ volt get https://github.com/tyru/caw.vim # most verbose way (but handy when you copy & paste from browser address bar :)
179175
$ volt get github.com/tyru/caw.vim # you can omit https:// of repository URL
180176
$ volt get tyru/caw.vim # you can omit github.com/ if the repository is on GitHub
181177
```

_scripts/update-readme.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,21 @@ func Main() int {
8585
return 0
8686
}
8787

88+
// start = The first line number **inside** code block
89+
// end = The end of code block line (```) line number
8890
func findTopCodeBlockRange(lines []string) (int, int) {
89-
return 6, 80
91+
start, end := -1, -1
92+
for i := range lines {
93+
if lines[i] == "```" {
94+
if start == -1 {
95+
start = i + 1
96+
} else {
97+
end = i
98+
break
99+
}
100+
}
101+
}
102+
return start, end
90103
}
91104

92105
func getVoltHelpOutput() (string, error) {

cmd/build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ func (cmd *buildCmd) doBuild(full bool) error {
116116
// Put repos into map to be able to search with O(1).
117117
// Use empty build-info.json map if the -full option was given
118118
// because the repos info is unnecessary because it is not referenced.
119-
var buildReposMap map[string]*buildinfo.Repos
119+
var buildReposMap map[pathutil.ReposPath]*buildinfo.Repos
120120
optDir := pathutil.VimVoltOptDir()
121121
if full {
122-
buildReposMap = make(map[string]*buildinfo.Repos)
122+
buildReposMap = make(map[pathutil.ReposPath]*buildinfo.Repos)
123123
logger.Info("Full building " + optDir + " directory ...")
124124
} else {
125-
buildReposMap = make(map[string]*buildinfo.Repos, len(buildInfo.Repos))
125+
buildReposMap = make(map[pathutil.ReposPath]*buildinfo.Repos, len(buildInfo.Repos))
126126
for i := range buildInfo.Repos {
127127
repos := &buildInfo.Repos[i]
128128
buildReposMap[repos.Path] = repos

0 commit comments

Comments
 (0)