├── .gitignore ├── LICENSE ├── README.md ├── debian ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── docs └── rules ├── rake ├── release └── test ├── check_rake_files ├── .rake_tasks~ ├── Rakefile ├── description ├── fresher ├── lib │ └── include.rake └── tasks ├── no_rakefile ├── .rake_tasks~ ├── description └── tasks ├── run ├── run_from_subdirectory ├── Rakefile ├── description ├── subdirectory │ └── .rake_tasks~ └── tasks ├── update_cache ├── .rake_tasks~ ├── Rakefile ├── description ├── fresher └── tasks └── use_cache ├── .rake_tasks~ ├── Rakefile ├── description ├── fresher └── tasks /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *~ 3 | 4 | build 5 | !.rake_tasks~ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Warning: this project is obsolete 2 | 3 | Updates and support are no longer provided. Feel free to improve it. 4 | 5 | ----- 6 | 7 | # Rake Completion 8 | 9 | Bash completion support for Rake, Ruby Make. 10 | 11 | $ rake st 12 | $ rake stats 13 | 14 | $ rake test 15 | test test:integration test:recent 16 | test:benchmark test:plugins test:uncommitted 17 | test:functionals test:profile test:units 18 | 19 | It caches tasks to `.rake_tasks~` file, which makes it faster from default completion from Ubuntu rake. 20 | 21 | If Rakefile is not present in current directory, autocomplete will try to locate it in 22 | parent directories up to filesystem root, so running tasks is also possible from subdirectories. 23 | 24 | ## Install 25 | 26 | ### Ubuntu 27 | 28 | Obsolete: the package is no longer available at PPA. 29 | 30 | ~~1. Add Ubuntu on Rails PPA:~~ 31 | 32 | $ sudo add-apt-repository ppa:ubuntu-on-rails/ppa 33 | $ sudo apt-get update 34 | 35 | ~~2. Install `rake-completion` package:~~ 36 | 37 | $ sudo apt-get install rake-completion 38 | 39 | ### Mac + Homebrew 40 | 41 | Make sure you are running an up-to-date `bash` version (at least 4.3). 42 | 43 | Installing bash and bash-completion with [homebrew](http://brew.sh/) run: 44 | 45 | $ brew install bash bash-completion 46 | 47 | Then install this script: 48 | 49 | $ curl -o /usr/local/etc/bash_completion.d/rake https://raw.githubusercontent.com/ai/rake-completion/master/rake 50 | 51 | 52 | ### Other UNIX-like 53 | 54 | #### System 55 | 56 | Copy `rake` script to `/etc/bash_completion.d/`. 57 | 58 | $ wget -O /etc/bash_completion.d/rake https://raw.githubusercontent.com/ai/rake-completion/master/rake 59 | 60 | #### User 61 | 62 | Copy `rake` script (for example, to `~/scripts/`) and add to your `.bashrc`: 63 | 64 | . ~/scripts/rake 65 | 66 | ## Cache 67 | 68 | Tasks cache in `.rake_tasks~` file is placed in directory with Rakefile and 69 | will be updated on changes in Rakefile or any `*.rake` files. 70 | 71 | To remove tasks cache (and another backup files) from Git repository add `*~` to 72 | `.gitignore` file. 73 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | rake-completion (0.2~uorppa1) karmic; urgency=low 2 | 3 | * Add comparison with Ubuntu rake completion to package description 4 | 5 | -- Andrey Sitnik Thu, 26 Nov 2009 13:42:10 +0300 6 | 7 | rake-completion (0.2~railsppa0) karmic; urgency=low 8 | 9 | * Compatibility with completion from Ubuntu rake package 10 | * Add cache tips to documentation. 11 | 12 | -- Andrey Sitnik Thu, 26 Nov 2009 13:16:10 +0300 13 | 14 | rake-completion (0.1~railsppa1) karmic; urgency=low 15 | 16 | * Add Ubuntu install instructions 17 | 18 | -- Andrey Sitnik Wed, 25 Nov 2009 16:39:49 +0300 19 | 20 | rake-completion (0.1~railsppa0) karmic; urgency=low 21 | 22 | * Initial release 23 | 24 | -- Andrey Sitnik Wed, 25 Nov 2009 15:45:17 +0300 25 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: rake-completion 2 | Section: devel 3 | Priority: optional 4 | Maintainer: Andrey Sitnik 5 | Build-Depends: debhelper (>= 7) 6 | Standards-Version: 0.2~uorppa1 7 | Vcs-Git: git://github.com/ai/rake-completion.git 8 | Vcs-Browser: http://github.com/ai/rake-completion 9 | 10 | Package: rake-completion 11 | Architecture: any 12 | Description: Bash completion for Rake 13 | Bash completion support for Rake, Ruby Make. It cache tasks to .rake_tasks~ and 14 | update it if it will be outdated. So it's more faster, that default completion 15 | from Ubuntu rake. 16 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Andrey Sitnik on 2 | Wed, 25 Nov 2009 15:45:17 +0300. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author: 7 | 8 | Andrey Sitnik 9 | Ryan Bates 10 | 11 | Copyright: 12 | 13 | Copyright (C) 2009 Andrey Sitnik, Ryan Bates 14 | 15 | License: 16 | 17 | This program is free software: you can redistribute it and/or modify 18 | it under the terms of the GNU Lesser General Public License as published by 19 | the Free Software Foundation, either version 3 of the License, or 20 | (at your option) any later version. 21 | 22 | This program is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU Lesser General Public License for more details. 26 | 27 | You should have received a copy of the GNU Lesser General Public License 28 | along with this program. If not, see . 29 | 30 | The Debian packaging is copyright 2009, Andrey Sitnik and 31 | is licensed under the LGPL, see `/usr/share/common-licenses/LGPL-3'. 32 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | /etc/bash_completion.d/ 2 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | build = $(CURDIR)/debian/rake-completion 4 | 5 | clean: 6 | rm -f build 7 | 8 | build: 9 | touch build 10 | 11 | install: 12 | dh_testdir 13 | dh_testroot 14 | dh_installdirs 15 | dh_installdocs 16 | 17 | cp rake $(build)/etc/bash_completion.d/rake_cached 18 | 19 | binary-indep: install 20 | 21 | binary-arch: install 22 | dh_installdocs 23 | dh_installchangelogs 24 | dh_installdeb 25 | dh_compress 26 | dh_gencontrol 27 | dh_builddeb 28 | 29 | binary: binary-indep binary-arch 30 | -------------------------------------------------------------------------------- /rake: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Bash completion support for Rake, Ruby Make. 3 | 4 | # This messes up COMP_WORDBREAKS throughout the system. 5 | # Fixing it to restrict changes to rakecomplete only. 6 | # export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} 7 | 8 | _rakecomplete() { 9 | local cur 10 | _get_comp_words_by_ref -n : cur 11 | rakefile="" 12 | seek_path="." 13 | while true; do 14 | rakefile="${seek_path}/Rakefile" 15 | [[ $(readlink -f $seek_path) == "/" || -f "$rakefile" ]] && break 16 | seek_path="../${seek_path}" 17 | done 18 | 19 | if [[ -f "$rakefile" ]]; then 20 | recent=`ls -t $seek_path/.rake_tasks~ ${rakefile} **/*.rake 2> /dev/null | head -n 1` 21 | if [[ $recent != "$seek_path/.rake_tasks~" ]]; then 22 | rake --silent --prereqs | grep "rake" | cut -d " " -f 2 > $seek_path/.rake_tasks~ 23 | fi 24 | COMPREPLY=($(compgen -W "`cat $seek_path/.rake_tasks~`" -- "$cur")) 25 | # remove colon containing prefix from COMPREPLY items 26 | __ltrim_colon_completions "$cur" 27 | return 0 28 | else 29 | COMPREPLY=() 30 | fi 31 | } 32 | 33 | complete -o default -o nospace -F _rakecomplete rake 34 | -------------------------------------------------------------------------------- /release: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Build all files to upload to PPA or .deb package (call with deb argument). 3 | 4 | version=`cat debian/control | grep ^Standards-Version: | awk '{print $2}'` 5 | dir=rake-completion-$version 6 | 7 | if [ -d build ]; then 8 | rm -R build 9 | fi 10 | mkdir -p build/$dir 11 | cd build/$dir 12 | 13 | for file in `ls -A ../../ | grep -v build`; do 14 | cp -R ../../$file ./ 15 | done 16 | 17 | rm -Rf .git 18 | rm -Rf build 19 | rm .gitignore 20 | 21 | if [ 'deb' = "$1" ]; then 22 | debuild 23 | else 24 | debuild -S 25 | fi 26 | 27 | cd .. 28 | rm -R $dir 29 | 30 | if [ 'deb' = "$1" ]; then 31 | for file in `ls ./ | grep -v .deb`; do 32 | rm $file 33 | done 34 | fi 35 | 36 | cd .. 37 | 38 | -------------------------------------------------------------------------------- /test/check_rake_files/.rake_tasks~: -------------------------------------------------------------------------------- 1 | Rakefile 2 | -------------------------------------------------------------------------------- /test/check_rake_files/Rakefile: -------------------------------------------------------------------------------- 1 | desc "Task in main Rakefile" 2 | task "Rakefile" do; end 3 | 4 | load File.join(File.dirname(__FILE__), 'lib/include.rake') 5 | -------------------------------------------------------------------------------- /test/check_rake_files/description: -------------------------------------------------------------------------------- 1 | check modification time for **/*.rake files 2 | -------------------------------------------------------------------------------- /test/check_rake_files/fresher: -------------------------------------------------------------------------------- 1 | Rakefile 2 | .rake_tasks~ 3 | lib/include.rake 4 | -------------------------------------------------------------------------------- /test/check_rake_files/lib/include.rake: -------------------------------------------------------------------------------- 1 | desc "Task in *.rake file" 2 | task "rake" do; end 3 | -------------------------------------------------------------------------------- /test/check_rake_files/tasks: -------------------------------------------------------------------------------- 1 | Rakefile rake 2 | -------------------------------------------------------------------------------- /test/no_rakefile/.rake_tasks~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ai/rake-completion/e46866ebf5d2e0d5b8cb3f03bae6ff98f22a2899/test/no_rakefile/.rake_tasks~ -------------------------------------------------------------------------------- /test/no_rakefile/description: -------------------------------------------------------------------------------- 1 | don't do anything if Rake file not found 2 | -------------------------------------------------------------------------------- /test/no_rakefile/tasks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ai/rake-completion/e46866ebf5d2e0d5b8cb3f03bae6ff98f22a2899/test/no_rakefile/tasks -------------------------------------------------------------------------------- /test/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion 4 | 5 | # Run all tests and print results. 6 | GOOD="\e[32m" 7 | BAD="\e[31m" 8 | CLEAR="\e[0m" 9 | 10 | all=0 11 | fail=0 12 | 13 | cd `dirname $0` 14 | . ../rake 15 | 16 | for cache in */.rake_tasks~; do 17 | cp "$cache" "`dirname $cache`/.rake_tasks~~" 18 | done 19 | 20 | for fresher in */fresher; do 21 | for file in `cat "$fresher"`; do 22 | touch "`dirname $fresher`/$file" 23 | sleep 0.001 24 | done 25 | done 26 | 27 | for test in */; do 28 | cd $test 29 | if [ -d ./subdirectory ]; then 30 | cd ./subdirectory 31 | _rakecomplete 32 | cd .. 33 | else 34 | _rakecomplete 35 | fi 36 | 37 | if [ "`echo ${COMPREPLY[@]}`" = "`cat tasks`" ]; then 38 | echo -e "$GOOD* `cat description`$CLEAR" 39 | else 40 | echo -e "$BAD* `cat description`$CLEAR" 41 | echo " expected: `cat tasks`" 42 | echo -e " got: $BAD${COMPREPLY[@]}$CLEAR" 43 | let "fail += 1" 44 | fi 45 | 46 | let "all += 1" 47 | cd .. 48 | done 49 | 50 | rm **/.rake_tasks~ 51 | 52 | for cache in */.rake_tasks~~; do 53 | mv "$cache" "`dirname $cache`/.rake_tasks~" 54 | done 55 | 56 | if [ $fail -eq 0 ]; then echo -en "$GOOD"; else echo -en "$BAD"; fi 57 | 58 | if [ $all -eq 1 ]; then 59 | echo -n " $all test," 60 | else 61 | echo -n " $all tests," 62 | fi 63 | 64 | if [ $fail -eq 0 ]; then 65 | echo " no failures" 66 | exit 0 67 | else 68 | echo -n " $fail " 69 | if [ $fail -eq 1 ]; then echo "failure"; else echo "failures"; fi 70 | exit 1 71 | fi 72 | -------------------------------------------------------------------------------- /test/run_from_subdirectory/Rakefile: -------------------------------------------------------------------------------- 1 | desc "Task in subdirectory" 2 | task "subdirectory" do; end 3 | -------------------------------------------------------------------------------- /test/run_from_subdirectory/description: -------------------------------------------------------------------------------- 1 | seek for Rakefile in parent directories 2 | -------------------------------------------------------------------------------- /test/run_from_subdirectory/subdirectory/.rake_tasks~: -------------------------------------------------------------------------------- 1 | subdirectory 2 | -------------------------------------------------------------------------------- /test/run_from_subdirectory/tasks: -------------------------------------------------------------------------------- 1 | subdirectory 2 | -------------------------------------------------------------------------------- /test/update_cache/.rake_tasks~: -------------------------------------------------------------------------------- 1 | in 2 | -------------------------------------------------------------------------------- /test/update_cache/Rakefile: -------------------------------------------------------------------------------- 1 | desc "Task in cache" 2 | task "in" do; end 3 | 4 | desc "Task out of cache" 5 | task "out" do; end 6 | -------------------------------------------------------------------------------- /test/update_cache/description: -------------------------------------------------------------------------------- 1 | update cache if it's outdated 2 | -------------------------------------------------------------------------------- /test/update_cache/fresher: -------------------------------------------------------------------------------- 1 | .rake_tasks~ 2 | Rakefile 3 | -------------------------------------------------------------------------------- /test/update_cache/tasks: -------------------------------------------------------------------------------- 1 | in out 2 | -------------------------------------------------------------------------------- /test/use_cache/.rake_tasks~: -------------------------------------------------------------------------------- 1 | in 2 | -------------------------------------------------------------------------------- /test/use_cache/Rakefile: -------------------------------------------------------------------------------- 1 | desc "Task in cache" 2 | task "in" do; end 3 | 4 | desc "Task out of cache" 5 | task "out" do; end 6 | -------------------------------------------------------------------------------- /test/use_cache/description: -------------------------------------------------------------------------------- 1 | use cache file 2 | -------------------------------------------------------------------------------- /test/use_cache/fresher: -------------------------------------------------------------------------------- 1 | Rakefile 2 | .rake_tasks~ 3 | -------------------------------------------------------------------------------- /test/use_cache/tasks: -------------------------------------------------------------------------------- 1 | in 2 | --------------------------------------------------------------------------------