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

Allow the buffalo binary to use the version vendored with dep #1023

Merged
merged 14 commits into from
Apr 19, 2018

Conversation

markbates
Copy link
Member

@markbates markbates commented Apr 12, 2018

If the following conditions then vbuffalo will attempt take over:

  • The app MUST be using dep
  • The vendor directory MUST exist

If those conditions then vbuffalo behaves in a similar fashion to grift. It will first create a new .grifter/main.go and use that to build a new binary, bin/vbuffalo that has been compiled using the vendored version of Buffalo.

Another requirement is this section in Gopkg.toml

[prune]
  go-tests = true
  unused-packages = true

  # DO NOT DELETE
  [[prune.project]] # buffalo
    name = "github.com/gobuffalo/buffalo"
    unused-packages = false

  # DO NOT DELETE
  [[prune.project]] # pop
    name = "github.com/gobuffalo/pop"
    unused-packages = false

For new applications the appropriate toml will be generated. For existing applications we will add the missing prune sections to their Gopkg.toml file if they don't already have them.

@markbates markbates changed the title vendor the Buffalo Binary inside Applications fixes #986 Allow the buffalo binary to use the version vendored with dep Apr 12, 2018
@markbates
Copy link
Member Author

markbates commented Apr 13, 2018

@stanislas-m @paganotoni would love to have on this at some point by either one of you. even better, play with it. :)

@paganotoni
Copy link
Member

@markbates I will play with it tonight, do you have any suggestion on how to test it?

@markbates
Copy link
Member Author

Just build the buffalo binary from the branch and use as normal. Report anything strange. See the notes about when it kicks in. You’ll know it’s working because it will print vXXX [development] at the top.

@markbates
Copy link
Member Author

The idea is that it’s virtually seemless.

@paganotoni
Copy link
Member

@markbates i just run it with my pre-productive app and seems to work 👌, as far as I can tell from the logs (and i'm assuming all this is expected behavior based on the code):

  • If the project has dep it will use vendor buffalo version and generate a vbuffalo binary, which will be the one it will use to run the app and other things.
  • if the project doesn't use dep it will use the version in the GOPATH.

I see both happening correctly if I remove my Gopkg.yml and re-add it.

@paganotoni
Copy link
Member

paganotoni commented Apr 14, 2018

@markbates do you think its worth to add some automated tests for this or is it too overkill at this level? (i would love to have some).

@markbates
Copy link
Member Author

@paganotoni I would love some automated tests around it? any idea how to add them?

@paganotoni
Copy link
Member

Probably in our Dockerfile, we could at least check the output of a dep project for buffalo version vs a non-dep project, but thats from the top of my head.

@paganotoni
Copy link
Member

paganotoni commented Apr 14, 2018

@markbates sorry if I'm overdemanding, I'm very excited about this, just by reading it learned a lot :)

@markbates
Copy link
Member Author

@paganotoni lol, I appreciate the input actually. want to try and see if you can whip up a little something, even a smoke test in the docker file?

markbates and others added 3 commits April 14, 2018 15:46
paganotoni
paganotoni previously approved these changes Apr 17, 2018
@markbates
Copy link
Member Author

@paganotoni any idea why the file tests you added for this are failing?

@paganotoni
Copy link
Member

@markbates not sure, what are your thoughts on printing something that let us know that we're running the version of dep instead of GOPATH version?

@markbates
Copy link
Member Author

@paganotoni that was why I was printing version [version] at the top. but I'm happy if you want to change it to something a little better/easier.

@paganotoni
Copy link
Member

@markbates find it, i'll update the PR soon :)

@markbates markbates added this to the 0.11.1 milestone Apr 19, 2018
@markbates markbates merged commit ecee77f into development Apr 19, 2018
@markbates markbates deleted the dep-exec branch April 19, 2018 11:31
stanislas-m pushed a commit that referenced this pull request May 12, 2018
* wip

* Vendor the Buffalo Binary inside Applications fixes #986

* added some docs for code climate

* log packing if in debug mode

* fixed weird import

* Update vbuffalo.go

* fixed issue with gometalinter

* adding some filetests to check the buffalo-version output (#1028)

* adding some filetests to check the buffalo-version output

* making it version independent

* removing unneeded newline from broken filetest
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