Using and Mastering Cookiecutter Transcripts
Chapter: Getting started using Cookiecutter
Lecture: Concept: Running a template

Login or purchase this course to watch this video and the rest of the course contents.
0:01 We just ran the cookiecutter-bottle template.
0:04 Let's look inside and see what happened.
0:07 From the outside, we typed in cookiecutter and we gave it the git repo,
0:10 it ask us a bunch of questions, we could either take the defaults or just hit enter,
0:14 and then, we had a project ready to go, all we had to do is cd into,
0:18 whatever we called our project, install the requirements and run the server,
0:22 just like that, we had our web application running bottle,
0:25 we didn't have to go and create all the files and set up the configs
0:28 or anything like that, so you saw we can use cookiecutter-bottle
0:31 to get started really quickly with a bottle web app.
0:34 So, let's look behind the scenes.
0:36 When we ran the command, cookiecutter (space) git repo,
0:39 it ask for some inputs, it took those inputs
0:41 either the defaults or the ones we provided
0:43 and it applied those somehow to our app, first thing that happens, git clone.
0:48 So, cookiecutter is going to do a git clone of that repo
0:52 into our local .cookiecutter's hidden directory
0:55 now this is hidden on a Mac or on Linux,
0:58 on Windows it's still called .cookiecutters but the . (dot) doesn't mean hidden
1:01 in Windows so it just shows up in your user profile,
1:04 I guess that's probably unfortunate but it's not a big deal.
1:06 now you can see if we say ls we've got
1:09 cookiecutter bottle, cookiecutter template and one for Pyramid,
1:12 and once those are here we no longer have to use the remote address
1:15 we can just get them from here.
1:17 If we happen to pass in a local template, not one on the network,
1:19 but just one on our file system, it wouldn't copy it here,
1:22 it would just run it out of that location.
1:24 And you see once I go into the cookiecutter-bottle,
1:27 my prompt changed to something recognizing it as git,
1:31 why- because as you saw, this is github repository, it just literally cloned it,
1:36 we have all the branches and everything.
1:38 If we do this on Windows, it's very similar,
1:40 but we just have a .cookiecutters folder, right,
1:43 but other than that, this is basically the same thing.
1:46 So, regardless of the operating system you have,
1:49 you're going to take this directory,
1:51 you're going to feed it over to the cookiecutter engine;
1:53 the cookiecutter engine is going to look at a lot of things,
1:55 most importantly, cookiecutter.json and it's going to take our inputs,
1:58 really that's where the prompts come from and then take the inputs from that results,
2:01 feed it here and then take the directory structure plus our inputs
2:04 and generate our project skeleton.
2:07 And then, you're done, you're done using cookiecutter
2:10 you can go now and work with your project and run it however you want.
2:13 If it's a Python project you can go run it with Python if it's a C++ project,
2:16 you open it up and compile it, whatever you want to do, it's now ready to roll.
2:21 We also saw that once we've installed the template because it copies it
2:25 and it clones it into that .cookiecutter's directory,
2:27 we can just run it with the short name,
2:30 so if we say cookiecutter cookiecutter-bottle it's just going to look in
2:33 .cookiecutters for that project and either it will find it and run it,
2:36 or it will just say I have no idea what this is.
2:39 Right, but because we already ran it here, everything works like a charm.