Transcript from the "Unstowing and Common Stowing Issues" Lesson
>> So let's go back into our stow dr and I wanna do something, I'm gonna unstow, I'm gonna unstow tmux. Now, what do you think happens here?
>> It removes just that symlink, just the last one.
>> All right, great, great guess I think that's actually a pretty darn good guess.
[00:00:14] That's what I would have guessed as well. So let's re execute our find command just to see. All right, and now you'll notice, we see nothing inside of config, it must be a symlink. Right, so let's Config was a folder. It is now a symlink. So it keeps on bringing back as far as it can, the symlink as far into the tree as it possibly can, so that was pretty cool because now I only have one thing stowed, so it doesn't need to do the whole file tree.
[00:00:41] It only needs to operate on a very small amount. And so let's do one more kind of cool test to really prove this thing out. Let's go to nvim, let's go into the config and have a config -file, all right? So config -file, obviously it's just a file that's existing.
[00:00:56] So let's quit, let's go back, so our target directory still has. It still just config pointing to nvim config. But now there's multiple things inside of that folder. Right, there's both the nvim folder that has my And it also has this config file that's just like hanging around, right?
[00:01:15] So let's go like this. Let's go back into my stow folder, and that's stow tmux. Now remember tmux also has a .config folder, but it has different sub folders after that. So when we go down here, and we'd give it a little ls.la inside of our .config, what you'll see is that config file is now a symlink.
[00:01:35] It was able to go okay, the symlink was pointing to just .config in Neovim, but Neovim has several sub files within it. We're gonna go through all of those and symlink them all out. So kept the structure of the .config folder within nvim and then updated it with tmux.
[00:01:53] So this is really cool because it was able to dynamically be able to take care of that. And of course, if I go back in here, and unstow Neovim, what do we call it? And then we go back out and we do our little ls, it'll just be back now to just a config symlink pointing to the tmux.
[00:02:10] And so, it's really able to kind of move these things around pretty, it's really, really slick. So let's try this, I'm gonna go like this .config, I'm gonna remove that, that config, I don't know why I put in. It's technically a symlink and I need to have a directory in there.
[00:02:25] Now what I'm gonna do is, I'm actually gonna make .config. And then not only am I gonna make .config, I'm gonna put in config file, right? I'm gonna put it in the config file, right, there we go. So inside my config, I have a file called config. So I do a find it's right here.
[00:02:40] Right and so, let's go back to our stow directory and let's stow tmux. Now, what do you think just happened this time? Now before if you remember, it converted the config folder into a symlink, will it do it this time? Well the reality of the situation is that no it won't, because that folder was already created.
[00:03:06] It cannot operate on a folder that has things in it that aren't just purely symlinks. So it's gonna go okay, this is just part of the path. That person wants this to be a real path. I'm not gonna just start deleting paths for you, I will only remove symlink that makes sense and so it does it right here.
[00:03:24] So it's gonna take that .config, it's gonna keep that around and then just simply symlink out to that tmux folder. Awesome, it looks like it's working really, really well but there are still more things. So let's go back in here, let's open up this, I call the test file.
[00:03:39] Let's rename test file to config, so there we go up. Actually in here that's the one we want to rename to config, there we go. So awesome, so now if we go in here you'll notice that Neovim has a .config file folder with a config file. And if I go back out here and I do the exact same thing in here, you'll notice that our config also has the exact same setup.
[00:04:03] So what happens now when we try to stow Neovim? Now what's gonna happen? Well, when you try to run it, it says whoa. I can't do that because there's a real file there, I can't mess with things that aren't real files. And so stow will try to be as smart as possible.
[00:04:22] It will try to operate in such a way that it doesn't screw you but if you have conflicting tree structures, it won't be able to operate. And so here's kind of that example. So that's how I do it. So when I'm in my Ansible folder, let's go here, let's go .files.
[00:04:41] You'll notice that I literally go to my .files repo, cd to my .files repo and execute ubuntu. So let me just open that up really quickly, .files then ubuntu, there we go. I have a bunch of folders that I have and I just simply execute install. Install all, install does, it just goes through everything that is a part of my stowed folders and just unstow them and resells them.
[00:05:08] I know you can actually do it both in one in a singular action. I was just doing this during my testing times. But nonetheless, it goes through and it just simply install these. So my answer will script calls my ubuntu script, which sets all the stow folders that it needs to be stowed.
[00:05:24] And then I just stow them one at a time from my .files repo, which means that my entire home directory then gets everything, so I can cut out my tmux. You can see my tmux config is actually a symlink okay, [INAUDIBLE]. There we go, you can see right away that it's actually pointing into my .files into my tmux folder into my tmux.
[00:05:51] So it actually goes and it knows how to operate on my home directory. So that means when I execute Ansible, it makes sure all these things are there for me and when I did it inside that Docker container, you'd see the exact same setup because I'm using that program to make sure everything is up to date.
[00:06:07] Now, this seems like a lot of work, right? So I think a lot of you go, well you know my script, it mostly works, it's good enough, stow is better, right? Stow is just in reality better than your script. It just knows how to do all these things and it's really, really good at it.
[00:06:24] And so, I like using stow because I don't have to maintain the script, but I think there's more to it. Okay, I think there's more to it that's gonna make it even better. So hopefully you're feeling the tingle right now, you're feeling the excitement. You're very like, man, I can't believe this is all available.
[00:06:39] My setup of a system and my maintenance of a system, have now become significantly easier. That's really what I'm hoping you walk away with in section one, is that all the worst parts about development which is really system setup going to a new company. Which by the way, little pro tip, you're at a company right now if you are, make an Ansible install for your team and share with your team boom promotion millions of dollars yacht, it'll be fantastic.
[00:07:04] People just think you're the smartest person in the universe. Because you're now just saved your team onboarding, right? When it's time to onboard hey Ansible pull, it installs everything your systems ready. Awesome, right? It's gonna spread like wildfire. Alright and by the way I opened up vim, and you're probably thinking, how's he flying so fast during vim?
[00:07:23] Well, guess what? I did a course on it like the second time I mentioned it, come on. It's ridiculous, it's like I've planned this out to be such a shill.