Adding a default .bamignore to every new session
This commit is contained in:
@@ -159,6 +159,14 @@ class bam_config:
|
|||||||
sort_keys=True, indent=4, separators=(',', ': '),
|
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
|
@staticmethod
|
||||||
def create_bamignore_filter(id_=".bamignore", cwd=None):
|
def create_bamignore_filter(id_=".bamignore", cwd=None):
|
||||||
path = bam_config.find_rootdir()
|
path = bam_config.find_rootdir()
|
||||||
@@ -328,6 +336,10 @@ class bam_commands:
|
|||||||
},
|
},
|
||||||
cwd=proj_dirname_abs)
|
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)
|
print("Project %r initialized" % proj_dirname)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@@ -715,6 +715,9 @@ class BamInitTest(BamSessionTestCase):
|
|||||||
self.assertEqual(url, cfg["url"])
|
self.assertEqual(url, cfg["url"])
|
||||||
self.assertEqual(user_name, cfg["user"])
|
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):
|
class BamListTest(BamSessionTestCase):
|
||||||
"""Test for the `bam ls --json` command. We run it with --json for easier command
|
"""Test for the `bam ls --json` command. We run it with --json for easier command
|
||||||
|
Reference in New Issue
Block a user