]> gitweb.fluxo.info Git - hydra.git/commitdiff
New hydra config action
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 17:24:04 +0000 (14:24 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 17:24:04 +0000 (14:24 -0300)
share/hydra/config [new file with mode: 0755]
share/hydra/sync

diff --git a/share/hydra/config b/share/hydra/config
new file mode 100755 (executable)
index 0000000..1b730b8
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Manipulate hydra configuration.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with this program.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+# Load.
+source $APP_BASE/lib/hydra/functions || exit 1
+hydra_config_load
+
+# Basic parameters.
+KEY="$1"
+shift
+VALUE="$*"
+
+# Dispatcher.
+if [ -z "$KEY" ]; then
+  (
+    cd $HYDRA_FOLDER/config
+    echo "Existing configuration:"
+    tree -I README.md
+  )
+elif [ -z "$VALUE" ]; then
+  if [ -e "$HYDRA_FOLDER/config/$KEY" ]; then
+    cat $HYDRA_FOLDER/config/$KEY
+  else
+    echo "No such config parameter $KEY."
+  fi
+else
+  echo "$VALUE" > $HYDRA_FOLDER/config/$KEY
+  hydra $HYDRA git config add $KEY
+  echo ""
+  echo "Configuration saved, please do the following to submit to remote repository:"
+  echo ""
+  echo "hydra $HYDRA git config commit -m \"Setting $KEY\""
+  echo "hydra $HYDRA git config push"
+fi
index 56eeeded438a206a7e7dbdebcb96bca95d3aa21f..d0b7dd872bbbedbb35841c146613cc1886cd8bda 100755 (executable)
@@ -19,6 +19,7 @@ source $APP_BASE/lib/hydra/functions || exit 1
 hydra_config_load
 
 # Sync each repository.
+# TODO: change from PRIVATE_REPOS to the new config scheme
 function hydra_sync {
   for repository in $*; do
     if [ "$repository" == "keyringer" ]; then