Skip to content

Commit 77cdb5e

Browse files
authored
Merge pull request #6 from oda-hub/gitignore-list-files
Gitignore list files
2 parents ab841b1 + 034043d commit 77cdb5e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.3
1+
0.0.4

renkuaqsannotation/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ def _ignore_nb2workflow():
3535

3636
logging.debug("Ignoring nb2workflow automatically generated folder and files")
3737

38-
gitignore_file("**.nb2workflow**")
39-
gitignore_file("function.xml")
38+
gitignore_file("**.nb2workflow**", "function.xml")
4039

4140

4241
def _check_renku_version():

renkuaqsannotation/io_utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
from git import Repo
44

55

6-
def gitignore_file(file_name):
6+
def gitignore_file(*args):
77
if os.path.exists('.gitignore'):
88
with open('.gitignore') as gitignore_file_lines:
99
lines = gitignore_file_lines.readlines()
10-
if file_name + "\n" not in lines:
11-
lines.append(file_name + "\n")
10+
lines_to_add = []
11+
for file_name in args:
12+
if file_name + "\n" not in lines:
13+
lines.append(file_name + "\n")
14+
lines_to_add.append(file_name)
15+
16+
if len(lines_to_add) > 0:
17+
commit_msg = ", ".join(lines_to_add) + " files added to the .gitignore file"
1218
with open(".gitignore", "w") as gitignore_file_write:
1319
gitignore_file_write.writelines(lines)
14-
commit_msg = f"{file_name} added to the .gitignore file"
1520
repo = Repo('.')
1621
repo.index.add(".gitignore")
1722
repo.index.commit(commit_msg)

0 commit comments

Comments
 (0)