Skip to content

Commit 710ab96

Browse files
author
Ryan King
committed
Use new ... stuff.
1 parent 622e455 commit 710ab96

File tree

5 files changed

+151
-69
lines changed

5 files changed

+151
-69
lines changed

.bashrc

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
source ~/.../lib/common.sh
1+
source $DOTDOTDOT_ROOT/lib/basics
22

3+
# Common with zsh:
4+
...sourcedircontents ~/.sh
5+
6+
...sourcedircontents ~/.bash
7+
8+
# Get ~/.../src/your-dots/.bashrc, etc.
9+
...quieteach ...sourceif .bashrc
10+
11+
# Backwards compatibility:
312
sourceif ~/.bashrc../common
413
sourceif ~/.bashrc../local
514
sourceif ~/.bashrc../$USER
6-
sourceif ~/.bashrc../$LOCAL
15+
[ -n "$LOCAL" ] && sourceif ~/.bashrc../$LOCAL

.vimrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
" Loop over every ~/.../src/* repo and source their .vimrc
12
for dotdir in split(expand("$DOTDOTDOT_ORDER"), ' ')
23
if -1 == match(dotdir, "boot-dots")
34
let s:vimrc = dotdir.'/.vimrc'

.zshrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
source ~/.../lib/common.sh
1+
# See notes in .zshenv for the full sequence
2+
source $DOTDOTDOT_ROOT/lib/scripting
3+
...sourcedircontents ~/.sh
4+
...quieteach ...sourceif .zshrc
5+
...sourcedircontents ~/.zsh/rc

README

-66
This file was deleted.

README.md

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
boot-dots
2+
=========
3+
4+
A looping set of scripts to allow many
5+
[...](http://github.com/ingydotnet/....git) repos to play along nicely.
6+
7+
This should go high up in the `~/.../conf`, so that its dot-files take
8+
precedence over the other repos (but, don't worry - the others will still get
9+
sourced. In fact, that's the whole point of boot-dots!)
10+
11+
By convention, repos that are designed to be used after boot-dots are all
12+
named `*-dots`.
13+
14+
\[Note: Throughout this document, we refer to the files as being in `~/.../`,
15+
but actually it's configurable, becoming `$DOTDOTDOT_ROOT`.\]
16+
17+
Use
18+
---
19+
20+
The easiest way to understand how to make your own setup is to mimic
21+
http://github.com/ouicode/rkingy-dots-conf
22+
23+
Note that the system is still in flux, and we already have plans on how to
24+
make it better. Still, if you copy what is done there, it should continue to
25+
work as we revise our process.
26+
27+
Tools
28+
-----
29+
30+
There are some [...](http://github.com/ingydotnet/....git) tools that help
31+
with both scripting and interactive shelling. They are all named
32+
`...<something>`, so you can tab-complete to see what is available.
33+
34+
These tools are, from the vantage point of `...`, all "opt-in" - unless you
35+
source `~/.../lib/___`, they stay out of your way. But, when you're using
36+
boot-dots, you're definitely opted-in (that is, both `.bashrc` and `.zshenv`
37+
source `~/.../lib/basics`).
38+
39+
Let's look at a few of the functions:
40+
41+
* `...src` (a.k.a., `...repos`) - cd to the `~/.../src` directory for working
42+
with the `*-dots` repos. You can give it an arg that is the name of the
43+
repo (and you can even omit the `-dots` part.)
44+
* `...each` - `cd` to each repo then eval the given string. It's functional
45+
programming for dotfiles! Can I get a w00t-w00t?
46+
* Tracing - There are several handy functions that echo either invariably or
47+
only when `...traceon` has been called. Especially useful are `...traceq`
48+
and `...tracex` (louder than `...traceq`) in debugging init processes. The
49+
rest are in `~/.../lib/tracefuncs`)
50+
* `...source` - Same as the `source` builtin but with trace-awareness.
51+
* `...sourceif` - Calls `...source`, but only if the file exists. Beware that
52+
this can quietly skip over missing parts, so you might have to `...trace*`
53+
to figure out what's going on, sometimes.
54+
* `...sourcedircontents` - Source all files in the given dir.
55+
* `$PATH` manipulators - `..path-prepend`, `...path-append`, `...path-remove`,
56+
and `...path-list`
57+
58+
Also, since `~/.../lib/basics` ends up making these vars available:
59+
* `$DOTDOTDOT_ROOT` - usually is `~/...`
60+
* `$DOTDOTDOT_ORDER` - a list of the repos in accordance with `.../conf`
61+
sequence. Remember that, since the lower files in the list are sourced
62+
later, their specific parts can override the previous files.
63+
* `$SHELLNAME` - The shortname of a shell, so `zsh` or `bash`. Traditionally
64+
you have to check `$BASH_VERSION` or `$ZSH_VERSION` in your scripts, but
65+
this gives you a handier token.
66+
67+
Zsh Sequence
68+
------------
69+
70+
In zsh, the init sequence is kind of interesting. For the full story try:
71+
xterm -e 'man zsh | less -p STARTUP/SHUTDOWN'
72+
(And also: the [Zsh Startup Files
73+
Intro](http://zsh.sourceforge.net/Intro/intro_3.html).)
74+
75+
Here is a cheat-sheet:
76+
77+
zsh -l zsh -i zsh -c zsh -f
78+
(login shell) (interactive shell) (scripting) (no-rcs)
79+
↓ ↓ ↓
80+
.zshenv .zshenv .zshenv
81+
↓ ↓
82+
.zprofile .zshrc
83+
84+
.zshrc
85+
86+
.zlogin
87+
88+
Now, boot-dots makes this system even more "interesting" by checking for the
89+
above files in all -dots repos, plus adding the ~/.zsh dir to facilitate
90+
organization (and nice, atomic names).
91+
92+
The following dirs correspond to the above files:
93+
~/.zsh/env/
94+
~/.zsh/rc/
95+
~/.zsh/profile/
96+
~/.zsh/login/
97+
98+
So you can create my-dots/.zsh/rc/my-aptly-named-thing and trust that it gets
99+
sourced as part of boot-dots/.zshrc. If you need something to happen early or
100+
late relative to the others, you can always prefix with `00-___` or `zzz-___`.
101+
102+
Additionally, there is a .sh/ dir that is similar to .zsh/rc, but is for
103+
things that would work in both bash and zsh (which is most things, so it's
104+
good to try for that).
105+
106+
`...` itself comes with some tracing tools to sourt this out, a bit. Look in
107+
~/.../lib/tracefuncs (which is avilable by default if you are using the
108+
boot-dots repo) for the `...trace` function.
109+
110+
Bash Sequence
111+
-------------
112+
113+
rking doesn't really care about Bash, so he hasn't set this up in its
114+
entirety.
115+
116+
Pair Up
117+
-------
118+
119+
Once you get on board with `boot-dots`, you can much more easily work with
120+
other programmers' favorite configs. This is the main reason behind this
121+
system, in fact.
122+
123+
The goal is to make it so you can toss in a buddy's dotfiles repo into your
124+
list, then run `... install -s` and (hopefully) away you go!
125+
126+
To pop his stuff back out, run `... remove`, take his entry out, then do `...
127+
install -s` again. ¡Muy caliente!
128+
129+
PairUp!™
130+
--------
131+
132+
Then, the next level is spinning up VMs using your config.
133+
134+
Check out: http://github.com/PairUp/pairup#readme

0 commit comments

Comments
 (0)