diff --git a/client/cli/bam.py b/client/cli/bam.py index cd8edcb..be957a0 100755 --- a/client/cli/bam.py +++ b/client/cli/bam.py @@ -159,6 +159,14 @@ class bam_config: sort_keys=True, indent=4, separators=(',', ': '), ) + @staticmethod + def write_bamignore(cwd=None): + path = bam_config.find_rootdir(cwd=cwd) + if path: + filepath = os.path.join(path, ".bamignore") + with open(filepath, 'w') as f: + f.write(r".*\.blend\d+$") + @staticmethod def create_bamignore_filter(id_=".bamignore", cwd=None): path = bam_config.find_rootdir() @@ -328,6 +336,10 @@ class bam_commands: }, cwd=proj_dirname_abs) + # Create the default .bamignore + # TODO (fsiddi) get this data from the project config on the server + bam_config.write_bamignore(cwd=proj_dirname_abs) + print("Project %r initialized" % proj_dirname) @staticmethod diff --git a/tests/test_cli.py b/tests/test_cli.py index 06497a5..816d2f0 100755 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -715,6 +715,9 @@ class BamInitTest(BamSessionTestCase): self.assertEqual(url, cfg["url"]) self.assertEqual(user_name, cfg["user"]) + with open(os.path.join(proj_path, ".bamignore")) as f: + self.assertEqual(f.readline(), ".*\.blend\d+$") + class BamListTest(BamSessionTestCase): """Test for the `bam ls --json` command. We run it with --json for easier command