alox 0.0.1
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/LICENSE +21 -0
- data/README.md +21 -0
- data/VERSION +1 -0
- data/bin/alox +5 -0
- data/lib/alox/version.rb +3 -0
- data/libexec/_bump +118 -0
- data/libexec/_jason +200 -0
- data/libexec/_log4sh +3841 -0
- data/libexec/_shflags +1012 -0
- data/libexec/_sub +60 -0
- data/libexec/build-gem +30 -0
- data/libexec/build-site +27 -0
- data/libexec/bump +32 -0
- data/libexec/edit-gem +81 -0
- data/libexec/publish-gem +64 -0
- data/libexec/publish-site +86 -0
- metadata +64 -0
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Licensed under the same terms and conditions as capistrano 2.5.21.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
LICENSE
|
2
|
+
-------
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
'Software'), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
18
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
19
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
20
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
21
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/alox
ADDED
data/lib/alox/version.rb
ADDED
data/libexec/_bump
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
function bump_version {
|
4
|
+
local dirty="$1"; shift
|
5
|
+
|
6
|
+
if [[ "$dirty" = "$FLAGS_FALSE" ]]; then
|
7
|
+
ensure_clean_git_status
|
8
|
+
fi
|
9
|
+
|
10
|
+
local_file=
|
11
|
+
if [[ -f VERSION || -L VERSION ]]; then
|
12
|
+
local_file=1
|
13
|
+
if [[ ! -e VERSION ]]; then
|
14
|
+
logger_fatal "cannot write to VERSION file"
|
15
|
+
exit 1
|
16
|
+
fi
|
17
|
+
fi
|
18
|
+
|
19
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
20
|
+
if [[ -n $local_file ]]; then
|
21
|
+
cat VERSION | perl -ne 'm{^\s*v?(\d+)\.(\d+)\.(\d+)\s*$} && printf("%03d.%03d.%03d %d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
|
22
|
+
else
|
23
|
+
git tag | perl -ne 'm{^v(\d+)\.(\d+)\.(\d+)$} && printf("%03d.%03d.%03d %d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [[ ! -s "$tmp_version" ]]; then
|
27
|
+
logger_fatal "need at least one git tag (in the form v0.0.0) or a version in file VERSION (in the form 0.0.0)"
|
28
|
+
exit 1
|
29
|
+
fi
|
30
|
+
|
31
|
+
case "$1" in
|
32
|
+
patch|minor|major)
|
33
|
+
bump=$1; shift
|
34
|
+
set -- $(cat $tmp_version | sed 's#\.# #g')
|
35
|
+
case "$bump" in
|
36
|
+
patch)
|
37
|
+
echo "$1.$2.$(($3 + 1))"
|
38
|
+
;;
|
39
|
+
minor)
|
40
|
+
echo "$1.$(($2 + 1)).0"
|
41
|
+
;;
|
42
|
+
major)
|
43
|
+
echo "$(($1 + 1)).0.0"
|
44
|
+
;;
|
45
|
+
esac > $tmp_version
|
46
|
+
;;
|
47
|
+
*)
|
48
|
+
ver_new=$1; shift
|
49
|
+
ver_new=${ver_new#v}
|
50
|
+
echo $ver_new > $tmp_version
|
51
|
+
;;
|
52
|
+
esac
|
53
|
+
|
54
|
+
ver_new=$(cat $tmp_version)
|
55
|
+
set -- $(echo "$ver_new" | sed 's#\.# #g') 0
|
56
|
+
M=$1; shift
|
57
|
+
m=$1; shift
|
58
|
+
p=$1; shift
|
59
|
+
|
60
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
61
|
+
ver_new_same=$(cat $tmp_version)
|
62
|
+
|
63
|
+
if [[ $ver_new != $ver_new_same ]]; then
|
64
|
+
logger_fatal "invalid version: $ver_new"
|
65
|
+
exit 1
|
66
|
+
fi
|
67
|
+
|
68
|
+
ver_bumped="v$(cat $tmp_version)"
|
69
|
+
rm -f $tmp_version
|
70
|
+
ensure_git_tag_available $ver_bumped
|
71
|
+
|
72
|
+
if [[ -n $local_file ]]; then
|
73
|
+
echo ${ver_bumped#v} > VERSION
|
74
|
+
git add VERSION
|
75
|
+
if [[ -f Gemfile ]]; then
|
76
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
77
|
+
git add Gemfile.lock
|
78
|
+
fi
|
79
|
+
|
80
|
+
git commit -m "bump: $ver_bumped"
|
81
|
+
fi
|
82
|
+
|
83
|
+
git_tag "$ver_bumped"
|
84
|
+
echo $ver_bumped
|
85
|
+
}
|
86
|
+
|
87
|
+
function ensure_git_tag_available {
|
88
|
+
version=$1; shift
|
89
|
+
git fetch --tags
|
90
|
+
remote_sha=$(git ls-remote origin $version | awk '{print $1}')
|
91
|
+
if [[ -n $remote_sha ]]; then
|
92
|
+
logger_fatal "already a remote tag $version, bump again"
|
93
|
+
exit 1
|
94
|
+
fi
|
95
|
+
|
96
|
+
local_sha=$(git show-ref $version | awk '{print $1}')
|
97
|
+
if [[ -n $local_sha ]]; then
|
98
|
+
logger_fatal "already a local tag $version"
|
99
|
+
exit 1
|
100
|
+
fi
|
101
|
+
}
|
102
|
+
|
103
|
+
function git_tag {
|
104
|
+
local version=$1; shift
|
105
|
+
|
106
|
+
ensure_git_tag_available "$version"
|
107
|
+
|
108
|
+
git tag $version
|
109
|
+
}
|
110
|
+
|
111
|
+
function ensure_clean_git_status {
|
112
|
+
local lines=$(git status -s -uno | wc -l | awk '{print $1}')
|
113
|
+
if [[ $lines != "0" ]]; then
|
114
|
+
logger_fatal "git status is not clean, cannot tag"
|
115
|
+
git status -s -uno
|
116
|
+
exit 1
|
117
|
+
fi
|
118
|
+
}
|
data/libexec/_jason
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [[ -z "${shome:-}" ]]; then
|
4
|
+
shome="$(unset CDPATH; cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
|
5
|
+
fi
|
6
|
+
|
7
|
+
function check_help {
|
8
|
+
# taken from shocco
|
9
|
+
if expr -- "$*" : ".*--help" >/dev/null; then
|
10
|
+
display_help
|
11
|
+
exit 0
|
12
|
+
fi
|
13
|
+
}
|
14
|
+
|
15
|
+
function display_help {
|
16
|
+
flags_help
|
17
|
+
echo
|
18
|
+
|
19
|
+
# taken from shocco
|
20
|
+
grep '^#/' <"$shome/$(basename $(dirname -- "$0"))/$(basename -- "$0")" | cut -c4-
|
21
|
+
}
|
22
|
+
|
23
|
+
# Exits the script with the last error code. Servers as a marker in $0 to
|
24
|
+
# begin ronn documentation until end of file.
|
25
|
+
function __MAN__ {
|
26
|
+
exit "$!"
|
27
|
+
}
|
28
|
+
|
29
|
+
# Extracts ronn-style Markdown after __MAN__ to stdout. If a line is "MAN", it
|
30
|
+
# is assumed that a here document is used (for syntactical reasons).
|
31
|
+
#
|
32
|
+
# A limitation of detecting "MAN" will truncate the Markdown if "MAN" is a
|
33
|
+
# legimate text.
|
34
|
+
#
|
35
|
+
# __MAN__ << "MAN"
|
36
|
+
# raw ronn-style Markdown
|
37
|
+
# MAN
|
38
|
+
function display_man {
|
39
|
+
awk '/^__MAN__/,/^MAN$/ {print}' <"$0" | tail -n +2 | egrep -v '^MAN$'
|
40
|
+
}
|
41
|
+
|
42
|
+
function display_synopsis {
|
43
|
+
awk '/^#/ && !/^#!/ { print } /^[^#]/ || /^$/ { exit }' <"$0" | cut -c3-
|
44
|
+
}
|
45
|
+
|
46
|
+
function which_library {
|
47
|
+
local library="$1"; shift
|
48
|
+
if [[ -r "$shome/vendor/projects/$library/libexec/_$library" ]]; then
|
49
|
+
echo "$shome/vendor/projects/$library/libexec/_$library"
|
50
|
+
elif [[ -r "$shome/libexec/_$library" ]]; then
|
51
|
+
echo "$shome/libexec/_$library"
|
52
|
+
elif [[ -r "$shome/.$library/libexec/_$library" ]]; then
|
53
|
+
echo "$shome/.$library/libexec/_$library"
|
54
|
+
else
|
55
|
+
local nm_library="${library%%/*}"
|
56
|
+
if [[ "$nm_library" != "$library" ]]; then
|
57
|
+
local nm_right="${library##*/}"
|
58
|
+
if [[ -r "$shome/vendor/projects/$nm_library/libexec/_$nm_right" ]]; then
|
59
|
+
echo "$shome/vendor/projects/$nm_library/libexec/_$nm_right"
|
60
|
+
elif [[ -r "$shome/.$nm_library/libexec/_$nm_right" ]]; then
|
61
|
+
echo "$shome/.$nm_library/libexec/_$nm_right"
|
62
|
+
fi
|
63
|
+
fi
|
64
|
+
fi
|
65
|
+
}
|
66
|
+
|
67
|
+
function require {
|
68
|
+
local nm_library="$1"; shift
|
69
|
+
local pth_lib="$(which_library "$nm_library")"
|
70
|
+
if [[ -r "$pth_lib" ]]; then
|
71
|
+
if [[ "$#" == 0 ]]; then
|
72
|
+
set --
|
73
|
+
fi
|
74
|
+
source "$pth_lib" "$@"
|
75
|
+
else
|
76
|
+
logger_warn "library $nm_library not found"
|
77
|
+
fi
|
78
|
+
}
|
79
|
+
|
80
|
+
function parse_command_line {
|
81
|
+
if [[ "$FLAGS_SUB" = "$FLAGS_TRUE" && "$@" > 0 ]]; then
|
82
|
+
export POSIXLY_CORRECT=1
|
83
|
+
fi
|
84
|
+
|
85
|
+
if ! FLAGS "$@"; then
|
86
|
+
unset POSIXLY_CORRECT
|
87
|
+
if [[ "$flags_error" = "help requested" ]]; then
|
88
|
+
echo ""
|
89
|
+
display_help
|
90
|
+
exit 0
|
91
|
+
fi
|
92
|
+
|
93
|
+
return 4
|
94
|
+
fi
|
95
|
+
|
96
|
+
unset POSIXLY_CORRECT
|
97
|
+
return 0
|
98
|
+
}
|
99
|
+
|
100
|
+
function configure_logging {
|
101
|
+
# load log4sh (disabling properties file warning) and clear the default
|
102
|
+
# configuration
|
103
|
+
LOG4SH_CONFIGURATION='none' require 'log4sh'
|
104
|
+
log4sh_resetConfiguration
|
105
|
+
|
106
|
+
# set the global logging level to INFO
|
107
|
+
logger_setLevel INFO
|
108
|
+
|
109
|
+
# add and configure a FileAppender that outputs to STDERR, and activate the
|
110
|
+
# configuration
|
111
|
+
logger_addAppender stderr
|
112
|
+
appender_setType stderr FileAppender
|
113
|
+
appender_file_setFile stderr STDERR
|
114
|
+
appender_activateOptions stderr
|
115
|
+
}
|
116
|
+
|
117
|
+
function ryaml {
|
118
|
+
ruby -ryaml -e 'def ps x; unless x.nil?; puts (x.class == String || x.class == Fixnum) ? x : x.to_yaml; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[acc.class == Array ? key.to_i : key] }' "$@" 2>&-
|
119
|
+
}
|
120
|
+
|
121
|
+
function random_str {
|
122
|
+
echo "$(date +%s).$$.$RANDOM"
|
123
|
+
}
|
124
|
+
|
125
|
+
function runmany {
|
126
|
+
local cpu="$1"; shift
|
127
|
+
local args="$1"; shift
|
128
|
+
local cmd="$1"; shift
|
129
|
+
if [[ "$#" = 0 ]]; then
|
130
|
+
cat
|
131
|
+
else
|
132
|
+
echo "$@"
|
133
|
+
fi | xargs -P $cpu -n $args -- bash -c "$cmd" ""
|
134
|
+
}
|
135
|
+
|
136
|
+
function mark_log {
|
137
|
+
local nm_mark="$1"; shift
|
138
|
+
touch "$tmp_switch/wait-$nm_mark"
|
139
|
+
echo $tmp_switch $nm_mark
|
140
|
+
while [[ -f "$tmp_switch/wait-$nm_mark" ]]; do
|
141
|
+
sleep 1
|
142
|
+
done
|
143
|
+
}
|
144
|
+
|
145
|
+
function marked_logger {
|
146
|
+
local nm_switch=""
|
147
|
+
while read -r a b; do
|
148
|
+
if [[ "$a" = "$tmp_switch" ]]; then
|
149
|
+
nm_switch="$b"
|
150
|
+
rm "$tmp_switch/wait-$nm_switch"
|
151
|
+
else
|
152
|
+
if [[ -z "$nm_switch" ]]; then
|
153
|
+
echo "$a $b"
|
154
|
+
else
|
155
|
+
echo "$nm_switch: $a $b"
|
156
|
+
fi
|
157
|
+
fi
|
158
|
+
done
|
159
|
+
}
|
160
|
+
|
161
|
+
function mark_stdout {
|
162
|
+
if [[ -z "${tmp_switch:-}" ]]; then
|
163
|
+
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
164
|
+
fi
|
165
|
+
exec 1> >(marked_logger)
|
166
|
+
}
|
167
|
+
|
168
|
+
function mark_stderr {
|
169
|
+
if [[ -z "${tmp_switch:-}" ]]; then
|
170
|
+
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
171
|
+
fi
|
172
|
+
exec 2> >(marked_logger)
|
173
|
+
}
|
174
|
+
|
175
|
+
function mark_output {
|
176
|
+
if [[ -z "${tmp_switch:-}" ]]; then
|
177
|
+
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
178
|
+
fi
|
179
|
+
exec 1> >(marked_logger) 2>&1
|
180
|
+
}
|
181
|
+
|
182
|
+
function _main {
|
183
|
+
if [[ -z "$shome" ]]; then
|
184
|
+
shome="$(unset CDPATH; cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
|
185
|
+
fi
|
186
|
+
|
187
|
+
: ${__meat__:=x}
|
188
|
+
if [[ "$__meat__" != 'x' ]]; then
|
189
|
+
return 0
|
190
|
+
fi
|
191
|
+
|
192
|
+
__meat__='y'
|
193
|
+
|
194
|
+
require 'shflags'
|
195
|
+
|
196
|
+
configure_logging
|
197
|
+
}
|
198
|
+
|
199
|
+
_main "$@"
|
200
|
+
set -fue
|