Adding presets to the Laravel install process (pt 2) | Re-building Lambo | Matt Stauffer Livestream

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all right so it says it's not working on twitch today we try to restart and it didn't fix it don't I knew no idea what's going on also you can see the bars on the side of my video here there's something really weird going on with with OBS I'm on my home computer not my normal computer thanks for the link I'm gonna copy that link and put it up on YouTube for anybody who wants that to you normally watch my stream on Twitch apparently restream is not sending twitch today here's the youtube link just for today and putting this up on Twitter alright I'm sending that link out sure Oh switches on now all of a sudden as I sent that uh-huh just kidding I'm I'm gonna delete that tweet that's so weird ok cool so we are on Twitch and on YouTube ready to go hey Portugal also we've got um our friend Jason McCreary here with us so it's possible this week we're gonna work on this stuff connecting with his new project but I'm hoping to do it next week and he and I get so I can get them to actually Skype in so look there's a reminder there in my checklist that says eat a snack I'm actually gonna show you all my checklist that I use each time so you can see it says eat a snack and I completely forgot to so I might disappear midstream and go grab a rx bar alright so 5 minute countdown hit let's go I know I'm ice-cream deck at home so I don't actually get the chance to do that alright so what are we working on today we're working on a project called lame-o also I just set up OBS on my new secondary monitor here so you're gonna see a black line like 100 pixel black line underneath my screen it's just because I should have taken 20 minutes to get this fixed before I had just just added this monitor since last week's stream and totally forgot so that'll be fixed next time so we're working on lambo if you're not familiar Amba it is a command line application for laravel it is a wrapper around the layer around Staller that does a whole bunch of other stuff some of it does by default some of it it does only if you opt in using certain flags it was originally written in shell scripts it's been around for years and we just did a rewrite in PHP using a project called blare bell 0 which basically is just laravel but then somebody not in the laravel you know core team oh okay so many not in the core team Nuno Maduro took it and kind of made some tweaks to it to make it just a little bit more friendly for building command line only applications so it's basically done it's an alpha right now and we are high level of what we're doing is introducing a concept called presets and presets are basically the idea that every single time you spit up a new app you can pass in a simple string that does a lot of things differently like you might have a preset every time you wanted to install laravel novo with it or every time you wanted to use blueprint which is a new tool that that Jason's working on so it's cool to have Jason here one of the things we're gonna do today is we're going to see if we can do Lambeau my project which is the old syntax instead of what laravel zero forces by default which is laravel new my project then we're gonna keep working on the presets and the goal for today is to get the presets good enough to the point that next week Jason can join me via Skype on a stream and we can integrate a preset called blueprint and and anytime somebody runs lambo - - presets equals blueprint they'll be able to do a blueprint so alright let me look at the chat now um doo doo doo doo doo doo doo doo doo yes perfect alright so let's work on it you can even see this I said next week stream I'm so prepared this week right next week stream we're gonna use Jason's blueprint as an example of a good preset and it's a multiple step pre step as a preset which another ones we have right now are because I think I want to like create a draft I am will file and stuff okay okay so we are gonna go over to Lambeau and awesome we are going to open my code and again this is my only second time doing the stream it from home and I made a lot of hardware changes since then so it's just going to take me a second to kind of get my stuff back in order here so thank you all for your patience it's also a bigger monitor so let me know if I should make this any of the fonts on any of the apps and working in bigger so okay so we should probably have a branch we were working in last time last time I failed to push it up so last week we actually didn't get to work on Lambeau we had to work on something else because I hadn't pushed it up but I went into my office this past week and pushed it up and it's funny cuz the last thing on my terminal when I went into my office was me trying to push it in it failing and me and not having noticed because I miss do in the past that the - you so get checkout o get checkout that's not what I wanted get checkout mes slash presets and it's gonna check it out from origin for me my bad so okay cool so we've got this presets thing it says font seems fine for you so it's probably small for most people thanks alright so I think that's a little better alright so let's open oops I got to do a quick oh no I don't have my um my sensor graphic here alright I'm just switching over here I'm gonna do a quick I'm gonna pull up github desktop and get it moved over to Lambo so we can use that for our nice visual representations of whatever working on Lambo okay cool and then I'll pull you all back here man I miss my stream deck I really need to bring it home okay so let's take a quick look at what we did last time we started building out individual preset classes and the tests around them and I know this is gonna be small for everybody so I won't stay in here for very long so we basically added a new action called run presets which we probably did here yep and then we updated the new preset the new command which is just run all the time so that it runs this app presets and doesn't do anything else so we can just really do be doing some testing there and then we created a base preset that every preset is gonna extend and then yeah that was nothing okay so then after that we started working on building out the this presets command and what it does is basically say when they pass in these presets which we get from this presets past method we're basically go through here and explode out the presets they pass we talked a little bit about what the syntax would be Matthew Edward Stouffer we thank you for following wow that's really big makin makin Paiva hold on yeah let me switch to studio mode so I can make that be not quite so massive because that was very large stream labs stream labs should be right in the middle but then on share full screen stream labs should be maybe over to the side or something I'm not sure we'll see well see how it looks next time somebody does that okay out of studio mode back to normal alright so yeah so basically when we pass in that preset syntax and I we we had quite a bit of conversation around oh thanks for following Zante us up thank you did you unfollow Andrey follow just so I could see how it looks so you're a wonderful human I think I'll throw it right there for now all right cool so yeah so what it does is basically it expects you're gonna pass your syntax like I believe we did this so lambo priests knew my project presets equals and then this is gonna be so like Nova and then telescope and then something else and I think what we did was was that actually how we gonna do it oh gee we had never having to do pipes we did pipes I still don't like pipes anybody who has a better idea let me know Nova telescope oh no we couldn't do pipes remember because it's a um I think we enter having to do pipes and quotes oh I hate this Nova telescope and then something else : parameter 1 parameter 2 like this this is our current syntax and I really don't like that that much so and then we did this to do right here so let's just do a quick dump to make sure that's the working working the way we want also just fall because I did not know your untwist all oh great resolution on YouTube is kind of low oh it shouldn't be that makes me sad okay well we'll get this worked out okay so that's where we are right now so let's open this up and we are going to do two things today primarily one keep working on the presets and then two we're gonna try and figure out if we can get it to the point where it's instead of lambo new my project it's gonna be just laying on my project so since that's the first thing I said is going to do today I actually there's always going to be a delay on both of them unfortunately twitch is a little bit behind as well YouTube may be behind twitch but that's purely just a latency issue interesting okay so what we're gonna do first is that so let's make a new branch mes slash no new and command Oh GCM is supposed to be GCB get checkout which is get checkout branch I believe her - be mes no new and commands funny because Jason McCreary who's on this call was one of the first people who told me you shouldn't be doing all of those little shortcuts and I totally disagreed with him until I started doing streams and then and now I have to explain them every time so Jason you're at least partly right okay cool so let's zoom this up a little bit and we are gonna do so I actually had a chat with with a new no last week and then I made an issue so let me go pull up my chat with Nuno because he thinks he actually solved the problem so let's solve open up new knows solution and then also I'll show you my my idea that I had or my um my issue so this is gonna be level 0 I think it's just slash layer bailed actually oh yeah so I open an issue here in laravel 0 saying allow for undefined commands to be passed to the default command so what I was saying here is I have a few commands here but then most of my interactions in the app happened with my new command and I said when I wrote Lambos a shell script this was this was your syntax lambo project but with laravel zeroes is right now after force this syntax lambo new it's what I was saying is I would love the thing that allows you to past any unmatched commands and a command is just the first thing here to default command so that I could make a default command that just takes all the things that are passed in here yep so what we were originally thinking about and this is what I thought was just to catch a not command not found exception somewhere and then just kind of pass all of its arguments through but I got a gist from Nuno right here that was showing how to modify the kernel I think and oh it's the same thing right here so it's basically where so let's open up our version of the the layer well 0 4 and frame it colonel so we would definitely have to make this a pull request so let's do a quick fork of layer well 0 so that we can be working with our own version and we're gonna actually pull in my version instead of well does it I think it has it as a dependency so vendor laravel 0 so there's two ways to do this that this the cleaner way to do this is oh wait why is there foundation framer I don't know there's difference uh-oh so we're actually not forking layer well 0 probably we're forking liberal 0 slash foundation or layer well 0 slash framework let's see which one it was it's in framework crap okay so let's go back and fork the foundation repo instead so it's gonna say there's two oh wait this is a mirror from foundation Oh framework not Foundation cheese I'm an idiot sorry oh I'm cutting myself around and okay so we're gonna fork this right here and what I was gonna say is there's two different ways to pull in your own Fork there's a much more robust way where you you you edit your composed route Jason and you basically add a repository in here that says look here for layer well 0 slash framework and that's certainly a very good way to do it especially if you're doing like long term relying on an external custom repo but if you do a short term I found that most of the time it's possible this won't always work but so far it's always worked for me I just delete the director here and then symlink it into my own sonar MRF framework and then I'm gonna go sites and then I'm gonna clone down Oh framework one I bet you my other one is um layer Bell slash framework I'm gonna clone this down so get cloned framework one as level zero framework and then we're gonna link that in so Alan - s and then tilde slash site slash laravel zero framework into here as framework and then I think we can now make our changes in here and so we're gonna make a branch in here we're gonna try this change and if it works then we'll pull request it against the core so yeah so what we've got here is in the framework slash kernel that PHP I think my guess is the only change he's making is oh he's probably changing both of these the handle method and the ensure default command method so if I do this I need to remember to commit it along with Nuno Maduro so that he gets credit for that code that he wrote okay so while we're working on that actually since I can go here I can open up another vs code instance right there and then so okay won't that cause issues if you do kumo or update yeah this is do you only can do this Ln s version if you're doing like a really quick short-term thing this does not work for long-term work if you're doing long-term development on your own or especially if you're actually expecting everybody else who installs this project to get the other the fork then you absolutely need to do the version and compose about Jason where you set repositories so the big question is is this gonna get merged fast if so this is fine I'm just spiking something out if this is not gonna get merged fast then we need to point to the to the branch and so what I'm gonna do is first get it working on the stream ask them if it's gonna get merged and released fast and if not then not in the stream so I'm not wasting yells time I'll go update the commotion about Jason for the Alpha to point to my my fork so that the Alpha people can get this updated code hope that makes sense alright so we want to take new knows code here and then we want to get to our version of laravel OOP that's not what I wanted I wanted half of my streaming oh that doesn't exist okay I'm gonna take new knows code here and then we're gonna do a branch of my own here so we're gonna name this one mes pass arguments to deep ass yeah arguments to default command something like that thanks for following Sol Solomon real and yeah right Solomon rate I kind of like where Shaq is there so I think gonna keep it there alright cool so let's open up let's close out Lambeau right now and let's open up what was it colonel dot php' I think yep colonel dot php' so he's got this thing right here that is the handle method again I don't have a good so let's go to the handle method I forget some I remember that there was a wing yeah handle okay cool all right so yeah so he did change this first of all it makes an instance of this then it ensures default command and then it handles so I'm literally just gonna copy new knows code right now and not even worry about anything else because it looks like it's way it's there did he literally write out like the full like he wrote like basically the equivalent of a pull request I wonder if he pull requested that because he's literally giving me everything I need we don't have to have a write anything here but we can't test it so even if it's something that he wrote we can at least test it for him okay yeah I'm sorry my normal shortcuts for moving these things around in the screen or not or the pager networking it kind of feels like he might have PR that nope you didn't okay all right so this is what I'm doing right here boom okay cool so let's just throw in this insured default command I don't know how things are ordered in this file by default so we might be putting this method right here in the wrong place according to where they would normally do things here like they might do their public functions first so you know actually it's just I normally put my protection functions together um so let me go see if they do that here public protected do they have any more public so they do they seem to not have a consistent space for them so we're just gonna throw it here again right there okay cool hey Nuno so you wear your ears burning because I was just looking through this thing and I realized that that's just you sent me is really basically like everything I need like I if this works I don't even need to write any more code and you wrote it so well even with comments in the trailer comments so are you just ready for us to pull request this and should we just test it anyway I'm I'm gonna read over new nose code real quick and he can explain the chat if he needs so with the symphony's default commands you cannot pass any argument or option because they're ignored with the first art when the when the first argument does does not match any commands this method ensures oh now I messed up given arguments are proxy to default come in I messed up your three spaces thing when the first argument I think we need like how many more oh it's not three spaces it's just descending okay close enough does not mention any commands this message ensures given arguments options are proxy to the default command so again this is what we're talking about earlier so he's doing some bootstrap e stuff and first we're gonna see if the first argument matches a command and if so great application finds command name but if we get this command not found exception which I'm sure we need to import then if none the given arguments and options should be proxy to the application default command great so instead it then says set default command and then it gets this command set default and cool now this this right here is not super super legible for me as somebody who's never looked at the layer below zero core but I trust Nuno because you wrote it and it makes sense enough right we try to match that first parameter but my project is in the command so instead throwing an error you know catch this command not found exception because my project is not a real command and then do some laravel 0e stuff so let's just try it and just see what happens so we're gonna do dot slash Lambo my project instead of laravel new oh you know what so my default command right now is the help command so what we would need to do well let's just do this what happens there do we still get the help command ok no arguments expected got asked if a staff has to fast so I feel like this right here let's see if we're actually even getting this code written run correctly ok we are so we're getting in here but this set default command thing is not doing the job so hmm okay should be proxy to the application default command so whatever this right here is supposed to do is not happening or is not doing the work so if we can in here we are getting here correctly and I bet you we're not gonna get here if we pass the real command so let's just try a real command real quick blah blah we get that ok let's try a real command like help and we get help so it is correctly being passed in here only when the command doesn't match you need to set the full the the default command on commands dot PHP okay so it's maybe my implementation that's the problem the fake default command class doesn't exist that's so weird I thought I had already set that because of oh that sorry this is the framework let's go to my command stop PHP um well that's the thing for right now no I want I'm just testing does running this give me the help command but it doesn't instead it says no oh the help command doesn't expect arguments duh Matt thanks ok Nuno is smarter than me once again all right so let's go into our help command I know let's go to our commands not PHP so we're gonna change I thought I could do this second but you're right I need to have one that actually expects arguments so we're gonna change our default to be the new command and so now when so many types stops slash lambo they're not gonna get help but i actually think that we can modify the new commands so that if you don't get the expected parameters will just show help anyway so this is actually really going to be like the new our help and so we'll dig into that in just a second so let's just hit this OOP dot slash Lambo did I not save I probably didn't save default command a new command okay hmm let's move this out of the way a little bit so we get a better a better display okay so why is the default command I feel like OOP sorry I still need this one open all right so I think we're still hitting in here so what are we getting here it's not even hitting the oh it's nothing with command not found exception so that makes sense it's actually a newer help command maybe make another new command that gets ya exactly what I was thinking Marissa if bang arguments else helped me yeah exactly but right now I'm surprised that this right here is not give me the new command because I do have that set as the default command but let's okay so let's test that a second for right now let's actually just pass something in what do we get we get nothing okay so let's go to our kernel is that happening exit oops let's do a die and dump or dump and die with here so I make sure that we're actually you know there and then the config okay so command oh it's commands dot default that's why okay so we are hitting there as we expect and it is new command which is why I guess let's let's make sure that's the right command new commit okay that is the command app slash command slash new command okay so it is being set as the correct default command yes but oh there we go so it runs when we pass a parameter which is what we wanted but for some reason it's not oh hold on a second my dog just came in the room so I gotta go close the door BRB all right so we have one piece working which is that if I pass this parameter in my project it gets passed in great but we don't have working is that when I don't pass a parameter I somehow get the help which is funny because it's actually what I want but I don't know why this is happening why am I getting the help command is the default command when I don't pass because isn't that what the default command is for is when no command name is provided so somehow even though we have the default command set to new command when we don't pass parameters in we're getting the help command instead I don't know why you know if you have any insight into that let me know but honestly that's what I want if you don't pass any parameters in give me help if you do pass parameters in first of course look for the look for the thing so like lambo edit after that's a real command so I want the real command to run it looks like the real command is running yes you know imagine it is laravel magic you know oh that's interesting oh this is that same thing from before remember where edit runs using Xcode so let's make sure that's on our list of things to fix look into fixing that thing where edit after etc use Xcode to open new command I mean I don't think new command for words but I guess you know what it might now that you mention it MS offer it's possible that new command if you don't pass an app it maybe we already built it to do the help command let's see here that's exactly what it is if it doesn't pass so that work we were talking about with splitting up into a different thing we already did that on a previous one if we don't pass in a project name display help screen cool thank you passed us great so we've got so that was it so if we pull across this right here we literally have everything we need so let's check take a look on github desktop and I will have to really quickly add a new one so I have to pause everything with y'all because I have to add that framework repository and I always pause when I'm on github desktop because there's lots of client names in there and stuff so add existing repository and then I go choose that level zero framework thing that we did and then we hit a depository and now I can show it back to y'all so in here we've got this Colonel change and so I'm gonna pull it across this with new no as a co-author because he's not a co-author he literally wrote it and knew no if you just want to do this pull request your own you're all welcome to because obviously I had nothing to do with it I think you're a no-no Nuno Maduro and get up maybe it's just new now Maduro let's see it's just new no all right so this is pass if no command is defined not only if if first parameter doesn't match a command pass arguments to default command and say this code was written line for line by Nuno literally all I did was test it and paste it in here oh yeah the main reason was one of the big reasons I used the github desktop app is to add co-authors and let's what's the issue that I had that um I want to get the laravel zero slash zero zero Oh github laravel zero and then layer bail zero and then closes so we got a reference an issue on a different framework or a different um oh you know what this is okay no cool will actually write closes in the in the pull request all right so let's go over to my fork github mat staffer layer of framework one I think is what it forked it as that's going to drive me nuts let me rename this to level zero framework real quick okay and then let's go make a new poll request have you tested it correctly runs at it configured after if you use them instead of pass him yeah it does because we did this up here dot such Lambo space edit - after and this is the correct edit after command thanks for checking in John alright so it's my dog huffing just trying to make sure you didn't get stuck into the bed or something like that I'm not gonna do that because then that throws your email address up and in the commit thing alright so what does this do I guess that's this right here first parameter doesn't match command pass arguments to default command and then this would so we want to do it against Laros zero framework which is perfect Nuno let me know if I should to PR this against a branch instead of against master and then I will also say closes and then we need to refer to not just the number of an issue with the issue on a different repo because we're not peering it to laravel - zero so I'm just gonna paste in the whole thing right here and I think that still works I think the only imitation of solution is the fact that you can't create a project with the name help yep and that's totally fine at least for me closes laravel zero to 87 great I think that's it and of course we can tweak this later don't worry about it John you're fine man you have been so helpful in all these streams don't even worry about it alright cool I'm going to create that pull request and thank you so much so so so much for your help on that code you know this is doomed up a little bit too much for me to see y'all this is a little bit extra alright great so that is done so I will actually just say no rush but let me know if this will be more than a few days to merge which is fine just so I can update lambo to point to my fork instead of just leaving it temporarily broken all right cool so Nuno is the man we finished that one so let's go to notion and note that we did that right there okay so things we did take new nose code that allows for passing we probably have to change our documentation for that to allows for passing parameters to default command test it and PR it to level 0 all right so let's actually now modify ours so the documentation expects that and that would be in let's see just assume help tells you to run laravel new space yep so let's let's fix that real quick so any where it says Lambo new we want to replace that yeah and that's gonna probably be a lot of places so for those who haven't been around recently my multi-select is broken in vs code i have no idea why so I have to switch to sublime text which right now has my to-do list open on it so I will not share that with all of y'all as much fun as that would be for you ok cool so syntax markdown just for my brain and then let's look for all those instances this you'll need PHP to have two major change you want to run lab ok so that's not let me to change you more BAM um so let's look for all of the instances of Lambo new and change them all out with Lambo I am I love that man that's good alright so let's copy let's copy this 720p is now is now is non HD in YouTube so blur I think you should live stream @ 1080p I thought I was live streaming at 1080p let me check my settings real quick I'm streaming at 4000 kilobytes per second bitrate look at look at my video settings it says it's outputting at 1689 45 which is weird that's not 1080p what is 1080p it's more than that right I don't I think I just I think I was sending it non HD on accident honestly 1920 1080 yeah I'm just it's on ax that y'all so let me add that to our list sorry about that it's totally my fault it's not YouTube's fault it's my fault for being an idiot when I set up this new computer I just used the default resolution on this computer although its retina so that actually is able to do much change streaming settings to 1080p which is 1920 1080 all right 1920 1080 which has 945 4p I'm sure because of the fact that I set it to not a 1080 because I'm an idiot a stream lab has a settings which changed on the fly well I'm uh I'm not using I I might be able to change it note uh OBS doesn't it says please turn off any outputs to change video settings so I'm not going to do that that's fine I'll bolt that ok cool so what are we doing right now we are tweaking our app to make sure that all instances of lambo new and the whole project are no longer saying lambo new a.m. and then BAM okay so in theory somebody could still run lambo new I don't know if there's any easy way for us to keep people from doing that but I don't really care I don't think well oh you know what if somebody tries to run lambo new expecting that they're gonna get a project named new they'll be very confused so let's actually see how easily we can differentiate what's getting passed in to enough arguments is gonna be the right thing because I don't think it's gonna be treated as an argument but let's just check it out if we look at this I just I just tabbed over to OBS and hit enter and apparently it's switched over to UM my starting soon screen without me even realizing it wolf stream looks fine it from 944 feet ok good to know yeah I'll fix it next time I promise ok cool so we can close that one out so what are we doing here oh you know what interesting we are also on the wrong branch right now so what have we changed here we are okay we're still working on the no new in command so that's ok call to a member function get arguments on null I bet you we don't have the arguments when we hit the constructor it's probably when you hit the handle method so do it right here all right so let's run it so the command is new and the project name is null so now let's run like that so okay so see it comes through exactly the same when it's being proxied or when it's not being procs it can a Lia slam beau new to Lambo is that a thing or actually could I just make that command to not work anymore I didn't think about that how do I forget it's been a while since I set this up in the first place how Ohno I think it's the when the command is registered that's when it defines its own syntax you know cuz it's building the signature of new and that's what just oh my my dog wants out now just give me a second I feel like we need I feel like we need access to the full thing that's being called which is not just gonna be arguments I bet you there's a way to get it but it's not as convenient from like the from the symphony stuff that's underneath it so okay so this is not the arguments where is it that we actually start working with the arguments yeah let's just go look at arguments and just see it's illuminate console and interacts with IO so what I want here is not the argument but I actually want like the full command that was passed in let's see if it's here or if it's gonna be on one of the things that actually uses this trait if anybody knows let me know I'm sure we'll find it but I would be curious to yeah see this is more like the out ones like where you're asking a question or whatever this output now hmm set input I don't think that's the type of input we're talking about that's the interface to the input okay so no none of those didi this input yeah I could try it why not you know probably is one of them what is it it's a argue V input new command execute all right so these are all of our options and how they were defined interestingly this doesn't actually show us just that the actual thing was written that's crazy oh well hold on it shows us tokens so let's see are that is that tokens less different if we don't pass in new I think it might be actually oh I love it new no for the win again argh V input I'm gonna just go out in a limb and say that class is not gonna give us just a tokens like this let's just try it just for fun yeah get tokens and if not we'll just go dig this thing up okay cool so let's dig this thing up in our vendor directory so that's gonna be Symphony actually it won't be Symphony it will be under the lair of all ones right yeah it'll be a dependency of what will it be a dependency of framework may be like laravel framework or illuminate fine a foundation I mean Symphony component console input I don't think that's something that gets pulled in by us I think that gets pulled in by one of our dependencies so it's either gonna be pulled in by the laro framework or it's gonna be pulled in by you know what I'm just gonna do the lazy way I hope this isn't too slow I think I mean we can do this class are the input don't believe that's gonna find it faster than I could let's see we'll keep looking but I think that's gonna be our fitter you could do it yourself implode server are Givi oh is that really what our Guinea is all right vendor Symphony wait I do have a vendor Symphony what I thought I just looked for intence eaja it was right there this whole time I'm an idiot console input I'd rather use the symphony way possible but thank you so much for telling me that John Syd console input argument put Marissa says what it makes sense to not have Nubia that you can run so you can provide no commands it's a new else the command yeah I would love that if possible I kind of doubt that it well actually that's really interesting how does how does it even you know what now that you mentioned that I actually think it's hmm what happens if we just drop new here we haven't actually taken a look at what these parameters are getting a set to be here so let's actually just take a look at what it looks like for us to grab the the the path that we're gonna be building so I think it's gonna be this project path one here so let's just grab this project path go to new command run right in here after set config and just say what is project path actually being set to in each of those syntax because we got to make sure it's actually parsing it correctly we called this command but we haven't actually made sure that we got the command correctly in each case so lambo new lamo new is dot slash dilemma new ABC this should be ABC and now let's try lambo ABC come on fingers crossed Oh what how did that happen how did we get past this Oh dot slash Lambo ABC sorry everybody I'm an idiot dot slash Lambo new ABC OOP dot slash Lambo ABC all right great whoo okay so it is parsed correctly so that's whoever just said that I think you're right I don't even think we need a well this will probably break something but if we just take new off of the the signature of that one does that break everything actually do kind of want to keep that they're still no they think about it no too many arguments expect oh right because you can't do lame Wow that actually might be Wow I think that was it because since we're only using this thing to define that the things that are being passed and we're not using it to define the actual function name we don't actually need to function at all it's just gonna so let's make sure that it actually builds the signature correctly cuz that's just wild to me I think it I think it's gonna work though yeah cuz it's right here the project name is defined by that Wow okay cool so by doing that we don't even have to do any parsing we literally just it removed it entirely from the potential things that can do so now somebody could in theory we could do okay so we can do dot dot slash lambo slash lambo ABC and I think we're gonna get a new project called ABC yep all right well now we gotta go that's weird why did it start creating it and the other one oh because I was doing my global one so yeah i yeah creating lurve ah up ABC but if we were to try dot dot slash lambo so here's the big question if i write new does it start creating a needed nap Oh Marisa you killed it nice work so the only things they can't create our projects named what our command names are which are basically edit config or something else can fake friggin fantastic alright let's get rid of any of these dump and dies that we put in there which out we're in the wrong one so let me just switch over to Lambeau all right so what did we change here we got rid of new everywhere basically yep that's it get rid of new so this depends on my fork so I do think that we might have to fork it so let's just put that to my things to do is update Lambo master to point to Matt's fork for now so so right now that just when I push this up y'all that the oh it's on presets anyway actually so we're not gonna merge presets in until at least next week and I bet really emerged by then so we're good to go so my presets branch will only work for me right now cool no problem alright so what did we do let's go back to get up desktop we get rid of new in the Lambo whatever allow for Lambo my project well that was awesome it took a little while but we got it fully integrated both in level 0 and and our way of doing it alright so we can now publish this branch up and then we're gonna go pull request that into mine so this gonna be tight and Cole ambo got a - thanks for hanging out Lee does a situation where you can't use new as the command if you would prefer to do that yeah but I don't want that I don't like new so I don't want to introduce it when I don't have to I guess the possibility if somebody could run lambo new my project but I think in that context that would get an error right lambo new my project I think it's gonna say don't I don't want yep there you go so that's it lambo help will still work better and when you run lambo with no parameters you still get lambo help as well look at that it's better than I even expected it to turn out ok so what was I gonna do here I was going to pull request to no noon command into not master but mes slash presets so this is allow for lambo my project and then it's just the work we did there you're getting rid of it and all the documentation and then we're deleting it from here thanks again Marisa and then we're setting it as the base command I will put a note here at this will only work if you have sim linked your if you have man you we pulled in that stuffer / laravel Zero framework and then I have a branch called this right here pulled in this branch as your foundation no framework duh dependency but we have it PR for it and sometimes when I'm rushing I really hate writing up that like really good documentation like this but I'm like later I will be happy for it and so will other people so stop rushing that oh the PR is not here it's on framework I mean with knew it would be the same as new laravel project little air belt tool yeah and I think exactly I 100% agree I don't have to change how people are thinking about just like when John was originally building with Jason configuration and he switched it over to any configuration instead so that again all the old config files people had just keep working I love doing it that way unless the old way was terrible and in this way I think the old way was still great okay so what am I doing here I'm linking to my pull request right here and then right here now we can create split requests and we can merge it in and then we can spend 13 minutes working on presets after I take a drink of water y'all are such a great stream hangout crew alright let's get back let's get back to business to defeat the Huns all right git fetch origin get checkout mes presets and then get G cup which is GPR which is get pull rebase and then G sub cup which is how do you output the the content of a function is anybody know how to do that I done before I can't ever remember G cut basically looks at all your local branches and all your moat branches and if a remote branch got merged in or something like that it deletes it so it basically is just a cleanup thing that deletes any local branches you don't need anymore all right so let's get back into what we're doing which is presets so right now when we run something it's going to just do a dyeing dump and that will show us where were we working nope where were we working last time we were working right here right so let's go find that I believe that is in the run presets command and we have a run presets test which makes me happy OOP run presets test okay so let's just run here which G Cup which G Cup just tells you where oh if it's an alias then you're right hundred percent thank you so much I was thinking it just shows you where it is but if it's an alias so get branch - - merged so you're looking at all the branches that have been merged in and then looking for something in here I don't know what that is and then pulling out and then it's running git branch - D on them which basically deletes the branch locally so I'm not a regex person so somebody else will have to tell you what that does alright so run presets test so it they all ran so let's see what it's running for us it parses multiple parameters so you can see we're passing in two parameters - telescope it parses single parameters versus passing a single parameter telescope it handles multiple presets telescope and Nova it handles multiple parameters on multiple presets telescope AP blah blah Nova blah blah blah so we have tests that show us what we're building and test a whole bunch of different circumstances that makes me very happy now let's actually make them do something we know it's parsing them but we don't actually know because this is just testing this presets past method we don't actually know that it's gonna do the right thing so which is a good movie by the way okay so a rain array of standard class objects it's been two weeks with preset and parameters I have no idea what that means oh I think each standard a class object is gonna have a preset key and a parameters key keys so I think we're gonna do that so it's clear so I bet you if we look at the run presets test we'll see that that's what we're checking against yep each preset passed has a pre-set any parameters and the parameters is an array so we talked about last time about saying should we make a little data transfer object for these things I'm leaning more towards it now that we have to have like comments that are explaining what those things are shaped like like once you do that it's kind of like okay that's probably time for us to do that so let's build a quick thing well the oh no let's not build a quick thing yet because that would we both have we already have a bass preset class here we have preset pre-made presets and now we would also have to have a past preset class that represents that so I'm not sure so what does this do this parses out the work of exploding that whole syntax into our useable things and now finally in here for each of them we're gonna run the preset so let's take a look at what the preset looks like here it's probably gonna be that standard class object great so let's do presets equals I don't love the syntax telescope okay so now we're gonna get a preset telescope and does anybody know I mean I don't think we actually want to pass anything to telescope when we're installing it right I think it's just gonna be the telescope Doc's probably we go to here it does say configuration so maybe we want little Asif or some parameters I'm not sure so look at our telescope pre-made and we've got this composer requires thing that says give me laravel slash telescope at tilted 100 and then we run an after shelfs commands that's PHP ours in telescope : install I guess we could allow it to optionally define whether or not to do migrate but I don't think I want to do that oh you know what Deb only that's gonna be a perfect flag so let's see have we already figured out how to handle flags in here no so let's let's handle how to pass in parameters so let's pass in the parameter which is going to be so we can either do a dev only parameter or we can do a all environments I don't like how long all environments is I hate having to come up with these names why not just preset stuff I'm not sure what that means so let's do telescope right now we'll do devil only or only dev like that so we've got a parameter there's only dev we've got The Presets telescope so now we need to make sure that when we run this preset it actually gets it so let's see what is what's the actual callable command on the preset it gets constructed and then before and then run and then after so let's I think what we will do is we'll basically construct it run before run run oops run run oh my goodness run run run after why not touch a telescope calling local locals great I love that great work okay so for each of these commands we are going to want to first of all using this preset arrow preset we need to build it so we need to be able to have something somewhere that tells us on a preset what it's short name is and I don't actually think we have that anywhere now that I look at it if you look at the telescope preset we haven't defined what marks this as a short thing I'm inclined to well we could do it based on the based in the class name let's do it based on the class name for now just for funsies and see if that feels good so okay so let's find a class name so get telescope no get preset class name and then this is preset and it's going to be like the preset short name okay and we're gonna write a test for this which is going to be the run presets test and we might move this get preset class name out something else but for right now and we'll just assert that it's capable of generating the right name so function it generates the preset class names from short strings something like that so the interesting thing is we're going to be able to do it we're actually gonna have to check two places so let's actually make a new one this is going to be a get preset by short name and then it's going to return an instance of base preset or something that you know extends it so first of all we're gonna have to look in our local but this is where we're gonna start looking at about whether you've pulled something in from composer or something like that so both look for the class locally actually well look for the I don't know we're gonna look at the class in terms of okay look for the class pre-made class look for the handmade local class and then look for the composer loaded class and we haven't actually figured out exactly how it's gonna work how to close my door again because my dog I'm actually have my dog say hi real quick this is up there NASA's pickles what a good boy he is he's about nine years old he's half Chihuahua half Yorkie and it's my favorite little buddy aren't you okay not my favorite I love my kids too but he's a cute dog all right maybe you could make a help function at each preset when you run lambo help telescope oh I love that that is fantastic okay all right so let's um let's let's add that to the to do bit list just because it's getting so close that's a great idea I'm gonna credit you mmm and also Mo's offer I think I've asked you like 17 times am i saying your name right idea making a help function in each preset so when you run lambo help something telescope or something like that you learn what it does and what parameters it takes we also should create a lambo help presets thing to teach about what presets are available and how to use them okay I also don't know how to pronounce is it day day like here's another thing you can call me that you don't know how to pronounce so but muzaffer if that's right then I'll probably just stick with that okay cool so right now these are going to be to do we're just gonna work on the pre-made classes right now but I do want to look for the pre-made classes in a way that it's friendly for what I expect the eventual circumstance to be like and so I can't we can't just create the fully qualified class name here because it's gonna be different for these two right so what I think I'm gonna do is just from here return the class name not the fq c n so right now that's really just going to be laravel string helpers let's see congratulations hundred message great preset to be something you can install a separate package or these gonna have to be implemented in the lambo tool specifically americans and pronouncing non america things hey I tried to be an American who pronounces things correctly okay Marisa what I was thinking about is you're going to by default get a whole bunch of lambo presets out of the box and then other people can provide their own packages each of which have one or more presets in them so I guess how interesting I wonder if we could run right the presets in such a way where they could be used on existing projects maybe that's a really interesting idea can we write the presets so we can use lambo or something else question mark to run them on existing projects or in other contexts you could you should use composer package format to form namespace clashes for example presets equals Lambeau / telescope yeah I think that I don't want to do that for the the pre-made ones just because that's going to take extra work remember land was all about speed but I do agree that other people should be able when we pull in other people something like custom slash telescope and then this would be something like nuna maneuver oh I love that it's a great idea for the syntax slash telescope and but I think the premade classes at least for now I don't want to have to namespace them because I think I want it especially out of the box for the new people to just really feel like a telescope and everyone can tell me if that's like really terrible is there gonna be a preset look up oh like a like a single global place where people can look up presets is that we're thinking or like a website or something else Marissa that's an interesting idea okay so let's look for the pre-made class so fqc n is going to be app what app / presets [Music] short name and then basically just need to look up if that exists OOP there I'm sorry distracted what asking Marisa I said are you saying something like a like an NPM style repository we Rafi can people look them up or what kind of thing or you did you mean in terms of looking up other packages okay so if class exists or is a class defined defined I think fqc n then return new fqc n else throw new exception cannot resolve that preset our preset of course so this right here construct would be preset equals equals get preset by short named preset okay and then another's going to preset to preset Wow okay so let's run a test on this real quick basically composer global require M 50 my custom preset then I can use the preset fine yep a hundred sent that's exactly how I plan for it to work composer package you can cry globally yep 100 percent it hey MD Sohail Mia alright so oops is gonna be this alright we're out of time but I don't think I actually have a meeting after this so I want to get this one piece finished let me go check my schedule real quick I don't have a meeting after this so I'm gonna go for 15 minutes max let me actually set a timer so I don't go longer 13 minutes now all right I just realized been wearing my headphones this time I don't need to wear my headphones what am i doing wow this whole time I am an idiot okay wait has the chat not been working this whole time I just looked over at my OBS and I don't see any messages in the chat it was working and it stopped from probably going to switch to way over to starting soon oh no that's really weird oh it switches every time I hit with me got it okay so someone was saying you need to title case it yep John and that's that's thank you that's what I was doing here is title I think it's no we don't want a title case nope what is it called when you convert something from kabob case to title case with no spaces huh I think I can fix that y'all just so you know where it doesn't clear when I would change scenes I think camel yeah I think it's gonna be as camel because I think we're gonna be it's treating his kebab case right now when we got a camel in so let's try that um yeah STR okay hold on oh yeah you came for some reason I can't import STR I think it's uh has something to it being too short for V s code too unimportant I don't know oh it worked this time of course now that I say that it worked this time alright so we don't need anything changed here so let's write this test capitalized Oh upper camel case good point Wow is it is there no camel case that's like title cased because I think title case is is camel case yeah title cases camel case but with space that's crazy do we just need to you see first it at that point I feel like I want to do the whole fluent one I haven't actually gotten a chance to use the fluent helper right now so I kind of want to do that yeah let's do that because I've learned of it so string of thanks for subscribing Pascal case - fo CTN let's actually see if Pascal exists no it doesn't ok what's the difference screen talk it's Pascal case title case with no spaces i think that's problem it is so I bet you there's gonna be a camel oops in the fluent strings yep so we do a camel and there's probably also gonna be a you see first in the fluent strings and there is this is so much better I wish we had this everywhere else you see first great so that should work thank you so much whoever thought of that [Music] pascale looks like this yes exactly we wanted Pascal not camel okay so let's just new up our run presets so class equals new run presets I betcha it needs to be yep it does alright so let's do this and then we want to pass it in something so let's do [Music] oops how did I get multi selected there I have no idea this assert equals and let's just run some things so let's start with my favorite ever OOP that's not we want we want my favorite ever and we want it to be action get preset class name my favorite ever oops okay people are chatting so need to be something that converts it to a string at the end of the fluent strings though oh yes yep see there is it string from or string of those string of please tell me we're not on layer bail seven wow we're not on level seven you're kidding me I thought we'd upgraded nope we're on six well calm darn it John sugar will no I betcha it's um it's probably because we we run seven in a row request that I haven't merged yet you eight minutes all right cool so that works so now we want to do one that it gets the right class function it News premade presets from short strings and this is gonna be a little bit harder because I think that this is actually doing a 4-h no but get preset by short name I love it I love it alright so action equals app run presets class and then this assert I don't know if it is there an assertion about class type is like assert of type or something like that otherwise we can just assert equals and I get get class string equals file string equals I don't think there is one so we're probably just gonna do a is equals on get class assert instance of look at you you're freaking awesome assert is instance of I don't see it is that new maybe must be new I emerged my your measurement upgraded level of 0-7 but you haven't made a release which means I must not emerged it into this this particular branch John good point so what's true yeah I was gonna do assert true is instance of or or assert equals get class I guess isn't so instance of is better but real quick let's go to note home I keep going to OBS notion and add another note that says merge master into mes slash presets so we get lair well seven thanks John alright so we're going to do assert true instance of and then I never remember the order of those I think this PHP at eight but let's double check yes PHP unit eight must be a nine I don't even know which one is which an instance of oh that's because there's no underscoring instance of that's why there's also Iza and again I also never know Oh what's the difference Queen is an instance of Papa Papa blah blah blah which which is the best one to use y'all do you know original behavior evolved its to false new behavior instance I've also checked the target instantiate check of this specific class which sounds like we want what we want Oh PHP at nine okay so why did I not see a method definition because this is some all caps like constant type thing okay oh oh oh sorry that's why it's because it's not a method it's a that it's like a magic preset thing about junior whatever alright so we want to make sure that action whatever I had copied which is it now out of my copy register get preset by short name telescope is an instance of app presets pre-made telescope class right do we pass it in : : class note we literally just pass it into the actual thing like that which is just wild all right man I am rusty here huh I also don't have the PHP better PHP unit setup in my BS code as you can tell cannot resolve preset short name okay great so our thing fails red green refactor did I write that wrong I think that's right good old PHP 5 stuff exactly alright so let's look at what we're actually trying to create their app /b okay so it's not creating Oh cuz shouldn't be short name here it should be get preset class name right yep so class I don't know how you sit just in the base class and without the F qcn class name I guess class name equals this get preset classname nope get preset class name and then we're gonna pass in the short name and so that should now be with capital T but it's not oh right class name alright so that should now work nope not resolved preset telescope so defined is not working correctly because that presets oh because it's not that it's apps presets pre-made have I type this room app presets pre-made telescope app presets pre-made telescope okay so define is not working why is that is it one of those things we have to do like the my god well one thing that helps y'all is to put the correct slashes in and what I'm wondering is we have to put a preceding slash if it looks for defined within the current namespace so let's look there hmmm what are we doing wrong yeah thanks John maybe I'm using defined wrong in PHP again good old PHP five stuff like you were saying I try to avoid reflection classes if I can oh it's called the short name do we have to double back slash them we probably do now that you mention that yeah I bet you we do but that ain't working anyway without the fqc end yeah thanks Marv so defined okay checks whether giving named constant oh that's it so it probably is class exists I probably was right okay so that's failing too few arguments to bass preset construct I think we're trying to new it up great so we're trying to new it up in here but it where are we trying to do it up all right here but bass preset defines things in the constructor or does it define shell so let's app instead of mooing it and we're gonna app it so that it can get dependency injection heyyo so would it have worked without the double slashes and that well let's try without the proceeding yep and what about without the doubles the doubles probably wouldn't work let's just try yep so great work team um double slash shut the F Q saying Josh manners what's up ma'am alright we got one minute can we do anything useful so these are two do's this will work once we merge in the upgrade and now we're getting an instance of it and so on our preset on a bass preset we've always got a before a run and then after so let's just call them right here before alright let's let's add a couple tests for us to fill out next time to do new tests it news local presets it news composer required presets it errors if a preset is requested which doesn't exist it passes parameters to presets so we need to write those tests in them to make them actually function next time I'm actually curious whether we do we pass these parameters to all these methods before running after do we pass it when we knew it up I'm not actually sure so let's just throw that in here and call as well we're probably gonna pass it when we knew it up when mooing up the preset assume so question mark okay and that much bought a boat today Wow did not buy it boat thank you for the compliment on my haircut can we use sister studly case to get the class name what is Dudley case Oh times up let's look up studly case me down hope studly wait so studly our studly and Pascal the same thing our studly case getting used to my um old Microsoft sculpt keyboard and Pascal case the same Wow look at that thank you so much mojo Abba and all right so let's go right down here real quick and then make it do studly and then pull that out and we don't even really need to worry about that next time then why are why are there two with the same name is it just people Oh studly caps also knows I kind of like Pascal case better but that's okay studly studly does kind of make it a little bit it it reads a little bit more like oh I can assume what that's gonna be so thank you all so much for hanging out this was really good obviously we got a ton of work to do next week I just so you all know I'm probably gonna do a little tiny bit of work between now and next week because I want when Jason comes to be able to use Telus argues um my god blueprint and I don't want him to sit and watch me build presets the whole time I want to be building the the blueprint preset so I might do a little bit work between now next week and otherwise I will see you all
Info
Channel: Matt Stauffer
Views: 390
Rating: undefined out of 5
Keywords: laravel zero, cli tool, php cli tool, matt stauffer livestream, laravel cli, laravel tools, php cli, laravel zero example, development, education, live, livestream, php, programming
Id: QZUUUsyPg94
Channel Id: undefined
Length: 73min 45sec (4425 seconds)
Published: Thu Apr 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.