Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

implementation: Test for symlinked files #12

Merged
merged 1 commit into from
Jan 2, 2017
Merged

implementation: Test for symlinked files #12

merged 1 commit into from
Jan 2, 2017

Conversation

petertseng
Copy link
Member

@petertseng petertseng commented Nov 30, 2016

We have a use case in exercism/haskell#442
where we would like to symlink files.

We have one common file that will get delivered with each exercise, and
we would only like to have to maintain one instance of it in the repo,
while symlinking it into all exercise directories.

This is a separate case than https://github.com/exercism/x-api/issues/29
because that talks about files that are not associated with any
particular exercise - their destination is a directory outside of any
exercise directory, whereas our destination is inside each exercise
directory.

For this case to work for us, we need trackler to correctly follow
symlinks present in an implementation. It currently does. In adding this
test, we request that this behaviour in the face of a symlink not
change in future trackler versions, for we have started to depend on it
as of exercism/haskell#443

implementation = Trackler::Implementation.new('animal', URL, problem, PATH)

expected = "This should get included in fish.\n"
assert_equal expected, archive_contents(implementation.zip, 'included-via-symlink.txt')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing it via the archive is redundant, you should be able to do:
assert_equal expected, implementation.files['included-via-symlink.txt']

@@ -0,0 +1 @@
This should get included in fish.
Copy link
Contributor

@Insti Insti Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the directory common or shared or .meta rather than symlinks ?

It would be good to be able to standardise across tracks, and it could be good to indicate that this is not an implementation directory. So my preference is probably for .meta matching the ignored directory name within an implementation. See: #4

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose shared.

Never mind, I chose .meta.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could maybe call it .meta/shared in the track repository, that's completely up to you.
Having it be just .meta in the test seems reasonable.

@@ -91,4 +99,13 @@ def archive_filenames(zip)
end
files
end

def archive_contents(zip, filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unneeded now.

We have a use case in exercism/haskell#442
where we would like to symlink files.

We have one common file that will get delivered with each exercise, and
we would only like to have to maintain one instance of it in the repo,
while symlinking it into all exercise directories.

This is a separate case than https://github.com/exercism/x-api/issues/29
because that talks about files that are not associated with any
particular exercise - their destination is a directory outside of any
exercise directory, whereas our destination is inside each exercise
directory.

For this case to work for us, we need trackler to correctly follow
symlinks present in an implementation. It currently does. In adding this
test, we request that this behaviour in the face of a symlink not
change in future trackler versions, for we have started to depend on it
as of exercism/haskell#443
Copy link
Contributor

@Insti Insti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I like the idea of adding a test to make it explicit that symlinks are supported.

@kytrinyx
Copy link
Member

kytrinyx commented Jan 2, 2017

This is great—I really like the addition of this test.

@kytrinyx
Copy link
Member

kytrinyx commented Jan 2, 2017

This is failing on CI after being merged, but it seemed to be passing just fine in the PR:

https://travis-ci.org/exercism/trackler/builds/188348834#L668

@kytrinyx
Copy link
Member

kytrinyx commented Jan 2, 2017

I'm going to revert the PR for now.

kytrinyx pushed a commit that referenced this pull request Jan 3, 2017
fixtures: Move exercises into exercises directory; reapply #12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants