Skip to content

Commit

Permalink
Fix cache-gen command (#608)
Browse files Browse the repository at this point in the history
* Fix cache-gen command
* Add tests for cache-gen
  • Loading branch information
desyncr authored Nov 17, 2017
1 parent a1d4a2b commit c23835d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,8 @@ ${(j::)_sources}
#--- BUNDLES END
typeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=($(print ${(qq)_ANTIGEN_BUNDLE_RECORD}))
typeset -g _ANTIGEN_CACHE_LOADED; _ANTIGEN_CACHE_LOADED=true
typeset -g ANTIGEN_CACHE_VERSION; ANTIGEN_CACHE_VERSION='develop'
typeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=($(print ${(qq)_ZCACHE_BUNDLE_SOURCE}))
typeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='develop'
#-- END ZCACHE GENERATED FILE
EOC
Expand Down Expand Up @@ -1875,7 +1876,9 @@ EOC
-antigen-cache-generate
[[ -f "$ANTIGEN_CACHE" ]] && source "$ANTIGEN_CACHE";

unset _ZCACHE_BUNDLE_SOURCE _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS
# Commented out in order to have a working `cache-gen` command
#unset _ZCACHE_BUNDLE_SOURCE
unset _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS

# Release all hooked functions
antigen-remove-hook -antigen-load-env-cached
Expand Down
7 changes: 5 additions & 2 deletions src/ext/cache.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ ${(j::)_sources}
#--- BUNDLES END
typeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=($(print ${(qq)_ANTIGEN_BUNDLE_RECORD}))
typeset -g _ANTIGEN_CACHE_LOADED; _ANTIGEN_CACHE_LOADED=true
typeset -g ANTIGEN_CACHE_VERSION; ANTIGEN_CACHE_VERSION='{{ANTIGEN_VERSION}}'
typeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=($(print ${(qq)_ZCACHE_BUNDLE_SOURCE}))
typeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='{{ANTIGEN_VERSION}}'
#-- END ZCACHE GENERATED FILE
EOC
Expand Down Expand Up @@ -127,7 +128,9 @@ EOC
-antigen-cache-generate
[[ -f "$ANTIGEN_CACHE" ]] && source "$ANTIGEN_CACHE";

unset _ZCACHE_BUNDLE_SOURCE _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS
# Commented out in order to have a working `cache-gen` command
#unset _ZCACHE_BUNDLE_SOURCE
unset _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS

# Release all hooked functions
antigen-remove-hook -antigen-load-env-cached
Expand Down
8 changes: 8 additions & 0 deletions tests/cache.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ Enable extension.
$ antigen list
You don't have any bundles.
[1]

Can programatically generate cache.

$ antigen reset &> /dev/null
$ antigen cache-gen
$ ls $ADOTDIR/init*
.*init.zsh.* (re)
.*init.zsh.zwc* (re)

0 comments on commit c23835d

Please sign in to comment.