forked from ellipsis/ellipsis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zach Kelling
committed
Apr 27, 2014
0 parents
commit 9319955
Showing
24 changed files
with
2,298 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages | ||
deps | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: node_js | ||
node_js: | ||
- 0.10 | ||
script: make test | ||
env: | ||
- TEST_OPTS=--tap | ||
cache: | ||
directories: | ||
- deps | ||
- node_modules | ||
notifications: | ||
email: | ||
on_success: change | ||
on_failure: always | ||
after_sucess: | ||
- npm install brief && node_modules/.bin/brief |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011-2014 Zach Kelling | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ellipsis - shell script package manager | ||
|
||
all: test | ||
|
||
gh-pages: | ||
brief | ||
|
||
tag: | ||
@echo ELLIPSIS_VERSION=$(version) > src/version.sh | ||
@git add src/version.sh | ||
@git commit -m v$(version) | ||
@git tag v$(version) | ||
|
||
test: deps/bats | ||
deps/bats/bin/bats test $(TEST_OPTS) | ||
|
||
deps/bats: | ||
@mkdir -p deps | ||
git clone --depth 1 git://github.com/sstephenson/bats.git deps/bats | ||
|
||
.PHONY: all tag test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
## ellipsis [![Build Status](https://travis-ci.org/zeekay/ellipsis.svg?branch=master)](https://travis-ci.org/zeekay/ellipsis) | ||
|
||
``` | ||
_ _ _ | ||
/\_\ /\_\ /\_\ | ||
\/_/ \/_/ \/_/ …because $HOME is where the <3 is! | ||
``` | ||
|
||
ellipsis is a package manager for dotfiles. | ||
|
||
### Features | ||
- Creating new packages is trivial (any git repository is already a package). | ||
- Ellipsis packages make it easy to share specific bits of your dotfiles. Say a | ||
friend wants to test out your ZSH setup but doesn't want to adopt the madness | ||
that is your Vim config? No problem, he can just `ellipsis install | ||
github-user/dot-zsh` | ||
- Quickly see which dotfiles have been modified, and keep them updated and in | ||
sync across systems. | ||
- Cross platform, known to work on Mac OS X, Linux, FreeBSD and even Cygwin. | ||
- Completely customizable. | ||
|
||
### Install | ||
Clone and symlink or use handy-dandy installer: | ||
|
||
```bash | ||
$ curl -sL ellipsis.sh | sh | ||
``` | ||
|
||
You can also specify which packages to install by setting the `PACKAGES` variable, i.e.: | ||
|
||
```bash | ||
$ curl -sL ellipsis.sh | PACKAGES='vim zsh' sh | ||
``` | ||
|
||
I recommend adding `~/.ellipsis/bin` to your `$PATH`, but you can also just | ||
symlink `~/.ellipsis/bin/ellipsis` somewhere convenient. | ||
|
||
### Usage | ||
Ellipsis comes with no dotfiles out of the box. To add a dotfiles packages, use | ||
`ellipsis install`. Packages to install can be specified by github-user/repo or | ||
full ssh/git/http(s) urls: | ||
|
||
```bash | ||
$ ellipsis install ssh://github.com/zeekay/private.git | ||
$ ellipsis install zeekay/vim | ||
$ ellipsis install zsh | ||
``` | ||
|
||
...all work. | ||
|
||
Full usage available via `ellipsis` executable: | ||
|
||
``` | ||
$ ellipsis -h | ||
Usage: ellipsis <command> | ||
Options: | ||
-h, --help show help | ||
-v, --version show version | ||
Commands: | ||
new create a new package | ||
edit edit an installed package | ||
install install new package | ||
uninstall uninstall package | ||
unlink unlink package | ||
broken list any broken symlinks | ||
clean rm broken symlinks | ||
list list installed packages | ||
links show symlinks installed by package(s) | ||
pull git pull package(s) | ||
push git push package(s) | ||
status show status of package(s) | ||
publish publish package to repository | ||
search search package repository | ||
``` | ||
|
||
### Configuration | ||
You can customize ellipsis by exporting a few different variables. | ||
|
||
#### ELLIPSIS_USER | ||
Customize whose dotfiles are installed when you `ellipsis install` without | ||
specifiying user or a full repo url. | ||
|
||
#### ELLIPSIS_REPO | ||
Customize location of ellipsis repo cloned during a curl-based install. | ||
|
||
#### ELLIPSIS_PACKAGES_URL | ||
Customizes which url is used to display available packages. | ||
|
||
```bash | ||
export ELLIPSIS_USER="zeekay" | ||
export ELLIPSIS_REPO="https://github.com/zeekay/ellipsis" | ||
export ELLIPSIS_PACKAGES_URL="https://raw.githubusercontent.com/zeekay/ellipsis/master/available-packages.txt" | ||
``` | ||
|
||
### Packages | ||
A package is any repo with files you want to symlink into `$HOME`. By default a | ||
given repo's non-hidden files (read: not beginning with a `.`) will naively be | ||
linked into `$HOME`. Of course this isn't sufficient for a lot of cases, so you | ||
can customize how ellipsis treats your package by defining hooks in an | ||
`ellipsis.sh` file at the root of your repository. | ||
|
||
### Hooks | ||
Hooks allow you to customize how ellipsis interacts with your package. For | ||
instance if you want to change how your package is installed you can define | ||
`pkg.install` and specifiy exactly which files are symlinked into `$HOME`, | ||
compile any libraries, etc. | ||
|
||
The follow hooks/variables are available in your `ellipsis.sh`: | ||
|
||
#### pkg.install | ||
Customize how package is installed. By default all files are symlinked into | ||
`$HOME`. | ||
|
||
#### pkg.uninstall | ||
Customize how package is uninstalled. By default all symlinks are removed from | ||
`$HOME`. | ||
|
||
#### pkg.push | ||
Customize how how changes are pushed `ellipsis push` is used. | ||
|
||
#### pkg.pull | ||
Customize how how changes are pulled in when `ellipsis pull` is used. | ||
|
||
#### pkg.status | ||
Customize output of `ellipsis status`. | ||
|
||
#### $PKG_NAME | ||
Name of your package. | ||
|
||
#### $PKG_PATH | ||
Path to your package. | ||
|
||
### API | ||
There are a number of functions ellipsis exposes which can be useful in your | ||
package's hooks: | ||
|
||
#### ellipsis.backup | ||
Moves existing file `$1` to `$1.bak`, taking care not to overwrite any existing | ||
backups. | ||
|
||
#### ellipsis.link_file | ||
Link a single file `$1` into `$HOME`, taking care to backup an existing file. | ||
|
||
#### ellipsis.link_files | ||
Links files in `$1` into `$HOME`, taking care to backup any existing files. | ||
|
||
#### ellipsis.run_installer | ||
Download an installation script from url `$1` with `curl` and execute it. | ||
|
||
#### utils.platform | ||
Platform detection, returns lowercase result of `uname`. | ||
|
||
#### git.[command] | ||
There are also several wrappers around common git operations which can be used | ||
for consistency with the rest of ellipsis: **git.clone**, **git.pull**, | ||
**git.push**, and **git.status**. | ||
|
||
### Available packages | ||
|
||
#### [zeekay/dot-alfred][alfred] | ||
Alfred configuration files. | ||
|
||
#### [zeekay/dot-atom][atom] | ||
Atom configuration files. | ||
|
||
#### [zeekay/dot-emacs][emacs] | ||
Emacs configuration files. | ||
|
||
#### [zeekay/dot-files][files] | ||
Default dotfiles for ellipsis. | ||
|
||
#### [zeekay/dot-irssi][irssi] | ||
Irssi configuration. | ||
|
||
#### [zeekay/dot-iterm2][iterm2] | ||
iTerm2 configuration files. | ||
|
||
#### [zeekay/dot-vim][vim] | ||
Vim configuration based on vice framework. | ||
|
||
#### [zeekay/dot-xmonad][xmonad] | ||
Xmonad configuration. | ||
|
||
#### [zeekay/dot-zsh][zsh] | ||
Zsh configuration using zeesh! framework. | ||
|
||
### Development | ||
Pull requests welcome! New code should follow [Google's style | ||
guide][style-guide]. To run tests you need to install [bats][bats]. | ||
|
||
To suggest a feature or report a bug: http://github.com/zeekay/ellipsis/issues. | ||
|
||
[alfred]: https://github.com/zeekay/dot-alfred | ||
[atom]: https://github.com/zeekay/dot-atom | ||
[emacs]: https://github.com/zeekay/dot-emacs | ||
[files]: https://github.com/zeekay/dot-files | ||
[irssi]: https://github.com/zeekay/dot-irssi | ||
[iterm2]: https://github.com/zeekay/dot-iterm2 | ||
[vim]: https://github.com/zeekay/dot-vim | ||
[xmonad]: https://github.com/zeekay/dot-xmonad | ||
[zsh]: https://github.com/zeekay/dot-zsh | ||
[style-guide]: https://google-styleguide.googlecode.com/svn/trunk/shell.xml | ||
[bats]: https://github.com/sstephenson/bats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
source "$(dirname "${BASH_SOURCE[0]}")/../src/init.sh" | ||
|
||
load cli | ||
|
||
# check for controlling terminal | ||
if [ -t 1 ]; then | ||
cli.run $@ | ||
exit $? | ||
else | ||
# strip ansi colors | ||
cli.run $@ | sed -e 's/\[[^m]*m//g' | ||
exit $PIPESTATUS # exit with result of first command in pipe, i.e., cli.run | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#compdef ellipsis | ||
|
||
_ellipsis() { | ||
local -a commands | ||
commands=( | ||
'broken:list any broken symlinks' | ||
'clean:rm broken symlinks' | ||
'edit:edit an installed package' | ||
'help:show this usage' | ||
'install:install new package' | ||
'links:show symlinks installed by package(s)' | ||
'list:list installed packages' | ||
'new:create a new package' | ||
'publish:publish package to repository' | ||
'pull:git pull package(s)' | ||
'push:git push package(s)' | ||
'search:search package repository' | ||
'status:show status of package(s)' | ||
'uninstall:uninstall package' | ||
'unlink:unlink package' | ||
'version:show current version' | ||
) | ||
|
||
if (( CURRENT == 2 )); then | ||
_describe -t commands 'commands' commands | ||
fi | ||
|
||
return 0 | ||
} | ||
|
||
_ellipsis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# scripts/install.sh | ||
# Installer for ellipsis (http://ellipsis.sh). | ||
|
||
# Ensure dependencies are installed. | ||
deps=(bash curl git) | ||
|
||
for dep in ${deps[*]}; do | ||
hash $dep 2>/dev/null || { echo >&2 "ellipsis requires $dep to be installed."; exit 1; } | ||
done | ||
|
||
# Create temp dir. | ||
tmp_dir=$(mktemp -d ${TMPDIR:-tmp}-XXXXXX) | ||
|
||
# Clone ellipsis into $tmp_dir. | ||
git clone --depth 1 git://github.com/zeekay/ellipsis.git $tmp_dir/ellipsis | ||
|
||
# Save reference to specified ELLIPSIS_PATH (if any) otherwise final | ||
# destination: $HOME/.ellipsis. | ||
FINAL_ELLIPSIS_PATH=${ELLIPSIS_PATH:-$HOME/.ellipsis} | ||
|
||
# Temporarily set ellipsis PATH so we can load other files. | ||
ELLIPSIS_PATH="$tmp_dir/ellipsis" | ||
|
||
# Initialize ellipsis. | ||
source $tmp_dir/ellipsis/src/init.sh | ||
|
||
# Load modules. | ||
load ellipsis | ||
load git | ||
load pkg | ||
load registry | ||
load utils | ||
|
||
ELLIPSIS_PATH="$FINAL_ELLIPSIS_PATH" | ||
|
||
# Backup existing ~/.ellipsis if necessary and move project into place. | ||
ellipsis.backup $ELLIPSIS_PATH | ||
mv $tmp_dir/ellipsis $ELLIPSIS_PATH | ||
|
||
# Clean up (only necessary on cygwin, really). | ||
rm -rf $tmp_dir | ||
|
||
# Backwards compatability, originally referred to packages as modules. | ||
PACKAGES="${PACKAGES:-$MODULES}" | ||
|
||
if [ -z "$PACKAGES" ]; then | ||
# List available packages. | ||
registry.available | ||
|
||
# List default packages for this platform. | ||
if [ "$(utils.platform)" = "darwin" ]; then | ||
default="zeekay/dot-files zeekay/dot-vim zeekay/dot-zsh zeekay/dot-alfred zeekay/dot-iterm2" | ||
else | ||
default="zeekay/dot-files zeekay/dot-vim zeekay/dot-zsh" | ||
fi | ||
|
||
echo "default: $default" | ||
|
||
# allow user to override defaults | ||
read packages < /dev/tty | ||
packages="${packages:-$default}" | ||
else | ||
# user already provided packages list to install | ||
packages="$PACKAGES" | ||
fi | ||
|
||
# install selected packages. | ||
for pkg in ${packages[*]}; do | ||
ellipsis.install "$pkg" | ||
done | ||
|
||
echo | ||
echo 'Note: export PATH=~/.ellipsis/bin:$PATH to add ellipsis to your $PATH ' | ||
echo | ||
echo ' _ _ _' | ||
echo ' /\_\ /\_\ /\_\' | ||
echo ' \/_/ \/_/ \/_/ …because $HOME is where the <3 is!' | ||
echo |
Oops, something went wrong.