alox 0.0.7 → 0.0.8

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
data/bin/alox CHANGED
@@ -1,19 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path('../../vendor/bundle/bundler/setup', __FILE__)
4
-
5
3
  # look for /XXX/lib and map XXX => gem root
6
4
  aloxes = ($:.collect {|lib| lib.match(%r{(.*?/([^/]+))/lib}) }).compact.inject({}) {|acc, m| acc[m[2]] = m[1]; acc }
7
5
 
8
6
  ENV['PATH'] = aloxes.inject(ENV['PATH']) {|acc, alox|
9
7
  _, root = alox
8
+
10
9
  if File.directory? "#{root}/aloxec"
11
- "#{root}/aloxec:#{acc}"
12
- else
13
- acc
10
+ acc="#{root}/aloxec:#{acc}"
14
11
  end
12
+
13
+ if File.directory? "#{root}/exec"
14
+ acc="#{root}/exec:#{acc}"
15
+ end
16
+
17
+ acc
15
18
  }
16
19
 
17
- if ARGV.length > 0
18
- system(*ARGV)
19
- end
20
+ system("_sub", *ARGV)
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.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -24,14 +24,6 @@ files:
24
24
  - LICENSE
25
25
  - VERSION
26
26
  - README.md
27
- - libexec/_bump
28
- - libexec/alox-test
29
- - libexec/build-gem
30
- - libexec/build-site
31
- - libexec/bump
32
- - libexec/edit-gem
33
- - libexec/publish-gem
34
- - libexec/publish-site
35
27
  - lib/alox/version.rb
36
28
  - bin/alox
37
29
  homepage: https://github.com/destructuring/alox
data/libexec/_bump DELETED
@@ -1,118 +0,0 @@
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/alox-test DELETED
@@ -1,20 +0,0 @@
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" "$@"
data/libexec/build-gem DELETED
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ build-gem -- upload the latest (timestamp) rubygem to rubygems.org
5
- #/
6
- #/ SYNOPSIS
7
- #/ build gem -n gem_name
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 "$shome/libexec/_jason"
14
-
15
- # define command line options:
16
- DEFINE_string 'name' "$(basename "$shome")" 'name of gem' 'n'
17
-
18
- # entry point
19
- function main {
20
- local pth_gemspec="$shome/$FLAGS_name.gemspec"
21
- if [[ ! -e "$pth_gemspec" ]]; then
22
- logger_fatal "could not find gemspec $pth_gemspec"
23
- exit 1
24
- fi
25
-
26
- cd "$shome"
27
- gem build "$pth_gemspec"
28
- }
29
-
30
- require sub "$BASH_SOURCE" "$@"
data/libexec/build-site DELETED
@@ -1,27 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ build-site -- build nanoc site
5
- #/
6
- #/ SYNOPSIS
7
- #/ build site
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 "$shome/libexec/_jason"
14
-
15
- # define command line options:
16
- DEFINE_boolean 'clean' "$FLAGS_FALSE" 'delete output directory first'
17
-
18
- # entry point
19
- function main {
20
- if [[ "$FLAGS_clean" = "$FLAGS_TRUE" ]]; then
21
- rm -rf "$shome/output"
22
- fi
23
-
24
- bundle exec ghp compile
25
- }
26
-
27
- require sub "$BASH_SOURCE" "$@"
data/libexec/bump DELETED
@@ -1,32 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ bump -- increments a semver in a file or in git tags
5
- #/
6
- #/ SYNOPSIS
7
- #/ bump [major|minor|patch]
8
- #/ bump 1.2.3
9
- #/ bump
10
- #/ without arguments is equivalent to 'bump patch'
11
-
12
- # figure out the project root under which bin, lib live
13
- shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
14
-
15
- # load a jason bourne library
16
- source "$shome/libexec/_jason"
17
-
18
- # parse the command-line
19
- DEFINE_boolean 'dirty' "$FLAGS_FALSE" 'force bumping in unclean work area' 'f'
20
-
21
- # entry point
22
- function main {
23
- require 'bump'
24
-
25
- if [[ "$#" = 0 ]]; then
26
- set -- patch
27
- fi
28
-
29
- bump_version "$FLAGS_dirty" "$@"
30
- }
31
-
32
- require sub "$BASH_SOURCE" "$@"
data/libexec/edit-gem DELETED
@@ -1,81 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ edit-gem -- set environment to hint to Gemfile to use a local gemspec
5
- #/
6
- #/ SYNOPSIS
7
- #/ edit gem <name> [location]
8
- #/ edit gem -r <names>
9
- #/ edit gem -R
10
-
11
- # figure out the project root under which bin, lib live
12
- shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
13
-
14
- # load a jason bourne library
15
- source "$shome/libexec/_jason"
16
-
17
- # define command line options:
18
- DEFINE_boolean "update" "$FLAGS_FALSE" "finish editing a local gem and updates project" "u"
19
- DEFINE_boolean "reset" "$FLAGS_FALSE" "reset gem to remote" "r"
20
- DEFINE_boolean "resetall" "$FLAGS_FALSE" "reset all gems to remote" "R"
21
-
22
- # entry point
23
- function main {
24
- if [[ "$FLAGS_resetall" = "$FLAGS_TRUE" ]]; then
25
- set +f
26
- rm -f $shome/.local/*
27
- set -f
28
- bundle --local --quiet && bundle check > /dev/null
29
- git diff --no-ext-diff Gemfile.lock vendor/cache
30
- elif [[ "$FLAGS_reset" = "$FLAGS_TRUE" ]]; then
31
- local nm_gem
32
- for nm_gem in "$@"; do
33
- rm -f "$shome/.local/$nm_gem"
34
- done
35
-
36
- bundle --local --quiet && bundle check > /dev/null
37
-
38
- git diff --no-ext-diff Gemfile.lock vendor/cache
39
- elif [[ "$FLAGS_update" = "$FLAGS_TRUE" ]]; then
40
- local nm_gem
41
- for nm_gem in "$@"; do
42
- echo -n > "$shome/.local/$nm_gem"
43
- done
44
-
45
- bundle update "$@"
46
-
47
- for nm_gem in "$@"; do
48
- rm -f "$shome/.local/$nm_gem"
49
- done
50
- bundle --local --quiet && bundle check > /dev/null
51
-
52
- git add Gemfile.lock vendor/cache
53
- git add -u vendor/cache
54
- git diff --no-ext-diff --cached Gemfile.lock vendor/cache
55
- else
56
- local nm_gem="$1"; shift
57
-
58
- local pth_gem
59
- if [[ "$#" = 0 ]]; then
60
- pth_gem="gems/$nm_gem"
61
- else
62
- pth_gem="$1"; shift
63
- fi
64
-
65
- if [[ ! -d "$pth_gem" ]]; then
66
- logger_fatal "cannot find local gem directoy at $pth_gem"
67
- exit 1
68
- fi
69
-
70
- pth_gem="$(unset CDPATH; cd -P -- "$pth_gem" && pwd -P)"
71
-
72
- echo "enabling local gem development on ${nm_gem} at ${pth_gem}"
73
- mkdir -p "$shome/.local"
74
- echo "$pth_gem" > "$shome/.local/$nm_gem"
75
-
76
- bundle --local --quiet && bundle check > /dev/null
77
- git diff --no-ext-diff Gemfile.lock vendor/cache
78
- fi
79
- }
80
-
81
- require sub "$BASH_SOURCE" "$@"
data/libexec/publish-gem DELETED
@@ -1,64 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ publish-gem -- publish a gem to a local, remote rubygems, geminabox repository
5
- #/
6
- #/ SYNOPSIS
7
- #/ publish gem [--public | --private | --local]
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 "$shome/libexec/_jason"
14
-
15
- # define command line options:
16
- DEFINE_boolean "private" "$FLAGS_TRUE" "push to a local, private geminabox"
17
- DEFINE_boolean "shared" "$FLAGS_FALSE" "push to a shared, private geminabox"
18
- DEFINE_boolean "public" "$FLAGS_FALSE" "push to rubygems.org"
19
- DEFINE_string "server" "http://localhost:9292" "geminabox server"
20
-
21
- # entry point
22
- function main {
23
- if [[ "$FLAGS_public" = "$FLAGS_TRUE" ]]; then
24
- if [[ ! -f "$shome/.private" ]]; then
25
- push_gem_public "$@"
26
- else
27
- logger_fatal "This project is marked private"
28
- exit 1
29
- fi
30
- elif [[ "$FLAGS_private" = "$FLAGS_TRUE" ]]; then
31
- push_gem_private
32
- else
33
- logger_fatal "must specify --public to confirm a gem push to rubygems.org"
34
- exit 1
35
- fi
36
- }
37
-
38
- # push a gem locally
39
- function push_gem_private {
40
- if [[ "$#" = 0 ]]; then
41
- set +f
42
- local latest_gem="$(ls -td *.gem 2>&- | head -1)"
43
- push_gem_private "$latest_gem"
44
- set -f
45
- else
46
- gem inabox -g "$FLAGS_server" "$@"
47
- fi
48
- }
49
-
50
- # push the latest gem to rubygems.org
51
- function push_gem_public {
52
- set +f
53
- local latest_gem="$(ls -td *.gem 2>&- | head -1)"
54
- set -f
55
-
56
- if [[ -z "$latest_gem" ]]; then
57
- logger_fatal "no gems found"
58
- exit 1
59
- fi
60
-
61
- gem push "$latest_gem"
62
- }
63
-
64
- require sub "$BASH_SOURCE" "$@"
data/libexec/publish-site DELETED
@@ -1,86 +0,0 @@
1
- #!/bin/bash
2
-
3
- #/ NAME
4
- #/ publish-site -- commit files from one dir to a repo/branch/dir
5
- #/
6
- #/ SYNOPSIS
7
- #/ publish site src_dir repo branch dst_dir
8
- #/ publish site # defaults to output . gh-pages .
9
-
10
- # figure out the project root under which bin, lib live
11
- shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
12
-
13
- # load a jason bourne library
14
- source "$shome/libexec/_jason"
15
-
16
- # define command line options:
17
- DEFINE_boolean "clean" "$FLAGS_FALSE" "delete destination branch contents"
18
- DEFINE_string "message" "published $(date)" "commit message for published content" "m"
19
- DEFINE_boolean "force" "$FLAGS_FALSE" "force push to remote" "f"
20
-
21
- # entry point
22
- function main {
23
- if [[ "$#" = 0 ]]; then
24
- local src_dir="output"
25
- else
26
- local src_dir="$1"; shift
27
- fi
28
-
29
- if [[ "$#" = 0 ]]; then
30
- local dst_repo="."
31
- else
32
- local dst_repo="$1"; shift
33
- fi
34
-
35
- if [[ "$#" = 0 ]]; then
36
- local dst_branch="gh-pages"
37
- else
38
- local dst_branch="$1"; shift
39
- fi
40
-
41
- if [[ "$#" = 0 ]]; then
42
- local dst_dir="."
43
- else
44
- local dst_dir="$1"; shift
45
- fi
46
-
47
- local tmp_dir="$(TMPDIR="$shome/tmp" mktemp -d -t XXXXXXXXX)"
48
-
49
- git clone "$dst_repo" "$tmp_dir"
50
-
51
- pushd "$tmp_dir" > /dev/null
52
- if ! git checkout "$dst_branch"; then
53
- # basically git disconnect from paul repo
54
- git checkout --orphan "$dst_branch"
55
- git rm -rf .
56
- touch .gitignore
57
- git add .gitignore
58
- git commit -m "initializing disconnected branch $dst_branch"
59
- git clean -fdx
60
- fi
61
-
62
- if [[ "$FLAGS_clean" = "$FLAGS_TRUE" ]]; then
63
- git rm -rf .
64
- git add -u .
65
- fi
66
- popd > /dev/null
67
-
68
- rsync -q -ia -c -O "$src_dir/." "$tmp_dir/$dst_dir"
69
-
70
- pushd "$tmp_dir" > /dev/null
71
- git add .
72
- git status -s
73
- git commit -m "$FLAGS_message" || true
74
- git push origin "$dst_branch"
75
- popd > /dev/null
76
- rm -rf "$tmp_dir"
77
-
78
- local opt_push=
79
- if [[ "$FLAGS_force" = "$FLAGS_TRUE" ]]; then
80
- opt_push="-f "
81
- fi
82
- git push $opt_push primary $dst_branch:refs/heads/$dst_branch
83
- git push $opt_push secondary $dst_branch:refs/heads/$dst_branch || true
84
- }
85
-
86
- require sub "$BASH_SOURCE" "$@"