oh-my-zsh
This commit is contained in:
23
.oh-my-zsh/plugins/rake-fast/README.md
Normal file
23
.oh-my-zsh/plugins/rake-fast/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# rake-fast
|
||||
|
||||
Fast rake autocompletion plugin.
|
||||
|
||||
This script caches the output for later usage and significantly speeds it up. It generates a .rake_tasks cache file in parallel to the Rakefile. It also checks the file modification dates to see if it needs to regenerate the cache file.
|
||||
|
||||
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
|
||||
|
||||
Think about that. 2006.
|
||||
|
||||
## Installation
|
||||
|
||||
Just add the plugin to your `.zshrc`:
|
||||
|
||||
```bash
|
||||
plugins=(foo bar rake-fast)
|
||||
```
|
||||
|
||||
You might consider adding `.rake_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore)
|
||||
|
||||
## Usage
|
||||
|
||||
`rake`, then press tab
|
||||
29
.oh-my-zsh/plugins/rake-fast/rake-fast.plugin.zsh
Normal file
29
.oh-my-zsh/plugins/rake-fast/rake-fast.plugin.zsh
Normal file
@@ -0,0 +1,29 @@
|
||||
_rake_refresh () {
|
||||
if [ -f .rake_tasks ]; then
|
||||
rm .rake_tasks
|
||||
fi
|
||||
echo "Generating .rake_tasks..." > /dev/stderr
|
||||
_rake_generate
|
||||
cat .rake_tasks
|
||||
}
|
||||
|
||||
_rake_does_task_list_need_generating () {
|
||||
[[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]]
|
||||
}
|
||||
|
||||
_rake_generate () {
|
||||
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
|
||||
}
|
||||
|
||||
_rake () {
|
||||
if [ -f Rakefile ]; then
|
||||
if _rake_does_task_list_need_generating; then
|
||||
echo "\nGenerating .rake_tasks..." > /dev/stderr
|
||||
_rake_generate
|
||||
fi
|
||||
compadd `cat .rake_tasks`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _rake rake
|
||||
alias rake_refresh='_rake_refresh'
|
||||
Reference in New Issue
Block a user