Skip to content

Commit 73ef234

Browse files
committed
Tidy up repo and build script
1 parent e922dde commit 73ef234

21 files changed

+129
-21
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Keep the generated binary out of the repo
22
/alfssh
33
/build
4-
# And the file for generating data
5-
/demo-data.py
4+
/dist
5+
66

77
# Created by https://www.gitignore.io/api/vim,go
88

build-workflow.zsh renamed to bin/build-workflow.zsh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env zsh
22

3-
wffiles=(alfssh icon.png update.png info.plist README.md LICENCE.txt)
3+
wffiles=(alfssh info.plist README.md LICENCE.txt)
44
# Icons
5-
icons=(icons/icon.iconset icons/update.iconset)
5+
icons=(icon.png update.png)
6+
wffiles+=($icons)
67

7-
here="$( cd "$( dirname "$0" )"; pwd )"
8+
workdir="$( cd "$( dirname "$0" )"/../; pwd )"
89
delbuild=1
910

1011
log() {
@@ -25,7 +26,7 @@ Usage:
2526
build-workflow.zsh -h
2627
2728
Options:
28-
-c Clean the build directory
29+
-c Clean the dist directory
2930
-d Also build distributable .alfredworkflow file
3031
-h Show this help message and exit
3132
EOS
@@ -52,12 +53,12 @@ done
5253
shift $((OPTIND-1))
5354

5455
cleanup() {
55-
local p="${here}/build"
56+
local p="${workdir}/dist"
5657
log "Cleaning up ..."
57-
test -d "$p" && rm -rf ./build/
58+
test -d "$p" && rm -rf ./dist/
5859
}
5960

60-
pushd "$here" &> /dev/null
61+
pushd "$workdir" &>/dev/null
6162

6263
log "Building executable(s) ..."
6364
go build -v -o ./alfssh ./cmd/alfssh
@@ -74,22 +75,22 @@ chmod 755 ./alfssh
7475

7576
log
7677

77-
log "Cleaning ./build ..."
78-
rm -rvf ./build
78+
log "Cleaning ./dist ..."
79+
rm -rvf ./dist
7980

8081
log
8182

82-
log "Copying assets to ./build ..."
83+
log "Copying icons to root ..."
8384

8485
for f in $icons; do
8586
n="${f:t:r}"
86-
cp -v "${f}/icon_128x128.png" "./${n}.png"
87+
cp -v "icons/${f}" "./${n}.png"
8788
done
8889

89-
mkdir -vp ./build
90+
mkdir -vp ./dist
9091

9192
for n in $wffiles; do
92-
cp -v "$n" ./build/
93+
cp -v "$n" ./dist/
9394
done
9495

9596

@@ -112,7 +113,7 @@ if [[ $do_dist -eq 1 ]]; then
112113
log
113114
fi
114115

115-
pushd ./build/ &> /dev/null
116+
pushd ./dist/ &>/dev/null
116117

117118
log "Cleaning info.plist ..."
118119
/usr/libexec/PlistBuddy -c 'Delete :variables:DEMO_MODE' info.plist
@@ -127,7 +128,7 @@ if [[ $do_dist -eq 1 ]]; then
127128
popd &> /dev/null
128129
exit $ST_ZIP
129130
fi
130-
popd &> /dev/null
131+
popd &>/dev/null
131132

132133
log
133134
log "Wrote '${zipfile}' in '$( pwd )'"
@@ -136,4 +137,4 @@ fi
136137
[[ $do_clean -eq 1 ]] && cleanup
137138

138139

139-
popd &> /dev/null
140+
popd &>/dev/null

bin/demo-data.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
#
4+
# Copyright (c) 2016 Dean Jackson <deanishe@deanishe.net>
5+
#
6+
# MIT Licence. See http://opensource.org/licenses/MIT
7+
#
8+
# Created on 2016-05-26
9+
#
10+
11+
"""Generate some random host."""
12+
13+
from __future__ import print_function, unicode_literals, absolute_import
14+
15+
from random import choice, randint, shuffle
16+
17+
COUNT = 30
18+
19+
domains = """\
20+
bartell.com
21+
fay-king.com
22+
gierschner.org
23+
johann.com
24+
junitz.com
25+
kassulke-spencer.com
26+
kessler.com
27+
kostolzin.de
28+
kuhlman-wolf.info
29+
kulas-douglas.biz
30+
larson-schumm.info
31+
lind-sipes.com
32+
lockman.com
33+
losekann.com
34+
maelzer.org
35+
mayer.biz
36+
reinger.info
37+
roemer.com
38+
scholz.net
39+
sipes.com
40+
trapp.com
41+
wesack.com
42+
zorbach.com
43+
""".strip().split('\n')
44+
45+
subdomains = """\
46+
mail
47+
www
48+
vpn
49+
ftp
50+
gateway
51+
""".strip().split('\n')
52+
53+
servers = """\
54+
antonetta
55+
balduin
56+
elias
57+
ermanno
58+
ethelyn
59+
fechner
60+
froehlich
61+
gene
62+
heinz
63+
heser
64+
holsten
65+
hornich
66+
iliana
67+
kadeem
68+
kurt
69+
leslee
70+
meyer
71+
moesha
72+
monja
73+
reiner
74+
roland
75+
russel
76+
rust
77+
sandy
78+
teobaldo
79+
valerius
80+
wulff
81+
zaida
82+
""".strip().split('\n')
83+
84+
85+
def domain(host):
86+
"""Return domain of `host`."""
87+
return host.split('.', 1)[1]
88+
89+
90+
def main():
91+
"""Run script."""
92+
shuffle(servers)
93+
94+
hosts = []
95+
for i in range(COUNT):
96+
d = choice(domains)
97+
if randint(0, 1):
98+
s = servers.pop()
99+
else:
100+
s = choice(subdomains)
101+
hosts.append('{}.{}'.format(s, d))
102+
103+
for h in sorted(hosts, key=domain):
104+
print('"{}",'.format(h))
105+
106+
if __name__ == '__main__':
107+
main()

icon.png

-1.12 KB
Loading

icons/Secure Shell.iconsproj

-62 Bytes
Binary file not shown.

icons/Secure Shell.pxm

12.3 KB
Binary file not shown.

icons/icon.icns

0 Bytes
Binary file not shown.
0 Bytes
Loading

icons/icon.png

-1.51 KB
Loading

icons/update-thick.png

-52.1 KB
Binary file not shown.

icons/update-thin.png

-45.6 KB
Binary file not shown.

icons/update-xthick.png

-57.9 KB
Binary file not shown.

icons/update.icns

17 Bytes
Binary file not shown.
5 Bytes
Loading

icons/update.iconset/icon_256x256.png

-2 Bytes
Loading
7 Bytes
Loading

icons/update.iconset/icon_512x512.png

7 Bytes
Loading
0 Bytes
Loading

icons/update.png

-50.2 KB
Loading

modd.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
**/*.go info.plist build-workflow.zsh icons/*.icns {
2+
**/*.go info.plist bin/build-workflow.zsh icons/*iconset/*.png {
33
# prep: echo @mods
44
# prep: go build -v gogs.deanishe.net/deanishe/awgo
5-
prep: go test -v && ./build-workflow.zsh
5+
prep: go test -v && bin/build-workflow.zsh
66
# prep: ./alfssh search toot > /dev/null
77
}
88

99
/Users/daj/src/gogs.deanishe.net/deanishe/awgo/**.go {
10-
prep: ./build-workflow.zsh
10+
prep: bin/build-workflow.zsh
1111
prep: ./alfssh search toot > /dev/null
1212
}

update.png

-1.83 KB
Loading

0 commit comments

Comments
 (0)