> NOW PLAYING: Another Medium - Toby Fox
recently i found out that neocities has a command line interface that you can use to essentially run your website from the terminal application on your computer– pretty similar to git, but with a bit less tools. this was very exciting for me, mostly because i love the feel of running things from the terminal but also because (with the help of windows task scheduler) it means i can do automatic uploads for long gone legends and the monthly updates over in the interests section of my website. so let's dive into it, shall we?
the neocities CLI uses ruby, so i downloaded that first– i dont personally have a lot of experience with it but i'd love to learn some when i have the time. once you have ruby on your computer you just grab the neocities gem! there's also a neocitizen gem available to download which should build upon the neocities gem, but i haven't tested it yet since i'm having issues with the download. (ps, on the off chance someone with more familiarity with ruby comes across this, i'd love to chat in more detail– just email me :-). also, i hope you're enjoying the shit blunders of my rookie programmer ass.)
once you do get the gem set up you can pull your website using your log-in credentials– it's not as much security as github, but it's definitely efficient. just typing in 'neocities' brings up a short guide to available commands.
so, pretty simple, right? the push command just lets you upload your current directory to the root directory of your site (i'll get to that later), the upload command lets you upload specific files to a specific directory if given an argument for such, etc, etc.
the very first thing you want to make sure of when interacting with your site from the command line is that you're in the right directory– or else you might end up uploading your entire goddamn computer to neocities dot org. don't do that! i'm sure you have some shit on your computer you don't want popping up in the updates feed— ssh keys, old school transcripts, porn, whatever. neocities offers the handy dry run argument if you want to double check you're not fucking anything up.
anyways, now that i had this shiny new capability i wanted to test it out– i got the CLI set up late september with monthlies coming up around the corner, which was a perfect opportunity, in my opinion. i did end up fiddling with it before i got to uploading the monthlies, though, which was a really good decision.
when you push something in the command line it uploads the full, local directory to your site's root directory. so, say you're working in a directory you use to maintain your blog, and you want to upload the entire local blog directory to your blog directory on-line. there is, as far as i've found, no efficient way to do this. you can use the push command but i haven't personally found a way to arrange it to a specific directory outside of the root. the other option is the upload command, but you can't specify a directory– it has to be individual files. of course, this is only with a few days of experience with the CLI under my belt, so maybe there is someway to do this, but it's certainly not intuitive.
maybe i'm just new to this. either way…
i ended up sending all of the long gone legends directory to the main directory of my site. woohoo. i'm not 100% on how it works with identically named files, but i did manage to preserve the main index.html without the long gone legends index replacing it. i did end up manually removing each file from the long gone legends directory.
another issue i came across that's more my fault than anyone else's– each long gone legends page prior to a few days ago was named with the extension '.jpeg', which, when run through the CLI, ended up corrupting the files. cool! it's good that i had back ups for the official pages, but i've yet to find the same for the beta version. sorry about that. i may find a pdf of it somewhere. they're all, appropriately, ending with '.jpg' now.
i'm not sure what the point of writing this is. i think a lot of neocities users don't realise that the CLI is there– if they do, i certainly haven't been made aware. even with the aforementioned stumbles i do think it's a lot better than just copy pasting the changes into each individual file from local to public, and it's definitely better for making sure your local & public site files match!
of course, this is only really applicable if you edit off-line.
anyways, once i get more familiar with the CLI i'll probably write a beginners guide on using it! i'd also still like to get the neocitizen gem installed, but that'll take some time. have a good evening :-)!