Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Resolve hat path when applying a hat #181

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hat-examples/fish/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM codercom/ubuntu-dev

RUN sudo apt-get -y install fish
RUN sudo apt-get update && sudo apt-get -y install fish
RUN sudo chsh user -s $(which fish)

LABEL share.fish="~/.config/fish:~/.config/fish"
7 changes: 6 additions & 1 deletion hat_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ func (b *hatBuilder) resolveHatPath() (string, error) {
return hat.ResolveGitHubPath(hatPath)
}

return hatPath, nil
hostHomeDir, err := os.UserHomeDir()
if err != nil {
return "", err
}

return resolvePath(hostHomeDir, hatPath), nil
}

// applyHat applies the hat to the base image.
Expand Down
3 changes: 3 additions & 0 deletions runcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ func (c *runcmd) build(gf *globalFlags, proj *project, b *hatBuilder, r *runner)
image := b.baseImage
if b.hatPath != "" {
image, err = b.applyHat()
if err != nil {
return err
Copy link
Contributor

@teddy-codes teddy-codes May 23, 2019

Choose a reason for hiding this comment

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

can this be moved outside the if?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, this keeps it clear that the error check if for the b.applyHat() operation

}
}

// TODO proxy if container already exists.
Expand Down