Skip to content

Commit 42916cf

Browse files
committed
Revise bur's tables
Also tidy up modulist and git-cull while we're at it.
1 parent 31fcadc commit 42916cf

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This is a small set of tools that scratch various personal itches. You
44
may or may not find any of them remotely useful.
55

6-
76
(See also the excellent [moreutils][].)
87

98
[moreutils]: https://joeyh.name/code/moreutils/

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bin_dir = File.expand_path "~/bin"
22
directory bin_dir
33

4-
files = %w[ alert bur dl jj loo modulist nn path spine ]
4+
files = %w[ alert bur dl jj loo modulist nn path psrender spine ]
55
files.concat Dir.glob("brew-*")
66
files.concat Dir.glob("git-*")
77

bur

+19-3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ body {
4949
}
5050
5151
table {
52-
horizontal-align: center
52+
horizontal-align: center;
53+
border-collapse: collapse;
54+
empty-cells: hide;
5355
}
5456
55-
td {
56-
padding: 0.2em;
57+
tr {
58+
padding: 10em;
5759
}
5860
5961
tr.title {
@@ -62,6 +64,16 @@ tr.title {
6264
/* column-span: 2; */
6365
}
6466
67+
tr.alt {
68+
background-color: #e6f3ff;
69+
}
70+
71+
/* tr:nth-child(even){background-color: #f2f2f2} */
72+
73+
td {
74+
padding: 0.5em;
75+
}
76+
6577
td.name {
6678
text-align: right;
6779
}
@@ -161,6 +173,8 @@ def monolith_table(groups, metadata)
161173
t.align = 'center'
162174
end
163175

176+
even = false
177+
164178
groups.each do |group_name, members|
165179
title = Table::Row.new do |r|
166180
r.content = ['', '', group_name]
@@ -177,6 +191,8 @@ def monolith_table(groups, metadata)
177191
metadata[formula]['desc']
178192
)
179193
r.first.class_ = 'name'
194+
r.class_ = 'alt' if even
195+
even = !even
180196
end
181197
table.push content
182198
end

git-cull

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ else
2020
end
2121
end
2222

23+
# Switch back to the starting point, unless it was one of the ones culled.
2324
%x(git checkout -q #{sp}) unless cullees.include?(sp)

modulist

+12-3
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,31 @@ class Stash
2626
FileUtils.mkdir_p(@stash_path)
2727
end
2828

29+
# Return the tail end of a basename. This is separate from full_path because
30+
# we also use the tail end as part of a glob for the `purge` step below.
2931

3032
def name_tail(type)
3133
hostname = %x(hostname -s).chomp
3234

33-
"#{[hostname, type].join('_')}.txt"
35+
[hostname, type].join('_') + '.txt'
3436
end
3537

38+
# Given the name of a type, return an absolute path, in the dedicated
39+
# directory, to a file whose name incorporates the date, base hostname, and
40+
# type.
3641

3742
def full_path(type)
3843
date = Date.today.to_s
3944

40-
base = [date, name_tail(type)].join('_')
45+
basename = [date, name_tail(type)].join('_')
4146

42-
File.join(@stash_path, base)
47+
File.join(@stash_path, basename)
4348
end
4449

4550

51+
# Given the name of a type (e.g. "brew", "gem"), write a list of currently-
52+
# installed instances to a file.
53+
4654
def store(type)
4755
latest = full_path(type)
4856

@@ -62,6 +70,7 @@ class Stash
6270
end
6371
end
6472

73+
# Clean up by deleting all but the most recent stash for this host and type.
6574

6675
def purge(type)
6776
fileset = Dir.glob(File.join(@stash_path, "*#{name_tail(type)}")).sort

0 commit comments

Comments
 (0)