alpha_omega 1.1.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/VERSION +1 -1
  2. data/bin/alpha_omega +2 -10
  3. data/lib/alpha_omega/deploy.rb +2 -16
  4. data/libexec/ao +15 -0
  5. data/libexec/ao-activate +22 -0
  6. data/libexec/ao-build +22 -0
  7. data/libexec/ao-check +22 -0
  8. data/libexec/ao-compare +22 -0
  9. data/libexec/ao-cook +22 -0
  10. data/libexec/ao-deploy +22 -0
  11. data/libexec/ao-dist +22 -0
  12. data/libexec/ao-lock +31 -0
  13. data/libexec/ao-migrate +22 -0
  14. data/libexec/ao-plan +22 -0
  15. data/libexec/ao-release +22 -0
  16. data/libexec/ao-restart +22 -0
  17. data/libexec/ao-rollback +22 -0
  18. data/libexec/ao-shell +22 -0
  19. data/libexec/ao-stage +22 -0
  20. data/libexec/ao-task +23 -0
  21. data/libexec/ao-unlock +31 -0
  22. data/sbin/_bump +126 -0
  23. data/sbin/_jason +172 -0
  24. data/sbin/_log4sh +3840 -0
  25. data/sbin/_meat +172 -0
  26. data/sbin/_prime +8 -0
  27. data/sbin/_shflags +1012 -0
  28. data/sbin/_shunit +1048 -0
  29. data/sbin/_sub +37 -0
  30. data/sbin/_treadstone +8 -0
  31. data/sbin/_versions +174 -0
  32. data/sbin/ao +15 -0
  33. data/sbin/stub +15 -0
  34. metadata +31 -57
  35. data/libexec/activate +0 -199
  36. data/libexec/build +0 -30
  37. data/libexec/build.orig +0 -199
  38. data/libexec/bump.orig +0 -32
  39. data/libexec/check +0 -199
  40. data/libexec/compare +0 -199
  41. data/libexec/config +0 -199
  42. data/libexec/debug +0 -199
  43. data/libexec/deploy +0 -199
  44. data/libexec/dist +0 -199
  45. data/libexec/dna +0 -199
  46. data/libexec/hosts +0 -199
  47. data/libexec/invoke +0 -199
  48. data/libexec/lock +0 -199
  49. data/libexec/migrate +0 -199
  50. data/libexec/plan +0 -199
  51. data/libexec/release +0 -199
  52. data/libexec/repl +0 -199
  53. data/libexec/restart +0 -199
  54. data/libexec/rollback +0 -199
  55. data/libexec/shell +0 -199
  56. data/libexec/stage +0 -199
  57. data/libexec/task +0 -199
  58. data/libexec/unlock +0 -199
data/sbin/_sub ADDED
@@ -0,0 +1,37 @@
1
+ #!/bin/bash
2
+
3
+ function sub {
4
+ local bsource="$1"; shift
5
+ local sub_base="$(basename "$bsource")"
6
+ local bsource_cmd="$shome/libexec/${sub_base}"
7
+
8
+ if [[ "$bsource_cmd" = "$bsource" ]]; then
9
+ FLAGS_SUB="$FLAGS_TRUE"
10
+ parse_command_line "$@" || exit $?
11
+ eval set -- "${FLAGS_ARGV}"
12
+ fi
13
+
14
+ if [[ "$#" > 0 ]]; then
15
+ if [[ ! "$1" =~ ^- ]]; then
16
+ local sub_cmd="$(command -v "${sub_base}-$1" || true)"
17
+ if [[ ! -x "$sub_cmd" ]]; then
18
+ sub_cmd="$shome/libexec/${sub_base}-$1"
19
+ fi
20
+
21
+ if [[ -x "$sub_cmd" ]]; then
22
+ shift
23
+ exec "$sub_cmd" "$@"
24
+ fi
25
+ fi
26
+ fi
27
+
28
+ if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
29
+ exec "$bsource_cmd" "$@"
30
+ else
31
+ main "$@"
32
+ fi
33
+ }
34
+
35
+ if [[ "$#" > 0 ]]; then
36
+ sub "$@"
37
+ fi
data/sbin/_treadstone ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ if [[ -z "${shome:-}" ]]; then
4
+ shome="$(cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
5
+ fi
6
+
7
+ source "$shome/sbin/_jason"
8
+ set -fue
data/sbin/_versions ADDED
@@ -0,0 +1,174 @@
1
+ #! /bin/sh
2
+ # $Id$
3
+ # vim:et:ft=sh:sts=2:sw=2
4
+ #
5
+ # Copyright 2008 Kate Ward. All Rights Reserved.
6
+ # Released under the LGPL (GNU Lesser General Public License)
7
+ #
8
+ # Author: kate.ward@forestent.com (Kate Ward)
9
+ #
10
+ # This library provides reusable functions that determine actual names and
11
+ # versions of installed shells and the OS. The library can also be run as a
12
+ # script if set execuatable.
13
+
14
+ VERSIONS_SHELLS='/bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh'
15
+
16
+ #------------------------------------------------------------------------------
17
+ # functions
18
+ #
19
+
20
+ versions_osName()
21
+ {
22
+ os_name_='unrecognized'
23
+ os_system_=`uname -s`
24
+ case ${os_system_} in
25
+ Cygwin) os_name_='Cygwin' ;;
26
+ Darwin) os_name_='Mac OS X' ;;
27
+ Linux) os_name_='Linux' ;;
28
+ SunOS) os_name_='Solaris' ;;
29
+ esac
30
+ echo ${os_name_}
31
+ unset os_name_ os_system_
32
+ }
33
+
34
+ versions_osRelease()
35
+ {
36
+ os_str_='unrecognized'
37
+ os_system_=`uname -s`
38
+ os_release_=`uname -r`
39
+ case ${os_system_} in
40
+ Cygwin) os_str_='unknown' ;;
41
+ Darwin)
42
+ major_='10'
43
+ sub_=`echo ${os_release_} |\
44
+ sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*$/\1/'`
45
+ case ${os_release_} in
46
+ 8.*) minor_='4' ;;
47
+ 9.*) minor_='5' ;;
48
+ *) minor_='X'; sub_='X' ;;
49
+ esac
50
+ os_str_="${major_}.${minor_}.${sub_}"
51
+ ;;
52
+ Linux)
53
+ if [ -r '/etc/lsb-release' ]; then
54
+ os_str_=`. /etc/lsb-release && \
55
+ echo "${DISTRIB_ID:-}-${DISTRIB_RELEASE:-}"`
56
+ fi
57
+ if [ "${os_release_}" = '-' ]; then
58
+ os_str_=''
59
+ if [ -r '/etc/redhat-release' ]; then
60
+ os_str_=`cat /etc/redhat-release`
61
+ fi
62
+ fi
63
+ ;;
64
+ SunOS)
65
+ os_version_=`versions_osVersion`
66
+
67
+ os_str_=`echo ${os_release_} |sed 's/[0-9]*\.\([0-9]*\)/\1/'`
68
+ os_str_="${os_release_}-${os_version_}"
69
+ ;;
70
+ esac
71
+ echo ${os_str_}
72
+ unset os_name_ os_release_ os_str_ os_version_ major_ minor_ sub_
73
+ }
74
+
75
+ versions_osVersion()
76
+ {
77
+ uname -v
78
+ }
79
+
80
+ versions_shellVersion()
81
+ {
82
+ shell_=$1
83
+
84
+ if [ ! -x "${shell_}" ]; then
85
+ echo 'not installed'
86
+ return
87
+ fi
88
+
89
+ version_=''
90
+ case ${shell_} in
91
+ */sh)
92
+ # TODO(kward): fix this
93
+ ## this could be one of any number of shells. try until one fits.
94
+ #version_=`versions_shell_bash ${shell_}`
95
+ ## dash cannot be self determined yet
96
+ #[ -z "${version_}" ] && version_=`versions_shell_ksh ${shell_}`
97
+ ## pdksh is covered in versions_shell_ksh()
98
+ #[ -z "${version_}" ] && version_=`versions_shell_zsh ${shell_}`
99
+ ;;
100
+ */bash) version_=`versions_shell_bash ${shell_}` ;;
101
+ */dash)
102
+ # simply assuming Ubuntu Linux until somebody comes up with a better
103
+ # test. the following test will return an empty string if dash is not
104
+ # installed.
105
+ version_=`versions_shell_dash`
106
+ ;;
107
+ */ksh) version_=`versions_shell_ksh ${shell_}` ;;
108
+ */pdksh) version_=`versions_shell_pdksh ${shell_}` ;;
109
+ */zsh) version_=`versions_shell_zsh ${shell_}` ;;
110
+ *) version_='invalid'
111
+ esac
112
+
113
+ echo ${version_:-unknown}
114
+ unset shell_ version_
115
+ }
116
+
117
+ versions_shell_bash()
118
+ {
119
+ $1 --version 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/'
120
+ }
121
+
122
+ versions_shell_dash()
123
+ {
124
+ dpkg -l |grep ' dash ' |awk '{print $3}'
125
+ }
126
+
127
+ versions_shell_ksh()
128
+ {
129
+ versions_shell_=$1
130
+
131
+ versions_version_=`strings ${versions_shell_} 2>&1 \
132
+ |grep Version \
133
+ |sed 's/^.*Version \(.*\)$/\1/;s/ s+ \$$//;s/ /-/g'`
134
+ [ -z "${versions_version_}" ] \
135
+ && versions_version_=`versions_shell_pdksh ${versions_shell_}`
136
+ echo ${versions_version_}
137
+
138
+ unset versions_shell_ versions_version_
139
+ }
140
+
141
+ versions_shell_pdksh()
142
+ {
143
+ strings $1 2>&1 \
144
+ |grep 'PD KSH' \
145
+ |sed -e 's/.*PD KSH \(.*\)/\1/;s/ /-/g'
146
+ }
147
+
148
+ versions_shell_zsh()
149
+ {
150
+ echo 'echo ${ZSH_VERSION}' |$1
151
+ }
152
+
153
+ #------------------------------------------------------------------------------
154
+ # main
155
+ #
156
+
157
+ versions_main()
158
+ {
159
+ # treat unset variables as an error
160
+ set -u
161
+
162
+ os_name=`versions_osName`
163
+ os_version=`versions_osVersion`
164
+ echo "os: ${os_name} version: ${os_version}"
165
+
166
+ for shell in ${VERSIONS_SHELLS}; do
167
+ shell_version=`versions_shellVersion ${shell}`
168
+ echo "shell: ${shell} version: ${shell_version}"
169
+ done
170
+ }
171
+
172
+ if [ "`basename -- $0`" = 'versions' ]; then
173
+ versions_main "$@"
174
+ fi
data/sbin/ao ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ jason -- uses the jason bourne lib
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ jason
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/sbin/_treadstone"
14
+
15
+ require 'sub' "$BASH_SOURCE" "$@"
data/sbin/stub ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ jason -- uses the jason bourne lib
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ jason
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/sbin/_treadstone"
14
+
15
+ require 'sub' "$BASH_SOURCE" "$@"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_omega
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -28,38 +28,6 @@ dependencies:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0'
31
- - !ruby/object:Gem::Dependency
32
- name: grit
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: '0'
39
- type: :runtime
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: surface
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
31
  - !ruby/object:Gem::Dependency
64
32
  name: deep_merge
65
33
  requirement: !ruby/object:Gem::Requirement
@@ -136,36 +104,30 @@ files:
136
104
  - LICENSE
137
105
  - VERSION
138
106
  - README.mkd
139
- - libexec/activate
140
- - libexec/build
107
+ - libexec/ao
108
+ - libexec/ao-activate
109
+ - libexec/ao-build
110
+ - libexec/ao-check
111
+ - libexec/ao-compare
112
+ - libexec/ao-cook
113
+ - libexec/ao-deploy
114
+ - libexec/ao-dist
115
+ - libexec/ao-lock
116
+ - libexec/ao-migrate
117
+ - libexec/ao-plan
118
+ - libexec/ao-release
119
+ - libexec/ao-restart
120
+ - libexec/ao-rollback
121
+ - libexec/ao-shell
122
+ - libexec/ao-stage
123
+ - libexec/ao-task
124
+ - libexec/ao-unlock
141
125
  - libexec/build-gem
142
- - libexec/build.orig
143
126
  - libexec/bump
144
- - libexec/bump.orig
145
- - libexec/check
146
- - libexec/compare
147
- - libexec/config
148
- - libexec/debug
149
- - libexec/deploy
150
- - libexec/dist
151
- - libexec/dna
152
127
  - libexec/edit-gem
153
- - libexec/hosts
154
- - libexec/invoke
155
- - libexec/lock
156
- - libexec/migrate
157
- - libexec/plan
158
128
  - libexec/publish
159
129
  - libexec/publish-gem
160
- - libexec/release
161
- - libexec/repl
162
- - libexec/restart
163
- - libexec/rollback
164
- - libexec/shell
165
- - libexec/stage
166
130
  - libexec/stub-prepare
167
- - libexec/task
168
- - libexec/unlock
169
131
  - lib/alpha_omega/deploy/dependencies.rb
170
132
  - lib/alpha_omega/deploy/local_dependency.rb
171
133
  - lib/alpha_omega/deploy/remote_dependency.rb
@@ -181,6 +143,18 @@ files:
181
143
  - lib/alpha_omega/utils.rb
182
144
  - lib/alpha_omega/version.rb
183
145
  - lib/development.rb
146
+ - sbin/_bump
147
+ - sbin/_jason
148
+ - sbin/_log4sh
149
+ - sbin/_meat
150
+ - sbin/_prime
151
+ - sbin/_shflags
152
+ - sbin/_shunit
153
+ - sbin/_sub
154
+ - sbin/_treadstone
155
+ - sbin/_versions
156
+ - sbin/ao
157
+ - sbin/stub
184
158
  - bin/alpha_omega
185
159
  homepage: https://github.com/HeSYINUvSBZfxqA/alpha_omega
186
160
  licenses: []
data/libexec/activate DELETED
@@ -1,199 +0,0 @@
1
- #!/bin/bash -e
2
-
3
- export LOCAL_ONLY=
4
-
5
- case "$(basename $0)" in
6
- invoke)
7
- export COMMAND="$1"; shift
8
-
9
- if [[ -n $1 ]]; then
10
- set -- $(for a in "$@"; do echo $a.app; done)
11
- fi
12
-
13
- tmp_invoke=$(mktemp -t XXXXXXXXX)
14
- bundle exec cap "$@" invoke 2>&1 | perl -pe 's{.\[\d+m}{}g' | perl -ne 'm{^\s*\*+\s*\[(out|err)\s*::\s*([^]]+)\] ?(.*)} && print "$1 $2 $3\n"' > $tmp_invoke 2>&1
15
-
16
- cat $tmp_invoke | awk '{print $2}' | sort -u | while read -r nm_host; do
17
- egrep "^(out|err) $nm_host" $tmp_invoke || true
18
- echo
19
- done
20
- rm -f $tmp_invoke
21
- ;;
22
- *)
23
- if [[ -n $1 ]]; then
24
- set -- $(for a in "$@"; do echo $a; done)
25
- fi
26
-
27
- case "$(basename $0)" in
28
- debug)
29
- LOCAL_ONLY=true
30
- if [[ -z $1 ]]; then
31
- set "world"
32
- fi
33
-
34
- if [[ -n $1 ]]; then
35
- cap $(for a in "$@"; do echo $a.echo; done)
36
- fi
37
- ;;
38
-
39
- hosts)
40
- LOCAL_ONLY=true
41
- {
42
- if [[ -n $1 ]]; then
43
- cap $(for a in "$@"; do echo $a.echo; done)
44
- fi
45
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
46
- ;;
47
-
48
- dna)
49
- LOCAL_ONLY=true
50
- {
51
- echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
52
- if [[ -n $1 ]]; then
53
- cap $(for a in "$@"; do echo $a.yaml; done)
54
- fi
55
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
56
- ;;
57
-
58
- task)
59
- if [[ -n $1 ]]; then
60
- nm_task=$1; shift
61
- set -- $(for a in "$@"; do echo $a.app; done)
62
- fi
63
- bundle exec cap "$@" deploy:lock_migrate deploy:migrate "$nm_task"
64
- ;;
65
-
66
- *)
67
- if [[ -n $1 ]]; then
68
- set -- $(for a in "$@"; do echo $a.app; done)
69
- fi
70
- case "$(basename $0)" in
71
- deploy)
72
- bundle exec cap "$@" deploy:lock deploy
73
- ;;
74
-
75
- release)
76
- bundle exec cap "$@" deploy:lock deploy
77
- ;;
78
-
79
- stage)
80
- bundle exec cap "$@" deploy:lock deploy:update_code deploy:symlink_next
81
- ;;
82
-
83
- restart)
84
- bundle exec cap "$@" deploy:lock deploy:restart
85
- ;;
86
-
87
- config)
88
- bundle exec cap "$@" deploy:lock deploy:config
89
- ;;
90
-
91
- build)
92
- bundle exec cap "$@" deploy:lock deploy:build
93
- ;;
94
-
95
- dist)
96
- bundle exec cap "$@" deploy:lock deploy:dist
97
- ;;
98
-
99
- activate)
100
- bundle exec cap "$@" deploy:lock deploy:symlink deploy:restart
101
- ;;
102
-
103
- rollback)
104
- bundle exec cap "$@" deploy:lock deploy:rollback
105
- ;;
106
-
107
- check)
108
- bundle exec cap "$@" deploy:lock deploy:check
109
- ;;
110
-
111
- plan)
112
- bundle exec cap "$@" deploy:lock deploy:plan
113
- ;;
114
-
115
- lock)
116
- case "${1%.app}" in
117
- compare|migrate)
118
- nm_lock="${1%.app}"; shift
119
- bundle exec cap "$@" deploy:dont_unlock "deploy:lock_${nm_lock}"
120
- ;;
121
- *)
122
- bundle exec cap "$@" deploy:dont_unlock deploy:lock
123
- ;;
124
- esac
125
- ;;
126
-
127
- unlock)
128
- case "${1%.app}" in
129
- compare|migrate)
130
- nm_lock="${1%.app}"; shift
131
- bundle exec cap "$@" "deploy:unlock_${nm_lock}"
132
- ;;
133
- *)
134
- bundle exec cap "$@" deploy:unlock
135
- ;;
136
- esac
137
- ;;
138
-
139
- shell)
140
- bundle exec cap "$@" shell
141
- ;;
142
-
143
- compare)
144
- bundle exec cap "$@" deploy:lock_compare deploy:compare
145
- ;;
146
-
147
- repl)
148
- bundle exec cap "$@" deploy:lock_compare deploy:repl
149
- ;;
150
-
151
- migrate)
152
- want_list=
153
- if [[ "${1%.app}" = "list" ]]; then
154
- want_list=1; shift
155
- fi
156
-
157
- change_group=
158
- migration=
159
- case "${1%.app}" in
160
- data)
161
- change_group=${1%.app}; shift
162
- ;;
163
- pre)
164
- change_group=${1%.app}; shift
165
- ;;
166
- during)
167
- change_group=${1%.app} shift
168
- ;;
169
- post)
170
- change_group=${1%.app}; shift
171
- ;;
172
- [0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789])
173
- migration=${1%.app}; shift
174
- ;;
175
- esac
176
-
177
- if [[ -n $change_group ]]; then
178
- if [[ -n $want_list ]]; then
179
- echo "listing change group $change_group"
180
- else
181
- echo "running change group $change_group"
182
- fi
183
- elif [[ -n $migration ]]; then
184
- echo "running migration $migratio"
185
- elif [[ -n $want_list ]]; then
186
- echo "listing migrations"
187
- fi
188
-
189
- bundle exec cap "$@" deploy:lock_migrate deploy:migrate
190
- ;;
191
-
192
- *)
193
- bundle exec cap "$@"
194
- ;;
195
- esac
196
- esac
197
- ;;
198
- esac
199
-