Skip to content

JSON DSL #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 79 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
df18f14
feat: implement intepreter, do operation
tyru Apr 14, 2018
93d46db
doc: add refactoring note (introduction to JSON DSL)
tyru Apr 15, 2018
99ea790
doc: update json-dsl.md
tyru Apr 15, 2018
9e7c917
feat: implement "@" operator
tyru Apr 18, 2018
3dd15e8
feat: split Op interface to Macro,Func
tyru Apr 18, 2018
2b524eb
doc: add linenum argument to label, and so on
tyru Apr 19, 2018
dbb9a30
refactor: change Macro.Expand() signature
tyru Apr 19, 2018
b70ac44
refactor: move Type constants to dsl/op/types.go
tyru Apr 19, 2018
756b2a8
feat: add VoidType
tyru Apr 19, 2018
6d1cdec
refactor: rename Expr.Typ to Expr.RetType
tyru Apr 19, 2018
22105bb
feat: implement signature() function
tyru Apr 19, 2018
b851a2c
feat: implement $invert macro
tyru Apr 19, 2018
3c6a0d9
feat: add guard utility struct
tyru Apr 19, 2018
66469a7
feat: implement "do" function
tyru Apr 19, 2018
083ce4a
doc: add @ macro
tyru Apr 19, 2018
6b9f691
refactor: fix comment
tyru Apr 19, 2018
aa8b9bc
fix: store arg type of array,object to its struct
tyru Apr 20, 2018
986e332
refactor: make the fields of structs of types package readonly
tyru Apr 20, 2018
afb0093
fix: fix warning message of auto-migration of lock.json
tyru Apr 20, 2018
112eddc
refactor: move subcmd/migrate to migration package
tyru Apr 20, 2018
0840e9b
fix: suppress lint errors
tyru Apr 20, 2018
ec4ed57
refactor: move subcmd/buildinfo to buildinfo package
tyru Apr 20, 2018
69862ce
refactor: don't read lock.json,config.toml in subcmd package
tyru Apr 20, 2018
3a307f2
fix: make op.DoOp type pointer type
tyru Apr 20, 2018
332fecb
fix: now Parse() returns *Expr instead of Value
tyru Apr 21, 2018
dd3f180
fix: rename "@" macro to "$array"
tyru Apr 21, 2018
9a2cbcc
fix: change InvertOp type
tyru Apr 21, 2018
6b6d3fb
fix: change Macro.Expand() signature
tyru Apr 21, 2018
4e0ef2f
feat: add "$expand-macro" macro
tyru Apr 21, 2018
15ee38f
fix: change noRollback to NoRollback
tyru Apr 21, 2018
326647b
feat: implement new simple transaction algorithm
tyru Apr 21, 2018
7c1bc0e
fix: dsl.Execute(): validate types of props in context
tyru Apr 21, 2018
f1ce8d8
refactor: remove unnecessary logger.Error()
tyru Apr 21, 2018
cd226a5
refactor: move Value interface to value.go
tyru Apr 21, 2018
e57962f
fix: rename $expand-macro to $eval
tyru Apr 22, 2018
5bfb377
doc: remove "Go API" section
tyru Apr 22, 2018
59633e9
refactor: unify Func,Macro interfaces to Op interface
tyru Apr 22, 2018
cf5138b
refactor: rename package dsl/op -> dsl/ops
tyru Apr 22, 2018
538dc42
refactor: add prefix to filename 'macro_' or 'func_'
tyru Apr 22, 2018
a773d5d
refactor: move SigChecker,Guard to dsl/ops/util package
tyru Apr 22, 2018
1ea2781
refactor: rename Op.Execute() to Op.EvalExpr()
tyru Apr 22, 2018
fc726fd
refactor: define Expr interface
tyru Apr 22, 2018
4443069
refactor: define interfaces for JSON values
tyru Apr 22, 2018
6aa55c9
refactor: define interfaces for JSON types
tyru Apr 22, 2018
aa95117
refactor: move common func methods to dsl/ops/func.go
tyru Apr 22, 2018
08bc03d
refactor: fix comments
tyru Apr 22, 2018
6493bab
refactor: define Transaction interface
tyru Apr 22, 2018
fbd6893
refactor: rename variable
tyru Apr 22, 2018
77a99b4
fix: opsMap must not be nil
tyru Apr 22, 2018
cf188d4
fix: now dsl.Execute() rolls back when error occurred
tyru Apr 22, 2018
e089534
doc: add "lockjson/write" func, and so on
tyru Apr 22, 2018
7bd0d14
feat: add "lockjson/write" function
tyru Apr 22, 2018
9728651
refactor: let 'volt migrate lockjson' use JSON DSL
tyru Apr 22, 2018
6fbfc1f
fix: pass context outside dsl/ops package
tyru Apr 22, 2018
2b19509
refactor: use String() instead of literal
tyru Apr 22, 2018
d2452f1
refactor: let 'volt migrate plugconf/config-func' use JSON DSL
tyru Apr 22, 2018
11007bb
refactor: move migration to subcmd/migration
tyru Apr 22, 2018
9ae163f
feat: write transaction log before evaluation
tyru Apr 22, 2018
4d77f86
fix: fix bug that operator name is not deparsed
tyru Apr 22, 2018
0224d51
feat: add json tags to Config struct
tyru Apr 22, 2018
89360a8
feat: save also lock.json and config info to transacion log
tyru Apr 22, 2018
b9ec437
refactor: move writeTrxLog function def to bottom
tyru Apr 22, 2018
73767a8
doc: update README.md
tyru Apr 22, 2018
8c51e1f
refactor: fix comments
tyru Apr 22, 2018
df96994
doc: update README.md
tyru Apr 22, 2018
e2ae2ab
fix: use defer
tyru Apr 23, 2018
edf18c3
doc: change to eager evaluation, and add lambda
tyru Apr 23, 2018
1cb653a
refactor: remove NoRollback, use nil instead
tyru Apr 23, 2018
7061c43
refactor: early return
tyru Apr 23, 2018
8c07188
feat: add lambda type
tyru Apr 23, 2018
a9a6422
refactor: fix comments
tyru Apr 23, 2018
3768dd6
perf: reduce unnecessary instance creation of Type()
tyru Apr 23, 2018
3567fb5
refactor: change Guard interface
tyru Apr 23, 2018
304a7ab
destructive: change to eager evaluation
tyru Apr 23, 2018
464b73f
destructive: change "do" signature
tyru Apr 23, 2018
31449a2
fix: context is not passed to rollback function
tyru Apr 23, 2018
b832a41
refactor: mv dsl/deparse.go dsl/deparse/deparse.go
tyru Apr 23, 2018
397d5cf
doc: change "fn" syntax
tyru Apr 24, 2018
07f6cf2
feat: add lambda
tyru Apr 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 25 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ See [the command reference](https://github.com/vim-volt/volt/blob/master/CMDREF.
* Or `go get github.com/vim-volt/volt`
* You need Go 1.9 or higher
* And if you are using Windows Subsystem Linux, you need to apply **[the patch for os.RemoveAll()](https://go-review.googlesource.com/c/go/+/62970) ! ([#1](https://github.com/vim-volt/go-volt/issues/1))**
* But it's a hassle, you can just download linux-386/amd64 binaries from [GitHub releases](https://github.com/vim-volt/volt/releases) :)
* But it's a hassle, you can just download linux-(386/amd64) binaries from [GitHub releases](https://github.com/vim-volt/volt/releases) :)

And there is bash completion script in [\_contrib](https://github.com/vim-volt/volt/blob/master/_contrib/completion/bash) directory (thanks @AvianY).

Expand Down Expand Up @@ -119,12 +119,10 @@ You can update all plugins as follows:
$ volt get -l -u
```

`-l` works like all plugins in current profile are specified (the repositories list is read from `$VOLTPATH/lock.json`).
If you do not use profile feature, or `enable` and `disable` commands, you can
think that `-l` specifies all plugins what you have installed.
`-u` updates specified plugins.
`-l` works like all plugins in current profile are specified (the repositories list is read from `$VOLTPATH/lock.json`).

Or, update only specified plugin(s) as follows:
Or you can update only specified plugin(s) as follows:

```
$ volt get -u tyru/caw.vim
Expand Down Expand Up @@ -306,14 +304,7 @@ See [plugconf directory](https://github.com/tyru/dotfiles/tree/75a37b4a640a5cffe
You can think this is similar feature of **branch** of `git`.
The default profile name is "default".

You can see profile list by `volt profile list`.

```
$ volt profile list
* default
```

You can create a new profile by `volt profile new`.
You can create an *empty* profile by `volt profile new`.

```
$ volt profile new foo # will create profile "foo"
Expand All @@ -322,7 +313,8 @@ $ volt profile list
foo
```

You can switch current profile by `volt profile set`.
Then you can switch current profile by `volt profile set`.
This removes all plugins from `~/.vim/pack/volt/opt/*`, because the new created profile is empty; no plugins are included.

```
$ volt profile set foo # will switch profile to "foo"
Expand All @@ -331,38 +323,40 @@ $ volt profile list
* foo
```

You can delete profile by `volt profile destroy` (but you cannot delete current profile which you are switching on).
You can install new plugins or enable installed plugins **only in the current profile.**
`volt enable` is a shortcut of `volt profile add -current`.

```
$ volt profile destroy foo # will delete profile "foo"
$ volt enable foo/bar bar/baz # enable installed plugins (foo/bar, bar/baz) also in new profile
$ volt profile add -current foo/bar bar/baz # same as above
$ volt get foo/bar bar/baz # or you can just use 'volt get', this installs missing plugins (it just includes plugins if already installed)
```

You can enable/disable plugin by `volt enable` (`volt profile add`), `volt disable` (`volt profile rm`).
You can disable plugins by `volt disable`.
This is a shortcut of `volt profile rm -current`.

```
$ volt enable tyru/caw.vim # enable loading tyru/caw.vim on current profile
$ volt profile add foo tyru/caw.vim # enable loading tyru/caw.vim on "foo" profile
$ volt disable foo/bar # disable loading foo/bar on current profile
$ volt profile rm -current foo/bar # same as above
$ volt profile rm foo foo/bar # or disable plugins outside current profile (of course 'volt profile add' can do it too)
```

You can delete profile by `volt profile destroy` (but you cannot delete current profile which you are switching on).

```
$ volt disable tyru/caw.vim # disable loading tyru/caw.vim on current profile
$ volt profile rm foo tyru/caw.vim # disable loading tyru/caw.vim on "foo" profile
$ volt profile destroy foo # will delete profile "foo"
```

You can create a vimrc & gvimrc file for each profile:
---

And you can create local vimrc & gvimrc files for each profile:
* vimrc: `$VOLTPATH/rc/<profile name>/vimrc.vim`
* gvimrc: `$VOLTPATH/rc/<profile name>/gvimrc.vim`

NOTE: If the path(s) exists, `$MYVIMRC` and `$MYGVIMRC` are set. So `:edit $MYVIMRC` does not open generated vimrc (`~/.vim/vimrc`), but above vimrc/gvimrc.
NOTE: If the path(s) exists, `$MYVIMRC` and `$MYGVIMRC` are set. So `:edit $MYVIMRC` opens above vimrc/gvimrc, not generated vimrc (`~/.vim/vimrc`).

This file is copied to `~/.vim/vimrc` and `~/.vim/gvimrc` with magic comment (shows error if existing vimrc/gvimrc files exist with no magic comment).

And you can enable/disable vimrc by `volt profile use` (or you can simply remove `$VOLTPATH/rc/<profile name>/vimrc.vim` file if you don't want vimrc for the profile).

```
$ volt profile use -current vimrc false # Disable installing vimrc on current profile
$ volt profile use default gvimrc true # Enable installing gvimrc on profile default
```
The files are copied to `~/.vim/vimrc` and `~/.vim/gvimrc` with magic comment.
Because volt shows an error if existing vimrc/gvimrc files exist with no magic comment which is not created by volt.

See `volt help profile` for more detailed information.

Expand Down
Loading