Anonymous avatar Anonymous committed f923ad4

hacks for automated rebuilds

Comments (0)

Files changed (3)

+export REPO_PATH=/var/tmp/repo
+export ADMIN_USER=admin
+export ADMIN_PASS=admin1
+export ADMIN_EMAIL=$(whoami)@$(hostname)
+ini=rc.ini                      # change as you like
+db=rhodecode.db                 # not easily changeable
+set -o errexit
+die() { echo "*** $*" >&2; exit 1; }
+status() { echo "+++ $*"; }
+# A little mollyguard for this dangerous script
+[[ "$DO_IT" = "totallydude" ]] || die "You didn't say the magic word.  Read the source."
+[[ -z "$VIRTUAL_ENV" ]] && die "virtualenv not detected -- aborted"
+[[ -d "$VIRTUAL_ENV" ]] || die "virtualenv $VIRTUAL_ENV not present -- aborted"
+python develop
+rm -f $ini $db
+mkdir -p $REPO_PATH
+paster make-config RhodeCode $ini
+paster setup-app $ini
+echo ""
+status "Admin login is $ADMIN_USER/$ADMIN_PASS"
+status "Admin email is $ADMIN_EMAIL"
+echo ""


-    def admin_prompt(self, second=False):
-        if not self.tests:
+    def admin_prompt(self, second=False, username=None, password=None, email=None):
+        # XXX HACK silent setup for fast rebuilds without relying on test suite
+        if username is None: username = os.environ.get('ADMIN_USER')
+        if password is None: password = os.environ.get('ADMIN_PASS')
+        if email is None: email = os.environ.get('ADMIN_EMAIL')
+        if None not in (username, password, email):
+            self.create_user(username, password, email, True)
+        elif not self.tests:
             import getpass
             def get_password():
                 log.debug('missing default permission for group %s adding' % g)
-    def config_prompt(self, test_repo_path='', retries=3):
+    def config_prompt(self, test_repo_path=None, retries=3):
+        # XXX HACK for automated setup outside of test environmen
+        if test_repo_path is None: test_repo_path = os.environ.get('REPO_PATH')
         if retries == 3:
   'Setting up repositories config')


 def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
     while True:
-        ok = raw_input(prompt)
+        # XXX HACK for auto-answering
+        ok = os.environ.get('PROMPT_ANSWER') or raw_input(prompt)
         if ok in ('y', 'ye', 'yes'):
             return True
         if ok in ('n', 'no', 'nop', 'nope'):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.