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?
Library Version Control
Re: Library Version Control
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.
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.
Artal, A .PSD loader: https://github.com/EvineDev/Artal
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Library Version Control
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.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: Library Version Control
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 )bobbyjones wrote:--What Bobby said--
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: Library Version Control
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.
- DeltaF1
- Citizen
- Posts: 64
- Joined: Mon Apr 27, 2015 4:12 pm
- Location: The Bottom of the Stack
- Contact:
Re: Library Version Control
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.
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
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).
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Library Version Control
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
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:
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
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"
- ejmr
- Party member
- Posts: 302
- Joined: Fri Jun 01, 2012 7:45 am
- Location: South Carolina, U.S.A.
- Contact:
Re: Library Version Control
Alternatively I think you get the same effect with this:alloyed wrote:Code: Select all
~/my-game $ git submodule foreach git pull origin master
Code: Select all
$ git submodule update --remote
Just a small tip I wanted to mention.
Who is online
Users browsing this forum: No registered users and 3 guests