Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Resolve Local Dependencies From Bundle Path #78

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

rawkode
Copy link

@rawkode rawkode commented Jul 24, 2018

Fixes #22

@SeanTAllen
Copy link
Member

@rawkode looks like there is a test failure.

@rawkode
Copy link
Author

rawkode commented Jul 25, 2018

Hi @SeanTAllen,

This should build successfully now. One thing I'd appreciate some guidance on though:

The following works, without error:

Path.join(tmp.path, "../local/a") + ":" +

but the following fails:

tmp.join("../local/a")?.path

Which I find strange, as the following works:

```pony
tmp.join("./local/a")?.path

I don't understand why 😕

Is this a bug in the join code, perhaps?

@SeanTAllen
Copy link
Member

Path.join is building a path from a string (tmp.path)

tmp was probably created with FilePath capability which doesn't allow you to use it to access directories above that level. See create inside of FilePath which gets called by your tmp.join.

    path = match base
      | let b: FilePath =>
        if not b.caps(FileLookup) then
          error
        end

        let tmp_path = Path.join(b.path, path')
        caps.intersect(b.caps)

        if not tmp_path.at(b.path, 0) then
          error
        end
        tmp_path
      | let b: AmbientAuth =>
        Path.abs(path')
      end

@rawkode
Copy link
Author

rawkode commented Jul 26, 2018

@SeanTAllen I believe this PR is good to go, regardless of my question (Hopefully 👍 )

@SeanTAllen
Copy link
Member

Before this is merged, we need a good release message for this as it is a breaking change.

@rawkode do you feel up to writing that? If yes, have a go and put it in a comment here. Ideally, we'd want an explanation of what changed, why, and before and after examples of what what one would need to change (if applicable).

@rawkode
Copy link
Author

rawkode commented Jul 27, 2018

Resolve Local Dependencies From Bundle Path

Previously, if a stable command was executed deeper in the directory hierarchy than the bundle.json files, relative dependencies would be resolved from where the command was executed.

Now, all relative dependencies are resolved relatively from the bundle.json directory.

This resolution is more intuitive and predictable.

@rawkode
Copy link
Author

rawkode commented Aug 9, 2018

SYN

@SeanTAllen SeanTAllen merged commit 08bcc47 into ponylang:master Aug 9, 2018
ponylang-main added a commit that referenced this pull request Aug 9, 2018
@SeanTAllen
Copy link
Member

Thanks @rawkode

@rawkode rawkode deleted the feature/relative-uris branch August 9, 2018 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants