alpha_omega 0.0.113 → 0.0.114

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.113
1
+ 0.0.114
data/bin/alpha_omega CHANGED
@@ -4,8 +4,9 @@ search = $:.inject([]) {|acc,d| acc.concat(["#{d}/libexec", "#{File.dirname(d)}/
4
4
 
5
5
  script = search.collect {|f| "#{f}/#{File.basename(ARGV[0])}" }.find {|f| File.exists? f }
6
6
 
7
- if script
8
- system(script, *ARGV[1..-1])
9
- else
7
+ unless script
10
8
  puts "ERROR: can't find script #{File.basename(ARGV[0])}"
9
+ exit 1
11
10
  end
11
+
12
+ system(script, *ARGV[1..-1])
data/libexec/activate CHANGED
@@ -10,153 +10,183 @@ if ! echo "$hst_this" | egrep -q "^(admin|develop)"; then
10
10
  fi
11
11
  fi
12
12
 
13
- case "$(basename $0)" in
14
- debug)
15
- export LOCAL_ONLY=true
13
+ export LOCAL_ONLY=true
16
14
 
17
- {
18
- cap $(for a in "$@"; do echo $a.echo; done)
19
- }
20
- ;;
15
+ default_pod=$(cat /etc/podname 2>&- || true)
21
16
 
22
- hosts)
23
- export LOCAL_ONLY=true
17
+ case "$(basename $0)" in
18
+ invoke)
19
+ export COMMAND="$1"; shift
24
20
 
25
- {
26
- cap $(for a in "$@"; do echo $a.echo; done)
27
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
28
- ;;
21
+ if [[ -n $1 ]]; then
22
+ set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default.app"; else echo $a.app; fi; done)
23
+ fi
29
24
 
30
- dna)
31
- export LOCAL_ONLY=true
25
+ LOCAL_ONLY=
26
+ tmp_invoke=$(mktemp -t XXXXXXXXX)
27
+ 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
32
28
 
33
- {
34
- echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
35
- cap $(for a in "$@"; do echo $a.yaml; done)
36
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
29
+ cat $tmp_invoke | awk '{print $2}' | sort -u | while read -r nm_host; do
30
+ egrep "^(out|err) $nm_host" $tmp_invoke || true
31
+ echo
32
+ done
33
+ rm -f $tmp_invoke
37
34
  ;;
35
+ *)
36
+ if [[ -n $1 ]]; then
37
+ set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default"; else echo $a; fi; done)
38
+ fi
38
39
 
39
- bump)
40
- case "$1" in
41
- patch|minor|major)
42
- bump=$1; shift
43
- set $(cat VERSION | sed 's#\.# #g')
44
- case "$bump" in
45
- patch)
46
- echo "$1.$2.$(($3 + 1))"
47
- ;;
48
- minor)
49
- echo "$1.$(($2 + 1)).0"
50
- ;;
51
- major)
52
- echo "$(($1 + 1)).0.0"
53
- ;;
54
- esac > VERSION
55
- ;;
56
- *)
57
- ver_new=$1; shift
58
- set $(echo "$ver_new" | sed 's#\.# #g') 0
59
- M=$1; shift
60
- m=$1; shift
61
- p=$1; shift
62
-
63
- tmp_version=$(mktemp -t XXXXXXXXX)
64
- (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
65
- ver_new_same=$(cat $tmp_version)
66
- rm -f $tmp_version
67
-
68
- if [[ $ver_new = $ver_new_same ]]; then
69
- echo "$ver_new" > VERSION
70
- else
71
- echo "ERROR: invalid version: $ver_new" 1>&2
72
- exit 1
40
+ case "$(basename $0)" in
41
+ debug)
42
+ if [[ -z $1 ]]; then
43
+ set "world"
44
+ fi
45
+
46
+ if [[ -n $1 ]]; then
47
+ cap $(for a in "$@"; do echo $a.echo; done)
73
48
  fi
74
49
  ;;
75
- esac
76
50
 
77
- if [[ -f Gemfile ]]; then
78
- bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
79
- git add Gemfile.lock
80
- fi
51
+ hosts)
52
+ {
53
+ if [[ -n $1 ]]; then
54
+ cap $(for a in "$@"; do echo $a.echo; done)
55
+ fi
56
+ } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
57
+ ;;
58
+
59
+ dna)
60
+ {
61
+ echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
62
+ if [[ -n $1 ]]; then
63
+ cap $(for a in "$@"; do echo $a.yaml; done)
64
+ fi
65
+ } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
66
+ ;;
67
+
68
+ bump)
69
+ case "$1" in
70
+ patch|minor|major)
71
+ bump=$1; shift
72
+ set $(cat VERSION | sed 's#\.# #g')
73
+ case "$bump" in
74
+ patch)
75
+ echo "$1.$2.$(($3 + 1))"
76
+ ;;
77
+ minor)
78
+ echo "$1.$(($2 + 1)).0"
79
+ ;;
80
+ major)
81
+ echo "$(($1 + 1)).0.0"
82
+ ;;
83
+ esac > VERSION
84
+ ;;
85
+ *)
86
+ ver_new=$1; shift
87
+ set $(echo "$ver_new" | sed 's#\.# #g') 0
88
+ M=$1; shift
89
+ m=$1; shift
90
+ p=$1; shift
91
+
92
+ tmp_version=$(mktemp -t XXXXXXXXX)
93
+ (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
94
+ ver_new_same=$(cat $tmp_version)
95
+ rm -f $tmp_version
96
+
97
+ if [[ $ver_new = $ver_new_same ]]; then
98
+ echo "$ver_new" > VERSION
99
+ else
100
+ echo "ERROR: invalid version: $ver_new" 1>&2
101
+ exit 1
102
+ fi
103
+ ;;
104
+ esac
81
105
 
82
- git add VERSION
106
+ if [[ -f Gemfile ]]; then
107
+ bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
108
+ git add Gemfile.lock
109
+ fi
83
110
 
84
- ver_bumped=$(cat VERSION)
85
- git commit -m "bump: $ver_bumped"
86
- git tag "v$ver_bumped"
87
- echo $ver_bumped
88
- ;;
111
+ git add VERSION
89
112
 
90
- *)
91
- set $(for a in "$@"; do echo $a.app; done)
92
- case "$(basename $0)" in
93
- deploy)
94
- bundle exec cap "$@" deploy
113
+ ver_bumped=$(cat VERSION)
114
+ git commit -m "bump: $ver_bumped"
115
+ git tag "v$ver_bumped"
116
+ echo $ver_bumped
95
117
  ;;
96
118
 
97
- release)
98
- bundle exec cap "$@" deploy
99
- ;;
119
+ *)
120
+ LOCAL_ONLY=
121
+ if [[ -n $1 ]]; then
122
+ set $(for a in "$@"; do echo $a.app; done)
123
+ fi
124
+ case "$(basename $0)" in
125
+ deploy)
126
+ bundle exec cap "$@" deploy
127
+ ;;
100
128
 
101
- stage)
102
- bundle exec cap "$@" deploy:update_code
103
- ;;
129
+ release)
130
+ bundle exec cap "$@" deploy
131
+ ;;
104
132
 
105
- restart)
106
- bundle exec cap "$@" deploy:restart
107
- ;;
133
+ stage)
134
+ bundle exec cap "$@" deploy:update_code
135
+ ;;
108
136
 
109
- config)
110
- bundle exec cap "$@" deploy:config
111
- ;;
137
+ restart)
138
+ bundle exec cap "$@" deploy:restart
139
+ ;;
112
140
 
113
- build)
114
- bundle exec cap "$@" deploy:build
115
- ;;
141
+ config)
142
+ bundle exec cap "$@" deploy:config
143
+ ;;
116
144
 
117
- dist)
118
- bundle exec cap "$@" deploy:dist
119
- ;;
145
+ build)
146
+ bundle exec cap "$@" deploy:build
147
+ ;;
120
148
 
121
- activate)
122
- bundle exec cap "$@" deploy:symlink deploy:restart
123
- ;;
149
+ dist)
150
+ bundle exec cap "$@" deploy:dist
151
+ ;;
124
152
 
125
- rollback)
126
- bundle exec cap "$@" deploy:rollback
127
- ;;
153
+ activate)
154
+ bundle exec cap "$@" deploy:symlink deploy:restart
155
+ ;;
128
156
 
129
- check)
130
- bundle exec cap "$@" deploy:check
131
- ;;
157
+ rollback)
158
+ bundle exec cap "$@" deploy:rollback
159
+ ;;
132
160
 
133
- compare)
134
- bundle exec cap "$@" deploy:compare
135
- ;;
161
+ check)
162
+ bundle exec cap "$@" deploy:check
163
+ ;;
136
164
 
137
- plan)
138
- bundle exec cap "$@" deploy:plan
139
- ;;
165
+ compare)
166
+ bundle exec cap "$@" deploy:compare
167
+ ;;
140
168
 
141
- lock)
142
- bundle exec cap "$@" deploy:lock
143
- ;;
169
+ plan)
170
+ bundle exec cap "$@" deploy:plan
171
+ ;;
144
172
 
145
- unlock)
146
- bundle exec cap "$@" deploy:unlock
147
- ;;
173
+ lock)
174
+ bundle exec cap "$@" deploy:lock
175
+ ;;
148
176
 
149
- invoke)
150
- bundle exec cap "$@" invoke
151
- ;;
177
+ unlock)
178
+ bundle exec cap "$@" deploy:unlock
179
+ ;;
152
180
 
153
- shell)
154
- bundle exec cap "$@" shell
155
- ;;
181
+ shell)
182
+ bundle exec cap "$@" shell
183
+ ;;
156
184
 
157
- *)
158
- bundle exec cap "$@"
159
- ;;
160
- esac
185
+ *)
186
+ bundle exec cap "$@"
187
+ ;;
188
+ esac
189
+ esac
190
+ ;;
161
191
  esac
162
192
 
data/libexec/build CHANGED
@@ -10,153 +10,183 @@ if ! echo "$hst_this" | egrep -q "^(admin|develop)"; then
10
10
  fi
11
11
  fi
12
12
 
13
- case "$(basename $0)" in
14
- debug)
15
- export LOCAL_ONLY=true
13
+ export LOCAL_ONLY=true
16
14
 
17
- {
18
- cap $(for a in "$@"; do echo $a.echo; done)
19
- }
20
- ;;
15
+ default_pod=$(cat /etc/podname 2>&- || true)
21
16
 
22
- hosts)
23
- export LOCAL_ONLY=true
17
+ case "$(basename $0)" in
18
+ invoke)
19
+ export COMMAND="$1"; shift
24
20
 
25
- {
26
- cap $(for a in "$@"; do echo $a.echo; done)
27
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
28
- ;;
21
+ if [[ -n $1 ]]; then
22
+ set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default.app"; else echo $a.app; fi; done)
23
+ fi
29
24
 
30
- dna)
31
- export LOCAL_ONLY=true
25
+ LOCAL_ONLY=
26
+ tmp_invoke=$(mktemp -t XXXXXXXXX)
27
+ 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
32
28
 
33
- {
34
- echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
35
- cap $(for a in "$@"; do echo $a.yaml; done)
36
- } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
29
+ cat $tmp_invoke | awk '{print $2}' | sort -u | while read -r nm_host; do
30
+ egrep "^(out|err) $nm_host" $tmp_invoke || true
31
+ echo
32
+ done
33
+ rm -f $tmp_invoke
37
34
  ;;
35
+ *)
36
+ if [[ -n $1 ]]; then
37
+ set $(for a in "$@"; do if [[ $default_pod = $a ]]; then echo "default"; else echo $a; fi; done)
38
+ fi
38
39
 
39
- bump)
40
- case "$1" in
41
- patch|minor|major)
42
- bump=$1; shift
43
- set $(cat VERSION | sed 's#\.# #g')
44
- case "$bump" in
45
- patch)
46
- echo "$1.$2.$(($3 + 1))"
47
- ;;
48
- minor)
49
- echo "$1.$(($2 + 1)).0"
50
- ;;
51
- major)
52
- echo "$(($1 + 1)).0.0"
53
- ;;
54
- esac > VERSION
55
- ;;
56
- *)
57
- ver_new=$1; shift
58
- set $(echo "$ver_new" | sed 's#\.# #g') 0
59
- M=$1; shift
60
- m=$1; shift
61
- p=$1; shift
62
-
63
- tmp_version=$(mktemp -t XXXXXXXXX)
64
- (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
65
- ver_new_same=$(cat $tmp_version)
66
- rm -f $tmp_version
67
-
68
- if [[ $ver_new = $ver_new_same ]]; then
69
- echo "$ver_new" > VERSION
70
- else
71
- echo "ERROR: invalid version: $ver_new" 1>&2
72
- exit 1
40
+ case "$(basename $0)" in
41
+ debug)
42
+ if [[ -z $1 ]]; then
43
+ set "world"
44
+ fi
45
+
46
+ if [[ -n $1 ]]; then
47
+ cap $(for a in "$@"; do echo $a.echo; done)
73
48
  fi
74
49
  ;;
75
- esac
76
50
 
77
- if [[ -f Gemfile ]]; then
78
- bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
79
- git add Gemfile.lock
80
- fi
51
+ hosts)
52
+ {
53
+ if [[ -n $1 ]]; then
54
+ cap $(for a in "$@"; do echo $a.echo; done)
55
+ fi
56
+ } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
57
+ ;;
58
+
59
+ dna)
60
+ {
61
+ echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
62
+ if [[ -n $1 ]]; then
63
+ cap $(for a in "$@"; do echo $a.yaml; done)
64
+ fi
65
+ } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
66
+ ;;
67
+
68
+ bump)
69
+ case "$1" in
70
+ patch|minor|major)
71
+ bump=$1; shift
72
+ set $(cat VERSION | sed 's#\.# #g')
73
+ case "$bump" in
74
+ patch)
75
+ echo "$1.$2.$(($3 + 1))"
76
+ ;;
77
+ minor)
78
+ echo "$1.$(($2 + 1)).0"
79
+ ;;
80
+ major)
81
+ echo "$(($1 + 1)).0.0"
82
+ ;;
83
+ esac > VERSION
84
+ ;;
85
+ *)
86
+ ver_new=$1; shift
87
+ set $(echo "$ver_new" | sed 's#\.# #g') 0
88
+ M=$1; shift
89
+ m=$1; shift
90
+ p=$1; shift
91
+
92
+ tmp_version=$(mktemp -t XXXXXXXXX)
93
+ (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
94
+ ver_new_same=$(cat $tmp_version)
95
+ rm -f $tmp_version
96
+
97
+ if [[ $ver_new = $ver_new_same ]]; then
98
+ echo "$ver_new" > VERSION
99
+ else
100
+ echo "ERROR: invalid version: $ver_new" 1>&2
101
+ exit 1
102
+ fi
103
+ ;;
104
+ esac
81
105
 
82
- git add VERSION
106
+ if [[ -f Gemfile ]]; then
107
+ bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
108
+ git add Gemfile.lock
109
+ fi
83
110
 
84
- ver_bumped=$(cat VERSION)
85
- git commit -m "bump: $ver_bumped"
86
- git tag "v$ver_bumped"
87
- echo $ver_bumped
88
- ;;
111
+ git add VERSION
89
112
 
90
- *)
91
- set $(for a in "$@"; do echo $a.app; done)
92
- case "$(basename $0)" in
93
- deploy)
94
- bundle exec cap "$@" deploy
113
+ ver_bumped=$(cat VERSION)
114
+ git commit -m "bump: $ver_bumped"
115
+ git tag "v$ver_bumped"
116
+ echo $ver_bumped
95
117
  ;;
96
118
 
97
- release)
98
- bundle exec cap "$@" deploy
99
- ;;
119
+ *)
120
+ LOCAL_ONLY=
121
+ if [[ -n $1 ]]; then
122
+ set $(for a in "$@"; do echo $a.app; done)
123
+ fi
124
+ case "$(basename $0)" in
125
+ deploy)
126
+ bundle exec cap "$@" deploy
127
+ ;;
100
128
 
101
- stage)
102
- bundle exec cap "$@" deploy:update_code
103
- ;;
129
+ release)
130
+ bundle exec cap "$@" deploy
131
+ ;;
104
132
 
105
- restart)
106
- bundle exec cap "$@" deploy:restart
107
- ;;
133
+ stage)
134
+ bundle exec cap "$@" deploy:update_code
135
+ ;;
108
136
 
109
- config)
110
- bundle exec cap "$@" deploy:config
111
- ;;
137
+ restart)
138
+ bundle exec cap "$@" deploy:restart
139
+ ;;
112
140
 
113
- build)
114
- bundle exec cap "$@" deploy:build
115
- ;;
141
+ config)
142
+ bundle exec cap "$@" deploy:config
143
+ ;;
116
144
 
117
- dist)
118
- bundle exec cap "$@" deploy:dist
119
- ;;
145
+ build)
146
+ bundle exec cap "$@" deploy:build
147
+ ;;
120
148
 
121
- activate)
122
- bundle exec cap "$@" deploy:symlink deploy:restart
123
- ;;
149
+ dist)
150
+ bundle exec cap "$@" deploy:dist
151
+ ;;
124
152
 
125
- rollback)
126
- bundle exec cap "$@" deploy:rollback
127
- ;;
153
+ activate)
154
+ bundle exec cap "$@" deploy:symlink deploy:restart
155
+ ;;
128
156
 
129
- check)
130
- bundle exec cap "$@" deploy:check
131
- ;;
157
+ rollback)
158
+ bundle exec cap "$@" deploy:rollback
159
+ ;;
132
160
 
133
- compare)
134
- bundle exec cap "$@" deploy:compare
135
- ;;
161
+ check)
162
+ bundle exec cap "$@" deploy:check
163
+ ;;
136
164
 
137
- plan)
138
- bundle exec cap "$@" deploy:plan
139
- ;;
165
+ compare)
166
+ bundle exec cap "$@" deploy:compare
167
+ ;;
140
168
 
141
- lock)
142
- bundle exec cap "$@" deploy:lock
143
- ;;
169
+ plan)
170
+ bundle exec cap "$@" deploy:plan
171
+ ;;
144
172
 
145
- unlock)
146
- bundle exec cap "$@" deploy:unlock
147
- ;;
173
+ lock)
174
+ bundle exec cap "$@" deploy:lock
175
+ ;;
148
176
 
149
- invoke)
150
- bundle exec cap "$@" invoke
151
- ;;
177
+ unlock)
178
+ bundle exec cap "$@" deploy:unlock
179
+ ;;
152
180
 
153
- shell)
154
- bundle exec cap "$@" shell
155
- ;;
181
+ shell)
182
+ bundle exec cap "$@" shell
183
+ ;;
156
184
 
157
- *)
158
- bundle exec cap "$@"
159
- ;;
160
- esac
185
+ *)
186
+ bundle exec cap "$@"
187
+ ;;
188
+ esac
189
+ esac
190
+ ;;
161
191
  esac
162
192