diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-28 10:01:47 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-28 10:03:21 (GMT) |
commit | 7265563b8bb9fb9e74b5564fdc5dde5b7d68594a (patch) | |
tree | ecd6a6e9023668d8efe994071db56e9d5fe1b579 /commands | |
parent | 63ce28d67fe038a5a56493255f0a561d11357178 (diff) |
Move buildsnapshot and json-normalize in tools
Diffstat (limited to 'commands')
-rwxr-xr-x | commands/helpers/build-snapshot | 58 | ||||
-rwxr-xr-x | commands/helpers/json-normalize | 23 |
2 files changed, 0 insertions, 81 deletions
diff --git a/commands/helpers/build-snapshot b/commands/helpers/build-snapshot deleted file mode 100755 index 1bf525b..0000000 --- a/commands/helpers/build-snapshot +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -commandsdir=`dirname "$0"` -basedir=`dirname "$commandsdir"` - -if [ "$#" -eq 0 ]; then - echo "build-snapshot [destination directory]" - exit 1 -fi - -destdir=`dirname $1` -filename=`basename $1` -rootdir=sugar-snapshot - -mkdir -p $destdir -ln -s `pwd` $destdir/$rootdir - -cd $destdir - -tar chf $filename \ - $rootdir/config \ - $rootdir/devbot \ - $rootdir/install \ - $rootdir/commands/helpers/bashrc \ - $rootdir/commands/helpers/ubuntu-tweaks \ - $rootdir/commands/check-system \ - $rootdir/commands/common.py \ - $rootdir/commands/run \ - $rootdir/commands/shell - -rm $rootdir -mkdir $rootdir - -runsugarscript=$rootdir/run-sugar.sh - -cat > $runsugarscript << "EOF" -#!/bin/sh - -commands/run -EOF - -chmod +x $runsugarscript - -runshellscript=$rootdir/run-shell.sh - -cat > $runshellscript << "EOF" -#!/bin/sh - -commands/shell -EOF - -chmod +x $runshellscript - -tar rh -f $filename $runshellscript $runsugarscript - -rm -rf $rootdir - -xz $filename diff --git a/commands/helpers/json-normalize b/commands/helpers/json-normalize deleted file mode 100755 index ec6bd0f..0000000 --- a/commands/helpers/json-normalize +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/python - -import argparse -import json -from operator import itemgetter - -parser = argparse.ArgumentParser() -parser.add_argument("paths", nargs="+", help="path to the json file") -parser.add_argument("--sort-by", help="dictionary key to sort by") -args = parser.parse_args() - -for path in args.paths: - in_file = open(path, "rb") - data = json.load(in_file) - in_file.close() - - if args.sort_by is not None: - data.sort(key=itemgetter(args.sort_by)) - - out_file = open(path, "wb") - json.dump(data, out_file, sort_keys=True, indent=4) - out_file.write('\n') - out_file.close() |