Skip to content

Commit

Permalink
standardize plugins, update metadata
Browse files Browse the repository at this point in the history
add about-plugin metadata
chmod -x plugins
cleanup filenames to standardize on x.plugin.bash format
only plugin files intended to be executable from the command line should
contain a shebang line, and should be a+x.
  • Loading branch information
erichs committed May 14, 2012
1 parent 254d445 commit 55e77de
Show file tree
Hide file tree
Showing 27 changed files with 214 additions and 53 deletions.
File renamed without changes.
4 changes: 1 addition & 3 deletions plugins/available/base.plugin.bash 100755 → 100644
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

cite about-plugin
about-plugin generic and miscellaneous tools
about-plugin miscellaneous tools

ips ()
{
Expand Down
4 changes: 1 addition & 3 deletions plugins/available/battery.plugin.bash 100755 → 100644
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

cite about-plugin
about-plugin query and display info about your battery charge level
about-plugin display info about your battery charge level

battery_percentage(){
about 'displays battery charge as a percentage of full (100%)'
Expand Down
19 changes: 17 additions & 2 deletions plugins/available/dirs.plugins.bash → plugins/available/dirs.plugin.bash 100755 → 100644
@@ -1,12 +1,13 @@
#!/usr/bin/env bash

# Directory stack navigation:
#
# Add to stack with: pu /path/to/directory
# Delete current dir from stack with: po
# Show stack with: d
# Jump to location by number.

cite about-plugin
about-plugin directory stack navigation

# Show directory stack
alias d="dirs -v -l"

Expand All @@ -31,6 +32,9 @@ alias pu="pushd"
alias po="popd"

function dirs-help() {
about directory navigation alias usage
group dirs

echo "Directory Navigation Alias Usage"
echo
echo "Use the power of directory stacking to move"
Expand Down Expand Up @@ -64,17 +68,28 @@ fi
alias L='cat ~/.dirs'

G () { # goes to distination dir otherwise , stay in the dir
about goes to destination dir
param 1: directory
example '$ G ..'
group dirs

cd ${1:-$(pwd)} ;
}

S () { # SAVE a BOOKMARK
about save a bookmark
group dirs

sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs;
echo "$@"=\"`pwd`\" >> ~/.dirs;
source ~/.dirs ;
}

R () { # remove a BOOKMARK
about remove a bookmark
group dirs

sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs;
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/available/extract.plugin.bash
@@ -1,3 +1,5 @@
cite about-plugin
about-plugin one command to extract them all...
extract () {
if [ $# -ne 1 ]
then
Expand Down
Expand Up @@ -584,7 +584,8 @@ fasd [-A|-D] [paths ...]
fasd --init env

case $- in
*i*) alias fasd=$BASH_IT'/plugins/enabled/fasd.bash'
*i*) cite about-plugin
about-plugin navigate 'frecently' used files and directories
eval "$(fasd --init auto)"
;;
*) # assume being executed as an executable
Expand Down
@@ -1,26 +1,42 @@
#!/usr/bin/env bash
cite about-plugin
about-plugin git helper functions

function git_remote {
about 'adds remote $GIT_HOSTING:$1 to current repo'
group git

echo "Running: git remote add origin ${GIT_HOSTING}:$1.git"
git remote add origin $GIT_HOSTING:$1.git
}

function git_first_push {
about push into origin refs/heads/master
group git

echo "Running: git push origin master:refs/heads/master"
git push origin master:refs/heads/master
}

function git_remove_missing_files() {
about "git rm's missing files"
group git

git ls-files -d -z | xargs -0 git update-index --remove
}

# Adds files to git's exclude file (same as .gitignore)
function local-ignore() {
about adds file or path to git exclude file
param 1: file or path fragment to ignore
group git
echo "$1" >> .git/info/exclude
}

# get a quick overview for your git repo
function git_info() {
about overview for your git repo
group git

if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
# print informations
echo "git repo overview"
Expand All @@ -29,7 +45,7 @@ function git_info() {

# print all remotes and thier details
for remote in $(git remote show); do
echo $remote:
echo $remote:
git remote show $remote
echo
done
Expand All @@ -43,10 +59,10 @@ function git_info() {
fi

# print at least 5 last log entries
echo
echo
echo "log:"
git log -5 --oneline
echo
echo

else
echo "you're currently not in a git repository"
Expand All @@ -55,6 +71,9 @@ function git_info() {
}

function git_stats {
about display stats per author
group git

# awesome work from https://github.com/esc/git-stats
# including some modifications

Expand Down
@@ -1,14 +1,25 @@
#!/usr/bin/env bash
cite about-plugin
about-plugin hg helper functions

hg_dirty() {
about displays dirty status of hg repository
group hg

hg status --no-color 2> /dev/null \
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
| sort | uniq | head -c1
}

hg_in_repo() {
about 'determine if pwd is an hg repo'
group hg

[[ `hg branch 2> /dev/null` ]] && echo 'on '
}

hg_branch() {
about display current hg branch
group hg

hg branch 2> /dev/null
}
@@ -1,16 +1,22 @@
#!/usr/bin/env bash
#
# The install directory is hard-coded. TOOD: allow the directory to be specified on the command line.
#
# The install directory is hard-coded. TODO: allow the directory to be specified on the command line.

cite about-plugin
about-plugin download jquery files into current project

[[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1"
[[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13"

function rails_jquery {
about 'download rails.js into public/javascripts'
group javascript

curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
}

function jquery_install {
about 'download jquery.js into public/javascripts'
group javascripts

if [ -z "$1" ]
then
version=$JQUERY_VERSION_NUMBER
Expand All @@ -21,6 +27,9 @@ function jquery_install {
}

function jquery_ui_install {
about 'download jquery_us.js into public/javascripts'
group javascripts

if [ -z "$1" ]
then
version=$JQUERY_UI_VERSION_NUMBER
Expand Down
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
cite about-plugin
about-plugin manage your jekyll site

editpost() {
about edit a post
param 1: site directory
group jekyll

unset SITE
if [ -z "$1" ]
then
Expand Down Expand Up @@ -35,11 +40,11 @@ editpost() {
DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"`
TITLE=`cat $POST | grep -oE "title: (.+)"`
TITLE=`echo $TITLE | sed 's/title: //'`
echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE"
echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE"
POSTS[$COUNTER]=$POST
COUNTER=`expr $COUNTER + 1`
done
less $TMPFILE
less $TMPFILE
read -p "Number of post to edit: " POST_TO_EDIT
if [ -z "$JEKYLL_EDITOR" ]
then
Expand All @@ -50,6 +55,10 @@ editpost() {
}

newpost() {
about create a new post
param 1: site directory
group jekyll

unset SITE
if [ -z "$1" ]
then
Expand Down Expand Up @@ -93,7 +102,7 @@ newpost() {
then
select OPTION in $OPTIONS
do
if [[ $OPTION = "Text" ]]
if [[ $OPTION = "Text" ]]
then
POST_TYPE="Text"
break
Expand Down Expand Up @@ -257,6 +266,10 @@ newpost() {
}

function testsite() {
about launches local jekyll server
param 1: site directory
group jekyll

unset SITE
if [ -z "$1" ]
then
Expand Down Expand Up @@ -285,6 +298,10 @@ function testsite() {
}

function buildsite() {
about builds site
param 1: site directory
group jekyll

unset SITE
if [ -z "$1" ]
then
Expand Down Expand Up @@ -314,6 +331,10 @@ function buildsite() {
}

function deploysite() {
about 'rsyncs site to remote host'
param 1: site directory
group jekyll

unset SITE
if [ -z "$1" ]
then
Expand Down
3 changes: 2 additions & 1 deletion plugins/available/latex.plugin.bash
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
cite about-plugin
about-plugin use mactex

# add mactex to the path if its present
MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin
Expand Down
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
cite about-plugin
about-plugin manage your nginx service

function nginx_reload() {
about reload your nginx config
group nginx

FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Reloading NGINX..."
Expand All @@ -13,6 +17,9 @@ function nginx_reload() {
}

function nginx_stop() {
about stop nginx
group nginx

FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
Expand All @@ -25,6 +32,9 @@ function nginx_stop() {
}

function nginx_start() {
about start nginx
group nginx

FILE="${NGINX_PATH}/sbin/nginx"
if [ -e $FILE ]; then
echo "Starting NGINX..."
Expand All @@ -35,6 +45,9 @@ function nginx_start() {
}

function nginx_restart() {
about restart nginx
group nginx

FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
Expand Down
7 changes: 7 additions & 0 deletions plugins/available/nvm.plugin.bash
Expand Up @@ -5,6 +5,9 @@
# Implemented by Tim Caswell <tim@creationix.com>
# with much bash help from Matthew Ranney

cite about-plugin
about-plugin 'node version manager, as a bash function'

export NVM_DIR=$HOME/.nvm

if [ ! -d "$NVM_DIR" ]; then
Expand Down Expand Up @@ -75,6 +78,10 @@ print_versions()

nvm()
{
about 'Node Version Manager'
param '1: command, see nvm help'
group nvm

if [ $# -lt 1 ]; then
nvm help
return
Expand Down

0 comments on commit 55e77de

Please sign in to comment.