Repository: zulip/zulip

Issue:
Split out a tools/setup from tools/ to decrease clutter
We now have a bunch of tools under `tools`, many of which are only used as part of the development environment setup process.  It probably makes sense to move a bunch of those into a `setup/` subdirectory to both make their purpose more clear and clean up the directory of commands one is unlikely to run.  Good targets include:
- download-zxcvbn
- generate-test-credentials
- generate-fixtures
- postgres-init-dev-db
- postgres-init-test-db
- setup-git-repo
- emoji_dump
- install-phantomjs
- py3_test_reqs.txt

If someone's going to work on this, please do 1 commit per command so it's easy to review and read, and please use `grep` to confirm you updated all references to the relevant command.



Discussion:
@timabbott working on this now.


Resolving patch:
diff --git a/provision.py b/provision.py
--- a/provision.py
+++ b/provision.py
@@ -146,7 +146,8 @@ def main():
     run(["wget", "-O", temp_deb_path, TSEARCH_URL])
     run(["sudo", "dpkg", "--install", temp_deb_path])
 
-    setup_virtualenv(PY3_VENV_PATH, os.path.join(ZULIP_PATH, "tools", "py3_test_reqs.txt"),
+    setup_virtualenv(PY3_VENV_PATH,
+                     os.path.join(ZULIP_PATH, "tools", "setup", "py3_test_reqs.txt"),
                      virtualenv_args=['-p', 'python3'])
     setup_virtualenv(VENV_PATH, os.path.join(ZULIP_PATH, "requirements.txt"))
 
@@ -164,11 +165,11 @@ def main():
     os.chdir(ZULIP_PATH)
 
     if "--travis" in sys.argv:
-        run(["tools/install-phantomjs", "--travis"])
+        run(["tools/setup/install-phantomjs", "--travis"])
     else:
-        run(["tools/install-phantomjs"])
-    run(["tools/download-zxcvbn"])
-    run(["tools/emoji_dump/build_emoji"])
+        run(["tools/setup/install-phantomjs"])
+    run(["tools/setup/download-zxcvbn"])
+    run(["tools/setup/emoji_dump/build_emoji"])
     run(["scripts/setup/generate_secrets.py", "-d"])
     if "--travis" in sys.argv:
         run(["sudo", "service", "rabbitmq-server", "restart"])
@@ -181,9 +182,9 @@ def main():
         run(["sudo", "service", "redis-server", "restart"])
         run(["sudo", "service", "memcached", "restart"])
     run(["scripts/setup/configure-rabbitmq"])
-    run(["tools/postgres-init-dev-db"])
+    run(["tools/setup/postgres-init-dev-db"])
     run(["tools/do-destroy-rebuild-database"])
-    run(["tools/postgres-init-test-db"])
+    run(["tools/setup/postgres-init-test-db"])
     run(["tools/do-destroy-rebuild-test-database"])
     run(["python", "./manage.py", "compilemessages"])
     # Install the latest npm.
diff --git a/tools/emoji_dump/emoji_dump.py b/tools/setup/emoji_dump/emoji_dump.py
similarity index 100%
rename from tools/emoji_dump/emoji_dump.py
rename to tools/setup/emoji_dump/emoji_dump.py


Test patch:
diff --git a/frontend_tests/run-casper b/frontend_tests/run-casper
--- a/frontend_tests/run-casper
+++ b/frontend_tests/run-casper
@@ -36,9 +36,9 @@ for file in args:
 
 os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
 
-subprocess.check_call('tools/generate-fixtures')
+subprocess.check_call('tools/setup/generate-fixtures')
 
-subprocess.check_call('tools/generate-test-credentials')
+subprocess.check_call('tools/setup/generate-test-credentials')
 
 subprocess.check_call(['rm', '-f'] + glob.glob('/tmp/casper-failure*.png'))
 
diff --git a/tools/py3_test_reqs.txt b/tools/setup/py3_test_reqs.txt
similarity index 100%
rename from tools/py3_test_reqs.txt
rename to tools/setup/py3_test_reqs.txt