Skip to content

Commit

Permalink
Improved implicit ignores.
Browse files Browse the repository at this point in the history
 - Now ignores *~ and #*# files (closes #179).
 - Ignore all shed upload and shed download files (now that these are patterned).
  • Loading branch information
jmchilton committed May 6, 2015
1 parent 8117e03 commit 66a5166
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions planemo/shed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@
# Planemo generated or consumed files that do not need to be uploaded to the
# tool shed.
PLANEMO_FILES = [
"shed_upload.tar.gz",
"shed_upload*.tar.gz",
"shed_download*.tar.gz",
"tool_test_output.json",
"tool_test_output.html",
".travis",
".travis.yml",
".shed.yml"
".shed.yml",
"*~",
"#*#",
]
SHED_SHORT_NAMES = {
"toolshed": "https://toolshed.g2.bx.psu.edu/",
Expand Down Expand Up @@ -830,8 +833,10 @@ def _implicit_ignores(self, relative_path):
name = os.path.basename(relative_path)
if relative_path.startswith(".git"):
return True
elif name in PLANEMO_FILES:
return True

for pattern in PLANEMO_FILES:
if fnmatch.fnmatch(name, pattern):
return True
return False

RealizedFiles = namedtuple("RealizedFiles", ["files", "include_failures"])
Expand Down
3 changes: 3 additions & 0 deletions tests/test_shed_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ def test_upload_filters_git(self):
index_path = join(mock_git_dir, "index_file")
with open(index_path, "w") as index_f:
index_f.write("test")
with open(join(f, "related_file~"), "w") as tilde_f:
tilde_f.write("backup!")
upload_command = ["shed_upload", "--force_repository_creation"]
upload_command.extend(self._shed_args())
self._check_exit_code(upload_command)
target = self._verify_upload(f)
assert not exists(join(target, ".git"))
assert not exists(join(target, "related_file~"))

def test_upload_filters_invalid_package(self):
with self._isolate_repo("package_1") as f:
Expand Down

0 comments on commit 66a5166

Please sign in to comment.