alox 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,3 +1,16 @@
1
+ # Getting Started
2
+
3
+ The `alox` repo demos a few alox gems.
4
+
5
+ First, bundle the gems:
6
+
7
+ bundle exec --local --path vendor/bundle --standalone
8
+
9
+ Then run `bin/alox` with `BUNDLE_GEMFILE` set, as if `bundle exec` was
10
+ run:
11
+
12
+ env BUNDLE_GEMFILE="$(pwd)/Gemfile" bin/alox
13
+
1
14
  LICENSE
2
15
  -------
3
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.3
data/bin/alox CHANGED
@@ -1,5 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- ENV['_AO_HOME'] = File.dirname(ENV['BUNDLE_GEMFILE'])
4
- shome=File.expand_path('../..', __FILE__)
5
- system("#{shome}/libexec/aoh", *ARGV)
3
+ require_relative '../vendor/bundle/bundler/setup'
4
+
5
+ require 'pp'
6
+
7
+ # look for /alox-XXX-0.0.0/lib and map XXX => gem root
8
+ aloxes = ($:.collect {|lib| lib.match(%r{(.*?/alox-([^-]+)-[^/]+)/lib}) }).compact.inject({}) {|acc, m| acc[m[2]] = m[1]; acc }
9
+
10
+ ENV['PATH'] = aloxes.inject(ENV['PATH']) {|acc, alox|
11
+ _, root = alox
12
+ "#{root}/aloxbin:#{root}/aloxec:#{ENV['PATH']}"
13
+ }
14
+
15
+ if ARGV.length > 0
16
+ system(*ARGV)
17
+ end
data/libexec/alox-test ADDED
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ meh -- alox demo
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ meh ...
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source _jason
14
+
15
+ # entry point
16
+ function main {
17
+ echo "$@"
18
+ }
19
+
20
+ require _sub "$BASH_SOURCE" "$@"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -25,10 +25,7 @@ files:
25
25
  - VERSION
26
26
  - README.md
27
27
  - libexec/_bump
28
- - libexec/_jason
29
- - libexec/_log4sh
30
- - libexec/_shflags
31
- - libexec/_sub
28
+ - libexec/alox-test
32
29
  - libexec/build-gem
33
30
  - libexec/build-site
34
31
  - libexec/bump
data/libexec/_jason DELETED
@@ -1,200 +0,0 @@
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