-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper methods to create mappings #38
Conversation
- directory: create mappings from a baseDirectory including the baseDirectory - contentOf: create mappings from a baseDirectory excluding the baseDirectory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've a few comments, but also I think this should probably live with its brothers in Mapper
(PathMapper.scala).
Thank you for taking the time to PR!
io/src/main/scala/sbt/io/Path.scala
Outdated
* @example Add a static directory "extra" and re-map the destination to a different path | ||
* {{{ | ||
* mappings in Universal ++= contentOf(baseDirectory.value / "extra").map { | ||
* case (src, destination => src -> s"new/path/$destination" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this example doesn't compile (missing )
) and is missing an explanation at the end.
io/src/main/scala/sbt/io/Path.scala
Outdated
* File(extras/file1) -> "extras/file1" | ||
* File(extras/file2) -> "extras/"file2" | ||
* ... | ||
* }}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example seems to be wrong. I'm getting:
scala> for ((file, path) <- Path directory (file("base") / "extra")) println(s"""$file -> "$path"""")
base/extra -> "extra"
base/extra/file1 -> "extra/file1"
base/extra/file2 -> "extra/file2"
io/src/main/scala/sbt/io/Path.scala
Outdated
* File(extras/file1) -> "file1" | ||
* File(extras/file2) -> "file2" | ||
* ... | ||
* }}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example seems to be wrong. I'm getting:
scala> for ((file, path) <- Path contentOf (file("base") / "extra")) println(s"""$file -> "$path"""")
base/extra/file1 -> "file1"
base/extra/file2 -> "file2"
@dwijnand What's the status on this PR? |
* File($baseDirectory/extras/file1) -> "extras/file1" | ||
* File($baseDirectory/extras/file2) -> "extras/"file2" | ||
* ... | ||
* }}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this still missing $baseDirectory/extra -> "extra"
?
* | ||
* {{{ | ||
* File($baseDirectory/extras/file1) -> "extras/file1" | ||
* File($baseDirectory/extras/file2) -> "extras/"file2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an extra "
* @example Add a static directory "extra" and re-map the destination to a different path | ||
* {{{ | ||
* mappings ++= contentOf(baseDirectory.value / "extra").map { | ||
* case (src, destination => src -> s"new/path/$destination" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's still a missing )
here
I just submitted the review that I had pending from 2 weeks ago.. Haven't reviewed the latest 2 commits. |
dbe6eab
to
2b184f0
Compare
Sorry for the long standing PR. Finally got time to clean this up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Muki!
I put this on the
Path
object. Not sure if this is a good place.The test aren't property based. I probably need to add some corner cases like
baseDirectory
baseDirectory
is a filebaseDirectory