Browse Source

Remove stuff that is obsolete or moved to dottum

Alois Mahdal 7 years ago
parent
commit
3e07a5563c
6 changed files with 4 additions and 516 deletions
  1. 4
    125
      INSTALL.md
  2. 0
    9
      TODO.md
  3. 0
    13
      bin/perlcritic_vim
  4. 0
    6
      external/README.md
  5. 0
    324
      mklinks
  6. 0
    39
      other/git-hooks/pre-commit

+ 4
- 125
INSTALL.md View File

@@ -1,126 +1,5 @@
1
-INSTALLATION
2
-============
1
+INSTALLING
2
+==========
3 3
 
4
-
5
-To install, you need to perform following steps:
6
-
7
-1.  Clone repository to a stable place on your box
8
-
9
-    For now, I'm going to assume it's local/mydots
10
-
11
-2.  Move (and merge if needed) your existing configs to dotfiles folder.
12
-    Remove the dot from name, e.g.:
13
-
14
-        $ mv ~/.gnucash ~/local/mydots/dotfiles/gnucash
15
-
16
-    If your configs live under `~/.config` folder, put them under a folder
17
-    similar to the dotfiles:
18
-
19
-        $ mv ~/.config/dunst ~/local/mydots/dotfiles.config/dunst
20
-
21
-    Note that for bash, vim and git, I recommend different solutions--see
22
-    below.
23
-
24
-3.  Run mklinks script with single argument: path to dotfiles folder (or how
25
-    you named it), e.g.:
26
-
27
-        $ ~/local/mydots/mklinks ~/local/mydots/dotfiles
28
-
29
-    The script will create links back in your `$HOME`, uless they (or real
30
-    files) did already exist, in which case it will only warn you.  This
31
-    makes it easy to exclude some of your applications from some of your
32
-    machines: just skip step 2 for them.
33
-
34
-    Pro tip: Notice how the mklinks script discovers your `.config/`-bound
35
-    files such as dunst.
36
-
37
-     1. The path you pointed to is "path/to/dotfiles", so this will be
38
-        regarded as "base path" of your config pool.
39
-
40
-     2. Any members of the *base* directory will be prefixed with single
41
-        dot and symlinked *directly* to your home--just as the ancient
42
-        tradition dictates.
43
-
44
-     3. If the "base path" has neighbor called the same but with suffix
45
-        `.config`, i.e. `path/to/dotfiles.config`, it will symlink all
46
-        present members to `~/.config` path--just as XDG convention
47
-        uses in its most common version.
48
-
49
-     4. The case is similar for `.local/share` files; here you'll just need
50
-        to go one step deeper: files that should be linked to `~/.local/share`
51
-        should be in `dotfiles.local/share`.
52
-
53
-
54
-Instructions for bash
55
----------------------
56
-
57
-Although similar technique could be used for bash, I prefer to have defaults
58
-specified by distro.  Therefore I use other technique:
59
-
60
-Instead of step 2 above, move/merge your specific ~/.bashrc changes to either
61
-one of these, or preferably, split them as needed:
62
-
63
-    dotfiles/bash/main.bashrc
64
-    dotfiles/bash/user/<your-username>.bashrc
65
-    dotfiles/bash/host/<your-hostname>.bashrc
66
-    dotfiles/bash/post.bashrc
67
-
68
-Then, replace your ~/.bashrc with your default distro's one, commonly found
69
-in /etc/skel/.bashrc, and use `dotfiles/bash/setup` to patch it:
70
-
71
-    $ cp /etc/skel/.bashrc ~/
72
-    $ local/mydots/dotfiles/bash/setup
73
-
74
-From that point on, `.bashrc` will source appropriate fies for you, so do not
75
-make any changes to your local `.bashrc`, unless you really want them to be
76
-local, i.e. private only.
77
-
78
-
79
-Instructions for Vim
80
---------------------
81
-
82
-If you want to keep default vim-ish behavior and have all local config in
83
-~/.vimrc, you can use above generic steps.  However, if you want to have
84
-rather more sophisticated model, and for example use my vim configuration
85
-as a starting point, do this instead of step 2:
86
-
87
-1.  Merge your local ~/.vimrc into dotfiles/vim/vimrc
88
-
89
-2.  Create a symlink to ~/.vim/vimrc:
90
-
91
-        $ cd
92
-        $ ln -s local/mydots/dotfiles/vim/vimrc .vimrc
93
-
94
-You could actually have your .vimrc symlink point right to local/mydots/...
95
-I find this more flexible, though.
96
-
97
-### perlcritic_vim ###
98
-
99
-Additionally, if you want to use perlcritic.vim, you need to:
100
-
101
-*   install Perl::Critic (from CPAN)
102
-
103
-*   put bin/perlcritic\_vim to your PATH
104
-
105
-
106
-Instructions for git
107
---------------------
108
-
109
-**Note**: For most of config I have shared, you will need at least git 1.8.
110
-Without it, things will not work, and you might even end up with broken git!
111
-
112
-However, if you only want to use the sharing/splitting mechanism, 1.7 *should*
113
-be OK.  **No warranties**, though.
114
-
115
-The pricnicple is the same as in bash section above: a new folder is created,
116
-local config is split into parts per user/host or global one, and original
117
-file becomes just a crossroads into these.
118
-
119
-Except that since git does not support expansion in config paths, the file
120
-must be created by a script.  So what you want to do is the same as for bash
121
-above, except that instead of applying patch to your .gitconfig, you simply
122
-delete it and run dotfiles/git/setup.
123
-
124
-If you have a local changes that you don't want to share, you can either put
125
-them into the re-created ~.gitconfig, or (as I prefer) in
126
-dotfiles/git/private/gitconfig
4
+Dotfiles here are managed by my new tool called 'dottum', which is not
5
+released at this point.  Contact me if impatient.

+ 0
- 9
TODO.md View File

@@ -1,9 +0,0 @@
1
-TODO
2
-====
3
-
4
-*   Allow multiple DOTROOTs; merge them (e.g. some from Dropbox, some from
5
-    Github
6
-
7
-*   Do something about parens' highlighting (tin torte.vim)
8
-
9
-*   Add documentation for gittum, particulatly message aliases

+ 0
- 13
bin/perlcritic_vim View File

@@ -1,13 +0,0 @@
1
-#!/usr/bin/perl
2
-
3
-use Perl::Critic;
4
-
5
-my $file = shift;
6
-my $critic = Perl::Critic->new();
7
-my @violations = $critic->critique($file);
8
-
9
-for (@violations) {
10
-    my ($l, $c) = m/.* at line (\d+), column (\d+)\./;
11
-    $_ =~ s/ at line \d+, column \d+\././;
12
-    print "$file:$l:$c:$_";
13
-}

+ 0
- 6
external/README.md View File

@@ -1,6 +0,0 @@
1
-This folder it intended to be ignored by git and to hold symlinks to
2
-paths outside this repo (possibly backed up/synced by other, more
3
-suitable means).
4
-
5
-dotfiles* may then safely contain relative symlinks to this sub-folder
6
-without need to store the--often host-specific path.

+ 0
- 324
mklinks View File

@@ -1,324 +0,0 @@
1
-#!/bin/bash
2
-
3
-warn() {
4
-    echo "$@" >&2
5
-}
6
-
7
-think() {
8
-    $Verbose || return
9
-    warn "$@"
10
-}
11
-
12
-die() {
13
-    warn "$@"
14
-    exit 3
15
-}
16
-
17
-usage() {
18
-    warn "usage: $0 init     VAULT SUBVAULT"
19
-    warn "usage: $0 explore  VAULT SUBVAULT"
20
-    exit 2
21
-}
22
-
23
-debug() {
24
-    $Debug || return
25
-    local msg
26
-    for msg in "$@";
27
-    do
28
-        warn "debug:$msg"
29
-    done
30
-}
31
-
32
-debugv() {
33
-    $Debug || return
34
-    local vn
35
-    local vd
36
-    for vn in "$@";
37
-    do
38
-        if vd=$(declare -p "$vn" 2>/dev/null);
39
-        then
40
-            warn "debug:${vd#declare ?? }"
41
-        else
42
-            warn "debug:$vn #Unset"
43
-        fi
44
-    done
45
-}
46
-
47
-debugc() {
48
-    $Debug || return
49
-    debug "-- cmd begin: $*"
50
-    Debug=false "$@" | sed -e 's/^/debug:/' >&2
51
-    debug "-- cmd end --"
52
-}
53
-
54
-lssv() {
55
-    #
56
-    # List sub-vaults
57
-    #
58
-    # Sub-vault is a sub-path of vault directory that contains items
59
-    # that should be linked separately, to a similar $HOME subpath,
60
-    # rather than linking the whole sub-tree.  This is typical for
61
-    # .config directory specified by XDG standard.
62
-    #
63
-    # For example, imagine vault like this:
64
-    #
65
-    #     dotfiles/
66
-    #     ├── config
67
-    #     │   ├── dunst
68
-    #     │   │   └── dunstrc
69
-    #     │   └── uzbl
70
-    #     │       ├── config
71
-    #     │       └── style.css
72
-    #     ├── i3
73
-    #     │   └── config
74
-    #     ├── i3status.conf
75
-    #     └── vimrc
76
-    #
77
-    # Without sub-vault, the "config" would be linked as "$HOME/.config":
78
-    #
79
-    #     $HOME/.config         -> dotfiles/.config
80
-    #     $HOME/.i3             -> dotfiles/i3
81
-    #     $HOME/.i3status.conf  -> dotfiles/i3status.conf
82
-    #     $HOME/.vimrc          -> dotfiles/vimrc
83
-    #
84
-    # This is impractical in most cases, as normally you want to select
85
-    # applications to link--some dotfiles could be specific to some
86
-    # hosts or even private.
87
-    #
88
-    # Setting 'config' as sub-vault will tell mklinks that you don't
89
-    # want to link this item directly but rather each of its items:
90
-    #
91
-    #     $HOME/.config/dunst   -> dotfiles/config/dunst
92
-    #     $HOME/.config/uzbl    -> dotfiles/config/uzbl
93
-    #     $HOME/.i3             -> dotfiles/i3
94
-    #     $HOME/.i3status.conf  -> dotfiles/i3status.conf
95
-    #     $HOME/.vimrc          -> dotfiles/vimrc
96
-    #
97
-    # This way, you can have other items under "$HOME/.config" that
98
-    # are either purely local or linked to another vault.
99
-    #
100
-    # Note that the subvault can be deeper than one level, i.e.
101
-    # subvault "local/share" also works:
102
-    #
103
-    #     $HOME/.local/share/klavaro -> dotfiles/local/share/klavaro
104
-    #
105
-    local sv
106
-    test -n "${SubVaults[0]}" && {
107
-        think "using sub-vaults from command line"
108
-        for sv in "${SubVaults[@]}";
109
-        do
110
-            echo "$sv"
111
-        done
112
-        return
113
-    }
114
-    test -f "$Vault/dotvault/subvaults" && {
115
-        think "reading subvaults from file: $Vault/dotvault/subvaults"
116
-        grep . "$Vault/dotvault/subvaults" \
117
-          | grep -v "^#.*"
118
-        return
119
-    }
120
-    think "using hard-coded list of subvaults"
121
-    echo config
122
-}
123
-
124
-lsvault() {
125
-    #
126
-    # List all vaults and subvaults, depth-first
127
-    #
128
-    {
129
-        echo "$Vault"
130
-        lssv \
131
-          | while IFS= read -r sv;
132
-            do
133
-                test -e "$Vault/$sv" || {
134
-                    think "ignoring non-existent sub-vault: $sv"
135
-                    continue
136
-                }
137
-                test -d "$Vault/$sv" || {
138
-                    warn "ignoring non-directory sub-vault: $sv"
139
-                    continue
140
-                }
141
-                echo "$Vault/$sv"
142
-            done
143
-    } \
144
-      | LC_ALL=C sort \
145
-      | tac
146
-}
147
-
148
-istarget() {
149
-    #
150
-    # True if item $1 is possible target
151
-    #
152
-    # Item is obviously not a possible target if it's
153
-    # a (sub-)vault.
154
-    #
155
-    # A less obvious case is when item is an intermediate directory
156
-    # on a path leading to a sub-vault.  Such item cannot be a target!
157
-    #
158
-    # For example: there are sub-vaults:
159
-    #
160
-    #     foo
161
-    #     foo/bar/baz
162
-    #
163
-    # and a tree:
164
-    #
165
-    #     foo
166
-    #     ├── A
167
-    #     └── bar
168
-    #         └── baz
169
-    #             └── B
170
-    #
171
-    # Items A and B could both be targets, but baz could not be!
172
-    #
173
-    #TODO: write an explanation
174
-    #
175
-    local item=$1
176
-    debugv item
177
-    Verbose=false lsvault | grep -qxF "$item"   && return 1
178
-    Verbose=false lsvault | grep -qx "$item/.*" && return 1
179
-    return 0
180
-}
181
-
182
-pfxpath() {
183
-    #
184
-    # Prefix paths with $1
185
-    #
186
-    # Just like `sed "s/^/$1/" but works with any characters
187
-    # in $1 excepr newline, which is not allowed in paths..
188
-    #
189
-    local pfx="$1"
190
-    local path
191
-    while IFS= read -r path;
192
-    do
193
-        echo "$pfx$path"
194
-    done
195
-}
196
-
197
-lstarget() {
198
-    #
199
-    # List potential items in vault $1
200
-    #
201
-    local vlt=$1
202
-    debugv vlt
203
-    local item
204
-    find "$vlt" -mindepth 1 -maxdepth 1 -printf "%P\n" \
205
-      | pfxpath "$vlt/" \
206
-      | grep -v "$Vault/dotvault" \
207
-      | while IFS= read -r item;
208
-        do
209
-            istarget "$item" && echo "$item"
210
-        done
211
-}
212
-
213
-make_links() {
214
-    #
215
-    # Create all links
216
-    #
217
-    local slpath
218
-    local target
219
-    local vlt
220
-    lsvault \
221
-      | while IFS= read -r vlt;
222
-        do
223
-            lstarget "$vlt" \
224
-              | while IFS= read -r target;
225
-                do
226
-                    slpath=$(slpath "$target")
227
-                    if test -L "$slpath";
228
-                    then
229
-                        $ClobberLinks || {
230
-                            warn "skipping existing slpath: $slpath"
231
-                            continue
232
-                        }
233
-                        think "removing existing link: $slpath"
234
-                        maybe rm "$slpath"
235
-                    fi
236
-                    test -e "$slpath" && {
237
-                        warn "skipping existing non-link: $slpath"
238
-                        continue
239
-                    }
240
-                    maybe ln -sr "$target" "$slpath"
241
-                done
242
-        done
243
-}
244
-
245
-explore() {
246
-    #
247
-    # Show what would be done
248
-    #
249
-    local vlt
250
-    local tgt
251
-    local tgts
252
-    lsvault \
253
-      | sort \
254
-      | while IFS= read -r vlt;
255
-        do
256
-            tgts=$(lstarget "$vlt")
257
-            test -n "$tgts" || continue
258
-            if test "$vlt" == "$Vault";
259
-            then
260
-                echo "VAULT:$vlt:"
261
-            else
262
-                echo
263
-                echo "SUBVAULT:$vlt"
264
-            fi
265
-            sort <<<"$tgts" \
266
-              | while IFS= read -r tgt;
267
-                do
268
-                    echo "${tgt}:$(slpath "$tgt")"
269
-                done \
270
-              | sed -e "s|:$HOME|:=> ~|" \
271
-              | column -ts: \
272
-              | sed -e "s/^/    /"
273
-        done
274
-}
275
-
276
-maybe() {
277
-    #
278
-    # Maybe do things $@, maybe not (if in debug mode)
279
-    #
280
-    $Debug && { debug "WOULD: $*"; return; }
281
-    "$@"
282
-}
283
-
284
-slpath() {
285
-    #
286
-    # Print path where to create link for target $1
287
-    #
288
-    local item=$1
289
-    echo "$HOME/.${item#$Vault/}"
290
-}
291
-
292
-route() {
293
-    local Vault=$1; shift
294
-    local SubVaults=()
295
-    test -n "$Vault" || usage
296
-    test -e "$Vault" || die "vault does not exist: $Vault"
297
-    test -d "$Vault" || die "vault is not a directory: $Vault"
298
-    SubVaults=("$@")
299
-    case $Action in
300
-        init)       make_links  ;;
301
-        explore)    explore     ;;
302
-        *)          usage       ;;
303
-    esac
304
-}
305
-
306
-export LC_ALL=C
307
-
308
-main() {
309
-    local Action
310
-    local Debug=false
311
-    local Verbose=false
312
-    local ClobberLinks=false
313
-    while true; do case $1 in
314
-        -d) Debug=true;         shift ;;
315
-        -v) Verbose=true;       shift ;;
316
-        -f) ClobberLinks=true;  shift ;;
317
-        -*)                     usage ;;
318
-        *)                      break ;;
319
-    esac done
320
-    Action=$1; shift
321
-    route "$@"
322
-}
323
-
324
-main "$@"

+ 0
- 39
other/git-hooks/pre-commit View File

@@ -1,39 +0,0 @@
1
-#!/usr/bin/env python
2
-from __future__ import with_statement
3
-import os
4
-import re
5
-import shutil
6
-import subprocess
7
-import sys
8
-import tempfile
9
-
10
-
11
-def system(*args, **kwargs):
12
-    kwargs.setdefault('stdout', subprocess.PIPE)
13
-    proc = subprocess.Popen(args, **kwargs)
14
-    out, err = proc.communicate()
15
-    return out
16
-
17
-
18
-def main():
19
-    modified = re.compile('^[AM]+\s+(?P<name>.*\.py)', re.MULTILINE)
20
-    files = system('git', 'status', '--porcelain')
21
-    files = modified.findall(files)
22
-
23
-    tempdir = tempfile.mkdtemp()
24
-    for name in files:
25
-        filename = os.path.join(tempdir, name)
26
-        filepath = os.path.dirname(filename)
27
-        if not os.path.exists(filepath):
28
-            os.makedirs(filepath)
29
-        with file(filename, 'w') as f:
30
-            system('git', 'show', ':' + name, stdout=f)
31
-    output = system('pep8', '.', cwd=tempdir)
32
-    shutil.rmtree(tempdir)
33
-    if output:
34
-        print output,
35
-        sys.exit(1)
36
-
37
-
38
-if __name__ == '__main__':
39
-    main()