@@ -23,7 +23,7 @@ manifest.listInstalledGists () {
23
23
json " $__bash_suite_filesys /installation-manifest.json" ' $.fromGists ? console.table($.fromGists) : console.log("\tNone")'
24
24
echo ;
25
25
}
26
- manfiest .addGist () {
26
+ manifest .addGist () {
27
27
obj=` echo " { \" name\" : \" $1 \" , \" gistUrl\" : \" $2 \" , \" revision\" : $3 }" `
28
28
data=$( json " $__bash_suite_filesys /installation-manifest.json" "
29
29
// remove old references, and then add the new
@@ -33,19 +33,19 @@ manfiest.addGist () {
33
33
" )
34
34
echo " $data " > " $__bash_suite_filesys /installation-manifest.json"
35
35
}
36
- manfiest .getRegistryUrl () {
36
+ manifest .getRegistryUrl () {
37
37
json " $__bash_suite_filesys /installation-manifest.json" "
38
38
console.log((\$ ).registries['$1 '] || '')
39
39
"
40
40
}
41
- manfiest .removeGist () {
41
+ manifest .removeGist () {
42
42
data=$( json " $__bash_suite_filesys /installation-manifest.json" "
43
43
\$ .fromGists = \$ .fromGists.filter(x => x.name !== '$1 ');
44
44
console.log(JSON.stringify(\$ ))
45
45
" )
46
46
echo " $data " > " $__bash_suite_filesys /installation-manifest.json"
47
47
}
48
- manfiest .getGistUrl () {
48
+ manifest .getGistUrl () {
49
49
json " $__bash_suite_filesys /installation-manifest.json" "
50
50
let [gist] = \$ .fromGists.filter(x => x.name === '$1 ');
51
51
if (gist) console.log(gist.gistUrl)
@@ -160,7 +160,7 @@ elif [ "$1" == "docs" ] || [ "$1" == "man" ]; then
160
160
echo " Opening the BASHful Docs in your default browser"
161
161
open " $__docs "
162
162
else
163
- _url=$( manfiest .getGistUrl $2 ) # check for gist
163
+ _url=$( manifest .getGistUrl $2 ) # check for gist
164
164
if [ " $_url " == " " ]; then
165
165
_url=" $__docs /$2 .html" # must be native
166
166
fi
@@ -176,19 +176,43 @@ elif [ "$1" == "docs" ] || [ "$1" == "man" ]; then
176
176
# : Running `bashful update` will also update `bashful`
177
177
# :######################################################
178
178
elif [ " $1 " == " install" ] || [ " $1 " == " update" ] ; then
179
- cd " $__SELF__ " ;
180
-
181
179
if [ " $1 " == " update" ]; then
180
+ cd " $__TMP__ " ;
181
+ rm -rf bashful > /dev/null;
182
182
echo Gathering latest files from GitHub
183
- git pull > /dev/null;
183
+ git clone https://github.com/kyle-west/bashful;
184
+
185
+ # fail safe
186
+ [ $? -eq 0 ] || ( echo " Failed to connect to https://github.com/kyle-west/bashful" && exit 1 )
187
+
188
+ rm -rf " $__SELF__ "
189
+ cp -a bashful " $__SELF__ "
190
+
191
+ # copy RC and utils
192
+ cp " $__SELF__ /filesys/bashful.rc" " $__bash_suite_filesys /bashful.rc"
193
+ cp -a " $__SELF__ /filesys/utils" " $__bash_suite_filesys /utils"
194
+
195
+ # merge the registry files
196
+ data=$( json " $__SELF__ /filesys/registry.json" "
197
+ let defaultRegistry = \$ ;
198
+ let userRegistry = require('$__bash_suite_filesys /registry.json');
199
+ Object.keys(\$ .standard).forEach(package => {
200
+ userRegistry.standard[package] = defaultRegistry.standard[package]
201
+ })
202
+ console.log(JSON.stringify(userRegistry))
203
+ " )
204
+ echo " $data " > " $__bash_suite_filesys /registry.json"
205
+
206
+ source ~ /.bashful.filesys/bashful.rc
184
207
fi ;
185
208
209
+ cd " $__SELF__ " ;
186
210
for program in " ${@: 2} " ; do
187
211
echo " Installing '$program '"
188
212
if [ -f " bin/$program " ]; then
189
213
cp " bin/$program " " $__bash_suite_program_dir /"
190
214
else
191
- _url=$( manfiest .getGistUrl $program )
215
+ _url=$( manifest .getGistUrl $program )
192
216
if [ " $_url " != " " ]; then
193
217
bashful gist install " $_url " ;
194
218
else
@@ -212,7 +236,7 @@ elif [ "$1" == "uninstall" ]; then
212
236
if [ " $program " != ' bashful' ]; then
213
237
echo " Uninstalling '$program '"
214
238
rm " $__bash_suite_program_dir /$program "
215
- manfiest .removeGist $program
239
+ manifest .removeGist $program
216
240
else
217
241
echo " Cannot uninstall '$program '. Use 'bashful uninstall --remove-suite' if you mean to uninstall the entire BASHful Suite"
218
242
fi
@@ -232,7 +256,7 @@ elif [ "$1" == "gist" ]; then
232
256
if [ " $2 " == " add" ]; then
233
257
registry.addRegistryList $3
234
258
elif [ " $2 " == " update-registry" ]; then
235
- _url=` manfiest .getRegistryUrl $3 `
259
+ _url=` manifest .getRegistryUrl $3 `
236
260
registry.addRegistryList " $_url "
237
261
elif [ " $2 " == " info" ]; then
238
262
registry.query $3
@@ -263,7 +287,7 @@ elif [ "$1" == "gist" ]; then
263
287
echo ;
264
288
cd ../;
265
289
rm -rf " $gist_hash " ;
266
- manfiest .addGist $file $_url ` getGistVersion $_url `
290
+ manifest .addGist $file $_url ` getGistVersion $_url `
267
291
fi
268
292
269
293
# bashful help
0 commit comments