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/libexec/_sub ADDED
@@ -0,0 +1,60 @@
1
+ #!/bin/bash
2
+
3
+ if [[ "${BASH_SOURCE##*/}" != "_sub" ]]; then
4
+ shome="$(unset CDPATH; cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
5
+ source "$shome/libexec/_jason"
6
+ set -- "$BASH_SOURCE" "$@"
7
+ fi
8
+
9
+ if [[ "$(type -t main)" != "function" ]]; then
10
+ function main {
11
+ if [[ "$#" > 0 ]]; then
12
+ logger_fatal "Command $sub_base $1 not implemented"
13
+ else
14
+ logger_fatal "Command $sub_base not implemented"
15
+ fi
16
+ exit 1
17
+ }
18
+ fi
19
+
20
+ function sub {
21
+ local bsource="$1"; shift
22
+ local sub_base="$(basename "$bsource")"
23
+ local bsource_cmd="$shome/libexec/${sub_base}"
24
+
25
+ if [[ "$bsource_cmd" = "$bsource" ]]; then
26
+ FLAGS_SUB="$FLAGS_TRUE"
27
+ parse_command_line "$@" || exit $?
28
+ eval set -- "${FLAGS_ARGV}"
29
+ fi
30
+
31
+ if [[ "$#" > 0 ]]; then
32
+ if [[ ! "$1" =~ ^- ]]; then
33
+ local sub_cmd="$shome/libexec/${sub_base}-$1"
34
+
35
+ if [[ ! -x "$sub_cmd" ]]; then
36
+ sub_cmd="$(type -P "${sub_base}-$1" || true)"
37
+ fi
38
+
39
+ if [[ -x "$sub_cmd" ]]; then
40
+ shift
41
+ exec "$sub_cmd" "$@"
42
+ fi
43
+ fi
44
+ fi
45
+
46
+ if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
47
+ exec "$bsource_cmd" "$@"
48
+ else
49
+ if [[ "$(type -t main)" = "function" ]]; then
50
+ main "$@"
51
+ else
52
+ logger_fatal "Can't run $sub_base, missing main function"
53
+ exit 1
54
+ fi
55
+ fi
56
+ }
57
+
58
+ if [[ "$#" > 0 ]]; then
59
+ sub "$@"
60
+ fi
data/libexec/build-gem ADDED
@@ -0,0 +1,30 @@
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" "$@"
@@ -0,0 +1,27 @@
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 ADDED
@@ -0,0 +1,32 @@
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 ADDED
@@ -0,0 +1,81 @@
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" "$@"
@@ -0,0 +1,64 @@
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" "$@"
@@ -0,0 +1,86 @@
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" "$@"
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Nghiem
9
+ - Tom Bombadil
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-07-01 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: shell scripts packaged as rubygems, activated with bundler
16
+ email:
17
+ - nghidav@gmail.com
18
+ - amanibhavam@destructuring.org
19
+ executables:
20
+ - alox
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - LICENSE
25
+ - VERSION
26
+ - README.md
27
+ - libexec/_bump
28
+ - libexec/_jason
29
+ - libexec/_log4sh
30
+ - libexec/_shflags
31
+ - libexec/_sub
32
+ - libexec/build-gem
33
+ - libexec/build-site
34
+ - libexec/bump
35
+ - libexec/edit-gem
36
+ - libexec/publish-gem
37
+ - libexec/publish-site
38
+ - lib/alox/version.rb
39
+ - bin/alox
40
+ homepage: https://github.com/destructuring/alox
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.25
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: shell scripts packaged as rubygems
64
+ test_files: []