Page 1 of 2
Library Version Control
Posted: Sun Jun 07, 2015 2:56 am
by DeltaF1
I want to pose a question to all the other lovers out there about using personal libraries.
I've built and use a set of libraries and utilities for my own personal use, ranging from vector math to some basic gui elements. Every time I make an update to the tools, I have to manually copy and paste the code into all of my other projects that might benefit from that new feature.
What have you lovers used as solutions to this problem? How do you manage code shared between projects?
Re: Library Version Control
Posted: Sun Jun 07, 2015 3:42 am
by Evine
Fewer love project. As I'm doing live code reloading and error handling it has gotten easier to simply work with just a single love file.
But thinking about it, it might be a good idea to have a common library folder on your computer that you just used Lua own loadfile() function to call the library. Or a more fancy: check date on library --> copy/paste into project folder --> load , this way the love file will always be releasable.
Re: Library Version Control
Posted: Sun Jun 07, 2015 3:47 am
by bobbyjones
DeltaF1 why not design a solution? That's the fun in knowing a programming language. With lua and github or other host you definitely design a system. Or maybe even more homemade you can do it only using lua and luafilesystem and a list of the love projects. Let's your imagination run rampant.
Re: Library Version Control
Posted: Sun Jun 07, 2015 5:26 am
by Positive07
bobbyjones wrote:--What Bobby said--
TOTALLY! You should create a script that automates this for you, either by creating something similar to luarocks (loverocks maybe more similar to what you would like) but local or by creating a loader for require that uses io ([manual]5.7[/manual]) to get a library from you libraries folder, then you can use [manual]loadstring[/manual] to load the file... that would simply be great solution too, but as Bobby said let your imagination go rampant (and upload it to github so that w can all enjoy
)
Re: Library Version Control
Posted: Sun Jun 07, 2015 9:03 am
by s-ol
I just use symlinks, but only for the stuff I am working on right now. If I kept updating my old pojects I'd end up breaking something at some point.
Re: Library Version Control
Posted: Sun Jun 07, 2015 12:49 pm
by DeltaF1
Thanks for all the replies!
Evine: I'm working on a networked game atm, so I have 2 projects, one for the client, and one for the server, and they need to share functionalities.
bobbyjones, Positive07: I'll probably end up doing that. Maybe rewrite require to search for a local copy of the file, and then look in the shared library directory if it can't find it? Also I wrote some simple batch scripts to zip and rename to .love, maybe that script could also copy the required libraries into the .love?
S0lll0s: I have to share code between my server and client projects atm, but I would not want to update code in my really old projects, I agree.
Re: Library Version Control
Posted: Sun Jun 07, 2015 3:40 pm
by Inny
Its a bad idea to automatically update core dependencies without performing testing. Having a script to copy it between projects is a great idea, but leave in that hook that makes you test it and not that it broke something (like you rearranged the parameters to a function and that caused a crash).
Re: Library Version Control
Posted: Sun Jun 07, 2015 4:09 pm
by bobbyjones
An easy solution is to have unit testing for every project. That way after every automatic update you automatically run unit test if it fails it remains the same as before and notifies you if it maybe.
Re: Library Version Control
Posted: Mon Jun 08, 2015 5:38 am
by alloyed
Since I use already use git on all my projects, I'd probably just end up using git submodules instead of symlinks or a full-on package manager.
basic workflow:
Code: Select all
~/my-game $ git submodule add ~/my-lib my-lib && git submodule init # install my-lib to my-game
~/my-lib $ git commit -m "Made a change" # update my-lib
~/my-game $ git submodule foreach git pull origin master # pull update from my-lib, and any other libs into my-game
~/my-game $ git commit -m "updated our copy of my-lib"
it's not exactly automatic but it does mean you keep control of when updates happen, you can roll back updates if they break old games, and you don't really need to keep a stable API or version your libraries
Re: Library Version Control
Posted: Wed Jun 10, 2015 5:46 am
by ejmr
alloyed wrote:
Code: Select all
~/my-game $ git submodule foreach git pull origin master
Alternatively I think you get the same effect with this:
A trivial improvement as far as "number of keys you have to press" is concerned. But if you ever have submodules that either pull from somewhere besides "origin" or that you want checked-out on a branch besides "master", or both, then personnaly I think 'git submodule update --remote' is more convenient.
Just a small tip I wanted to mention.