zsh_dots 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +25 -0
- data/.gitmodules +3 -0
- data/.rvmrc +47 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +38 -0
- data/README.md +115 -0
- data/Rakefile +9 -0
- data/bin/dots +7 -0
- data/bin/elocal_nightly.sh +12 -0
- data/bin/gbrt +42 -0
- data/bin/git_cwd_info +40 -0
- data/bin/lein +229 -0
- data/bin/reattach-to-user-namespace +0 -0
- data/bin/ssh-copy-id +54 -0
- data/bin/stock +83 -0
- data/config/.dot_file +1 -0
- data/config/aws +0 -0
- data/config/example.aws.zsh +13 -0
- data/config/gemrc +9 -0
- data/config/gitconfig +46 -0
- data/config/railsrc +2 -0
- data/config/rspec +2 -0
- data/config/rvmrc +1 -0
- data/config/screenrc +1 -0
- data/config/tmux.conf +6 -0
- data/config/zlogin +1 -0
- data/config/zshenv +59 -0
- data/config/zshrc +8 -0
- data/etc/mandlebrot.c +59 -0
- data/etc/rails/composer.yml +30 -0
- data/etc/rails/ember_template.rb +60 -0
- data/etc/rails/recipes/haml_views.rb +20 -0
- data/etc/rails/recipes/html5.rb +84 -0
- data/etc/rails/recipes/readme_markdown.rb +87 -0
- data/etc/rails/template.rb +1419 -0
- data/lib/dots/aliases.zsh +40 -0
- data/lib/dots/directories.zsh +28 -0
- data/lib/dots/functions.zsh +41 -0
- data/lib/dots/plugins.zsh +18 -0
- data/lib/dots.sh +11 -0
- data/lib/plugins/aws/aws.plugin.zsh +20 -0
- data/lib/plugins/bundler/_bundler +82 -0
- data/lib/plugins/bundler/bundler.plugin.zsh +7 -0
- data/lib/plugins/git/git.plugin.zsh +126 -0
- data/lib/plugins/git-flow/git-flow.plugin.zsh +340 -0
- data/lib/plugins/knife/_knife +183 -0
- data/lib/plugins/knife/knife.plugin.zsh +1 -0
- data/lib/plugins/macvim/macvim.plugin.zsh +13 -0
- data/lib/plugins/osx/_man-preview +5 -0
- data/lib/plugins/osx/osx.plugin.zsh +101 -0
- data/lib/plugins/rails3/rails3.plugin.zsh +75 -0
- data/lib/plugins/rake/rake.plugin.zsh +6 -0
- data/lib/plugins/ruby/ruby.plugin.zsh +58 -0
- data/lib/ruby/dots/command.rb +58 -0
- data/lib/ruby/dots/dot_file.rb +73 -0
- data/lib/ruby/dots/version.rb +3 -0
- data/lib/ruby/dots.rb +9 -0
- data/lib/tasks/db.rake +55 -0
- data/lib/tasks/dots.rake +32 -0
- data/spec/integration/command_spec.rb +34 -0
- data/spec/models/dot_file_spec.rb +45 -0
- data/spec/spec_helper.rb +6 -0
- data/vendor/antigen.zsh +251 -0
- data/vendor/oh-my-zsh/check_for_upgrade.sh +45 -0
- data/vendor/oh-my-zsh/install.sh +43 -0
- data/vendor/oh-my-zsh/require_tool.sh +161 -0
- data/vendor/oh-my-zsh/uninstall.sh +20 -0
- data/vendor/oh-my-zsh/upgrade.sh +6 -0
- data/zsh_dots.gemspec +28 -0
- metadata +163 -0
data/vendor/antigen.zsh
ADDED
@@ -0,0 +1,251 @@
|
|
1
|
+
#!/bin/zsh
|
2
|
+
#
|
3
|
+
# Antigen is a bundled plugin loader.
|
4
|
+
|
5
|
+
# Each line in this string has the following entries separated by a space
|
6
|
+
# character.
|
7
|
+
# <repo-url>, <plugin-location>, <bundle-type>
|
8
|
+
# FIXME: Is not kept local by zsh!
|
9
|
+
local _ANTIGEN_BUNDLE_RECORD=""
|
10
|
+
|
11
|
+
# Syntaxes
|
12
|
+
# antigen-bundle <url> [<loc>=/]
|
13
|
+
antigen-bundle () {
|
14
|
+
|
15
|
+
# Bundle spec arguments' default values.
|
16
|
+
local url="$ANTIGEN_DEFAULT_REPO_URL"
|
17
|
+
local loc=/
|
18
|
+
local btype=plugin
|
19
|
+
|
20
|
+
# Set spec values based on the positional arguments.
|
21
|
+
local position_args='url loc'
|
22
|
+
local i=1
|
23
|
+
while ! [[ -z $1 || $1 == --*=* ]]; do
|
24
|
+
local arg_name="$(echo "$position_args" | cut -d\ -f$i)"
|
25
|
+
local arg_value="$1"
|
26
|
+
eval "local $arg_name='$arg_value'"
|
27
|
+
shift
|
28
|
+
i=$(($i + 1))
|
29
|
+
done
|
30
|
+
|
31
|
+
# Check if url is just the plugin name. Super short syntax.
|
32
|
+
if [[ "$url" != */* ]]; then
|
33
|
+
loc="plugins/$url"
|
34
|
+
url="$ANTIGEN_DEFAULT_REPO_URL"
|
35
|
+
fi
|
36
|
+
|
37
|
+
# Set spec values from keyword arguments, if any. The remaining arguments
|
38
|
+
# are all assumed to be keyword arguments.
|
39
|
+
while [[ $1 == --*=* ]]; do
|
40
|
+
local arg_name="$(echo "$1" | cut -d= -f1 | sed 's/^--//')"
|
41
|
+
local arg_value="$(echo "$1" | cut -d= -f2)"
|
42
|
+
eval "local $arg_name='$arg_value'"
|
43
|
+
shift
|
44
|
+
done
|
45
|
+
|
46
|
+
# Resolve the url.
|
47
|
+
if [[ $url != git://* && $url != https://* && $url != /* ]]; then
|
48
|
+
url="${url%.git}"
|
49
|
+
url="https://github.com/$url.git"
|
50
|
+
fi
|
51
|
+
|
52
|
+
# Add it to the record.
|
53
|
+
_ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype"
|
54
|
+
|
55
|
+
-antigen-ensure-repo "$url"
|
56
|
+
|
57
|
+
-antigen-load "$url" "$loc" "$btype"
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
antigen-bundles () {
|
62
|
+
# Bulk add many bundles at one go. Empty lines and lines starting with a `#`
|
63
|
+
# are ignored. Everything else is given to `antigen-bundle` as is, no
|
64
|
+
# quoting rules applied.
|
65
|
+
|
66
|
+
local line
|
67
|
+
|
68
|
+
grep -v '^\s*$\|^#' | while read line; do
|
69
|
+
# Using `eval` so that we can use the shell-style quoting in each line
|
70
|
+
# piped to `antigen-bundles`.
|
71
|
+
eval "antigen-bundle $line"
|
72
|
+
done
|
73
|
+
}
|
74
|
+
|
75
|
+
antigen-update () {
|
76
|
+
# Update your bundles, i.e., `git pull` in all the plugin repos.
|
77
|
+
-antigen-echo-record | awk '{print $1}' | sort -u | while read url; do
|
78
|
+
-antigen-ensure-repo --update "$url"
|
79
|
+
done
|
80
|
+
}
|
81
|
+
|
82
|
+
-antigen-get-clone-dir () {
|
83
|
+
# Takes a repo url and gives out the path that this url needs to be cloned
|
84
|
+
# to. Doesn't actually clone anything.
|
85
|
+
# TODO: Memoize?
|
86
|
+
echo -n $ADOTDIR/repos/
|
87
|
+
echo "$1" | sed \
|
88
|
+
-e 's/\.git$//' \
|
89
|
+
-e 's./.-SLASH-.g' \
|
90
|
+
-e 's.:.-COLON-.g'
|
91
|
+
}
|
92
|
+
|
93
|
+
-antigen-get-clone-url () {
|
94
|
+
# Takes a repo's clone dir and gives out the repo's original url that was
|
95
|
+
# used to create the given directory path.
|
96
|
+
# TODO: Memoize?
|
97
|
+
echo "$1" | sed \
|
98
|
+
-e "s:^$ADOTDIR/repos/::" \
|
99
|
+
-e 's/$/.git/' \
|
100
|
+
-e 's.-SLASH-./.g' \
|
101
|
+
-e 's.-COLON-.:.g'
|
102
|
+
}
|
103
|
+
|
104
|
+
-antigen-ensure-repo () {
|
105
|
+
|
106
|
+
local update=false
|
107
|
+
if [[ $1 == --update ]]; then
|
108
|
+
update=true
|
109
|
+
shift
|
110
|
+
fi
|
111
|
+
|
112
|
+
local url="$1"
|
113
|
+
local clone_dir="$(-antigen-get-clone-dir $url)"
|
114
|
+
|
115
|
+
if [[ ! -d $clone_dir ]]; then
|
116
|
+
git clone "$url" "$clone_dir"
|
117
|
+
elif $update; then
|
118
|
+
git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" pull
|
119
|
+
fi
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
-antigen-load () {
|
124
|
+
|
125
|
+
local url="$1"
|
126
|
+
local location="$(-antigen-get-clone-dir "$url")/$2"
|
127
|
+
local btype="$3"
|
128
|
+
|
129
|
+
if [[ $btype == theme ]]; then
|
130
|
+
|
131
|
+
# Of course, if its a theme, the location would point to the script
|
132
|
+
# file.
|
133
|
+
source "$location"
|
134
|
+
|
135
|
+
else
|
136
|
+
|
137
|
+
# Source the plugin script
|
138
|
+
# FIXME: I don't know. Looks very very ugly. Needs a better
|
139
|
+
# implementation once tests are ready.
|
140
|
+
local script_loc="$(ls "$location" | grep -m1 '.plugin.zsh$')"
|
141
|
+
if [[ -f $script_loc ]]; then
|
142
|
+
# If we have a `*.plugin.zsh`, source it.
|
143
|
+
source "$script_loc"
|
144
|
+
elif [[ ! -z "$(ls "$location" | grep -m1 '.zsh$')" ]]; then
|
145
|
+
# If there is no `*.plugin.zsh` file, source *all* the `*.zsh`
|
146
|
+
# files.
|
147
|
+
for script ($location/*.zsh) source "$script"
|
148
|
+
elif [[ ! -z "$(ls "$location" | grep -m1 '.sh$')" ]]; then
|
149
|
+
# If there are no `*.zsh` files either, we look for and source any
|
150
|
+
# `*.sh` files instead.
|
151
|
+
for script ($location/*.sh) source "$script"
|
152
|
+
fi
|
153
|
+
|
154
|
+
# Add to $fpath, for completion(s)
|
155
|
+
fpath=($location $fpath)
|
156
|
+
|
157
|
+
fi
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
antigen-cleanup () {
|
162
|
+
|
163
|
+
if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then
|
164
|
+
echo "You don't have any bundles."
|
165
|
+
return 0
|
166
|
+
fi
|
167
|
+
|
168
|
+
# Find directores in ADOTDIR/repos, that are not in the bundles record.
|
169
|
+
local unused_clones="$(comm -13 \
|
170
|
+
<(-antigen-echo-record | awk '{print $1}' | sort -u) \
|
171
|
+
<(ls "$ADOTDIR/repos" | while read line; do
|
172
|
+
-antigen-get-clone-url "$line"
|
173
|
+
done))"
|
174
|
+
|
175
|
+
if [[ -z $unused_clones ]]; then
|
176
|
+
echo "You don't have any unidentified bundles."
|
177
|
+
return 0
|
178
|
+
fi
|
179
|
+
|
180
|
+
echo 'You have clones for the following repos, but are not used.'
|
181
|
+
echo "$unused_clones" | sed 's/^/ /'
|
182
|
+
|
183
|
+
echo -n '\nDelete them all? [y/N] '
|
184
|
+
if read -q; then
|
185
|
+
echo
|
186
|
+
echo
|
187
|
+
echo "$unused_clones" | while read url; do
|
188
|
+
echo -n "Deleting clone for $url..."
|
189
|
+
rm -rf "$(-antigen-get-clone-dir $url)"
|
190
|
+
echo ' done.'
|
191
|
+
done
|
192
|
+
else
|
193
|
+
echo
|
194
|
+
echo Nothing deleted.
|
195
|
+
fi
|
196
|
+
}
|
197
|
+
|
198
|
+
antigen-lib () {
|
199
|
+
antigen-bundle --loc=lib
|
200
|
+
}
|
201
|
+
|
202
|
+
antigen-theme () {
|
203
|
+
local name="${1:-robbyrussell}"
|
204
|
+
antigen-bundle --loc=themes/$name.zsh-theme --btype=theme
|
205
|
+
}
|
206
|
+
|
207
|
+
antigen-apply () {
|
208
|
+
# Initialize completion.
|
209
|
+
# TODO: Only load completions if there are any changes to the bundle
|
210
|
+
# repositories.
|
211
|
+
compinit -i
|
212
|
+
}
|
213
|
+
|
214
|
+
antigen-list () {
|
215
|
+
# List all currently installed bundles
|
216
|
+
if [[ -z "$_ANTIGEN_BUNDLE_RECORD" ]]; then
|
217
|
+
echo "You don't have any bundles." >&2
|
218
|
+
return 1
|
219
|
+
else
|
220
|
+
-antigen-echo-record
|
221
|
+
fi
|
222
|
+
}
|
223
|
+
|
224
|
+
# Echo the bundle specs as in the record. The first line is not echoed since it
|
225
|
+
# is a blank line.
|
226
|
+
-antigen-echo-record () {
|
227
|
+
echo "$_ANTIGEN_BUNDLE_RECORD" | sed -n '1!p'
|
228
|
+
}
|
229
|
+
|
230
|
+
-antigen-env-setup () {
|
231
|
+
# Pre-startup initializations
|
232
|
+
-set-default ANTIGEN_DEFAULT_REPO_URL \
|
233
|
+
https://github.com/robbyrussell/oh-my-zsh.git
|
234
|
+
-set-default ADOTDIR $HOME/.antigen
|
235
|
+
|
236
|
+
# Load the compinit module
|
237
|
+
autoload -U compinit
|
238
|
+
|
239
|
+
# Without the following, `compdef` function is not defined.
|
240
|
+
compinit -i
|
241
|
+
}
|
242
|
+
|
243
|
+
# Same as `export $1=$2`, but will only happen if the name specified by `$1` is
|
244
|
+
# not already set.
|
245
|
+
-set-default () {
|
246
|
+
local arg_name="$1"
|
247
|
+
local arg_value="$2"
|
248
|
+
eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'"
|
249
|
+
}
|
250
|
+
|
251
|
+
-antigen-env-setup
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
function _current_epoch() {
|
4
|
+
echo $(($(date +%s) / 60 / 60 / 24))
|
5
|
+
}
|
6
|
+
|
7
|
+
function _update_zsh_update() {
|
8
|
+
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
9
|
+
}
|
10
|
+
|
11
|
+
function _upgrade_zsh() {
|
12
|
+
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
13
|
+
# update the zsh file
|
14
|
+
_update_zsh_update
|
15
|
+
}
|
16
|
+
|
17
|
+
if [ -f ~/.zsh-update ]
|
18
|
+
then
|
19
|
+
. ~/.zsh-update
|
20
|
+
|
21
|
+
if [[ -z "$LAST_EPOCH" ]]; then
|
22
|
+
_update_zsh_update && return 0;
|
23
|
+
fi
|
24
|
+
|
25
|
+
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
26
|
+
if [ $epoch_diff -gt 6 ]
|
27
|
+
then
|
28
|
+
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
|
29
|
+
then
|
30
|
+
_upgrade_zsh
|
31
|
+
else
|
32
|
+
echo "Would you like to check for updates to DOTS?"
|
33
|
+
echo "Type Y to update ~/.dots: \c"
|
34
|
+
read line
|
35
|
+
if [ "$line" = Y ] || [ "$line" = y ]
|
36
|
+
then
|
37
|
+
_upgrade_zsh
|
38
|
+
fi
|
39
|
+
fi
|
40
|
+
fi
|
41
|
+
else
|
42
|
+
# create the zsh file
|
43
|
+
_update_zsh_update
|
44
|
+
fi
|
45
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# DOTS Installer
|
3
|
+
#
|
4
|
+
|
5
|
+
if [ -d ~/.dots ]
|
6
|
+
then
|
7
|
+
echo "Error: You already have DOTS installed."
|
8
|
+
cd ~/.dots
|
9
|
+
exit
|
10
|
+
fi
|
11
|
+
|
12
|
+
echo "\033[0;34mInstalling DOTS...\033[0m"
|
13
|
+
/usr/bin/env git clone https://github.com/tubbo/dots.git ~/.dots
|
14
|
+
|
15
|
+
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
16
|
+
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
17
|
+
then
|
18
|
+
echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-dots\033[0m";
|
19
|
+
cp ~/.zshrc ~/.zshrc.pre-dots;
|
20
|
+
cp ~/.zshrc ~/.dots/config/zshrc;
|
21
|
+
rm ~/.zshrc;
|
22
|
+
else
|
23
|
+
echo "\033[0;34mCreating a template ZSH config from our example...\033[0m"
|
24
|
+
cp ~/.dots/templates/zshrc.zsh-template ~/.zshrc
|
25
|
+
fi
|
26
|
+
|
27
|
+
echo "\033[0;34m Linking ZSH config...\033[0m"
|
28
|
+
ln -s ~/.dots/config/zshrc ~/.zshrc;
|
29
|
+
|
30
|
+
echo "\033[0;34m Synchronizing your custom binaries...\033[0m"
|
31
|
+
cp -R $HOME/bin/** $DOTS/bin
|
32
|
+
mv $HOME/bin $HOME/bin-pre-dots
|
33
|
+
ln -s $HOME/bin $DOTS/bin
|
34
|
+
|
35
|
+
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
|
36
|
+
echo "export PATH=$PATH" >> ~/.zshrc
|
37
|
+
|
38
|
+
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
|
39
|
+
chsh -s `which zsh`
|
40
|
+
|
41
|
+
echo "\n\n \033[0;32mCongratulations! We like yo DOTS!\033[0m"
|
42
|
+
/usr/bin/env zsh
|
43
|
+
source ~/.zshrc
|
@@ -0,0 +1,161 @@
|
|
1
|
+
__require_tool_version_compare ()
|
2
|
+
{
|
3
|
+
(
|
4
|
+
# Locally ignore failures, otherwise we'll exit whenever $1 and $2
|
5
|
+
# are not equal!
|
6
|
+
set +e
|
7
|
+
|
8
|
+
awk_strverscmp='
|
9
|
+
# Use only awk features that work with 7th edition Unix awk (1978).
|
10
|
+
# My, what an old awk you have, Mr. Solaris!
|
11
|
+
END {
|
12
|
+
while (length(v1) || length(v2)) {
|
13
|
+
# Set d1 to be the next thing to compare from v1, and likewise for d2.
|
14
|
+
# Normally this is a single character, but if v1 and v2 contain digits,
|
15
|
+
# compare them as integers and fractions as strverscmp does.
|
16
|
+
if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
|
17
|
+
# Split v1 and v2 into their leading digit string components d1 and d2,
|
18
|
+
# and advance v1 and v2 past the leading digit strings.
|
19
|
+
for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
|
20
|
+
for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
|
21
|
+
d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
|
22
|
+
d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
|
23
|
+
if (d1 ~ /^0/) {
|
24
|
+
if (d2 ~ /^0/) {
|
25
|
+
# Compare two fractions.
|
26
|
+
while (d1 ~ /^0/ && d2 ~ /^0/) {
|
27
|
+
d1 = substr(d1, 2); len1--
|
28
|
+
d2 = substr(d2, 2); len2--
|
29
|
+
}
|
30
|
+
if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
|
31
|
+
# The two components differ in length, and the common prefix
|
32
|
+
# contains only leading zeros. Consider the longer to be less.
|
33
|
+
d1 = -len1
|
34
|
+
d2 = -len2
|
35
|
+
} else {
|
36
|
+
# Otherwise, compare as strings.
|
37
|
+
d1 = "x" d1
|
38
|
+
d2 = "x" d2
|
39
|
+
}
|
40
|
+
} else {
|
41
|
+
# A fraction is less than an integer.
|
42
|
+
exit 1
|
43
|
+
}
|
44
|
+
} else {
|
45
|
+
if (d2 ~ /^0/) {
|
46
|
+
# An integer is greater than a fraction.
|
47
|
+
exit 2
|
48
|
+
} else {
|
49
|
+
# Compare two integers.
|
50
|
+
d1 += 0
|
51
|
+
d2 += 0
|
52
|
+
}
|
53
|
+
}
|
54
|
+
} else {
|
55
|
+
# The normal case, without worrying about digits.
|
56
|
+
if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
|
57
|
+
if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
|
58
|
+
}
|
59
|
+
if (d1 < d2) exit 1
|
60
|
+
if (d1 > d2) exit 2
|
61
|
+
}
|
62
|
+
}
|
63
|
+
'
|
64
|
+
awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null
|
65
|
+
case $? in
|
66
|
+
1) echo '<';;
|
67
|
+
0) echo '=';;
|
68
|
+
2) echo '>';;
|
69
|
+
esac
|
70
|
+
)
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
__require_tool_fatal ()
|
75
|
+
{
|
76
|
+
echo $@ >/dev/stderr
|
77
|
+
return 1
|
78
|
+
}
|
79
|
+
|
80
|
+
# Usage: require_tool program version
|
81
|
+
# Returns: 0 if $1 version if greater equals than $2, 1 otherwise.
|
82
|
+
# In case of error, message is written on error output.
|
83
|
+
#
|
84
|
+
# Example: require_tool gcc 4.6
|
85
|
+
# Use GCC environment variable if defined instead of lookup for the tool
|
86
|
+
# in the environment.
|
87
|
+
require_tool ()
|
88
|
+
{
|
89
|
+
envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]')
|
90
|
+
tool=$(printenv $envvar_name || echo $1)
|
91
|
+
local version=$($tool --version 2>/dev/null| \
|
92
|
+
sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q')
|
93
|
+
if test x"$version" = x ; then
|
94
|
+
echo "$tool is required" >/dev/stderr
|
95
|
+
return 1
|
96
|
+
fi
|
97
|
+
case $(__require_tool_version_compare "$2" "$version") in
|
98
|
+
'>')
|
99
|
+
echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr
|
100
|
+
return 1
|
101
|
+
;;
|
102
|
+
esac
|
103
|
+
}
|
104
|
+
|
105
|
+
usage() {
|
106
|
+
cat <<EOF
|
107
|
+
NAME
|
108
|
+
require_tool.sh - Ensure version of a tool is greater than the one expected
|
109
|
+
|
110
|
+
SYNOPSYS
|
111
|
+
require_tool.sh [ -h ]
|
112
|
+
[ --help ]
|
113
|
+
[ TOOL MIN_VERSION ]
|
114
|
+
|
115
|
+
DESCRIPTION
|
116
|
+
TOOL is the name or path of the program to check. If the name is specified, its
|
117
|
+
path is deduced from PATH environment variable. If environment variable TOOL
|
118
|
+
(in upper-case characters) is defined, considers its value as path to the tool.
|
119
|
+
|
120
|
+
MIN_VERSION is a string representing the minimum required version.
|
121
|
+
|
122
|
+
BEHAVIOR
|
123
|
+
* locate path to the program.
|
124
|
+
* execute $ TOOL_PATH --version
|
125
|
+
* extract version from standard output.
|
126
|
+
* compare this version to the expected one.
|
127
|
+
|
128
|
+
OPTIONS
|
129
|
+
-h --help
|
130
|
+
Display this message and exit 0
|
131
|
+
|
132
|
+
ERRORS
|
133
|
+
if program is not found or its version is prior to expected version,
|
134
|
+
a message is written to error output.
|
135
|
+
|
136
|
+
EXIT VALUE
|
137
|
+
returns 0 if program version if greater equals than expected version,
|
138
|
+
returns 1 otherwise.
|
139
|
+
|
140
|
+
EXAMPLE
|
141
|
+
$ require_tool.sh emacs 23
|
142
|
+
$ CC=g++ require_tool.sh cc 4.6
|
143
|
+
$ require_tool.sh zsh 4.5
|
144
|
+
|
145
|
+
EOF
|
146
|
+
}
|
147
|
+
|
148
|
+
for arg in $@; do
|
149
|
+
case $arg in
|
150
|
+
-h|--help)
|
151
|
+
usage
|
152
|
+
exit 0
|
153
|
+
;;
|
154
|
+
esac
|
155
|
+
done
|
156
|
+
if [ $# -gt 2 ] ; then
|
157
|
+
echo "ERROR: expecting 2 parameters. Please see option --help"
|
158
|
+
exit 1
|
159
|
+
fi
|
160
|
+
|
161
|
+
require_tool $@
|
@@ -0,0 +1,20 @@
|
|
1
|
+
echo "Removing ~/.dots"
|
2
|
+
if [[ -d ~/.dots ]]
|
3
|
+
then
|
4
|
+
rm -rf ~/.dots
|
5
|
+
fi
|
6
|
+
|
7
|
+
echo "Looking for an existing zsh config..."
|
8
|
+
if [ -f ~/.zshrc.pre-dots ] || [ -h ~/.zshrc.pre-dots ]
|
9
|
+
then
|
10
|
+
echo "Restored ~/.zshrc from ~/.zshrc.pre-dots";
|
11
|
+
rm ~/.zshrc;
|
12
|
+
cp ~/.zshrc.pre-dots ~/.zshrc;
|
13
|
+
source ~/.zshrc;
|
14
|
+
else
|
15
|
+
echo "Switching back to bash"
|
16
|
+
chsh -s /bin/bash
|
17
|
+
source /etc/profile
|
18
|
+
fi
|
19
|
+
|
20
|
+
echo "Thanks for using DOTS, it's been uninstalled."
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Upgrade DOTS from GitHub
|
2
|
+
current_path=`pwd`
|
3
|
+
printf '\033[0;34m%s\033[0m\n' "Upgrading DOTS from upstream..."
|
4
|
+
( cd $ZSH && git pull origin master )
|
5
|
+
printf '\033[0;34m%s\033[0m\n' 'Your DOTS have been upgraded to the newest version! https://github.com/tubbo/dots for more information.'
|
6
|
+
cd "$current_path"
|
data/zsh_dots.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/ruby/dots/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Tom Scott"]
|
6
|
+
gem.email = ["tubbo@psychedeli.ca"]
|
7
|
+
gem.description = %q{DOTS is an advanced ZSH framework.}
|
8
|
+
gem.summary = <<-TEXT
|
9
|
+
DOTS is an advanced ZSH framework. It abstracts a lot of hard-to-remember commands away from you
|
10
|
+
and leaves you with fully-documented, easy-to-remember, plain-english aliases for common tasks.
|
11
|
+
Supporting the Antigen framework for plugins, it's meant to be easy to install and light-weight in
|
12
|
+
code, but able to support and replicate an entire home directory worth of dotfiles, essentially
|
13
|
+
enabling you to take your shell environment "on the road" in a Github repository.
|
14
|
+
TEXT
|
15
|
+
gem.homepage = "http://tubbo.github.com/dots"
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split($\)
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(spec)/})
|
20
|
+
gem.name = "zsh_dots"
|
21
|
+
gem.require_paths = ["lib/ruby"]
|
22
|
+
gem.version = Dots::VERSION
|
23
|
+
|
24
|
+
gem.add_runtime_dependency 'thor'
|
25
|
+
gem.add_runtime_dependency 'activemodel'
|
26
|
+
|
27
|
+
gem.add_development_dependency 'rake'
|
28
|
+
end
|