|
| 1 | +--- |
| 2 | +title: How to make a Lesson for DUNE |
| 3 | +teaching: 30 |
| 4 | +exercises: 0 |
| 5 | +questions: |
| 6 | +- How can I make a lesson like this from scratch using the DUNE template |
| 7 | +objectives: |
| 8 | +- Learn how to set up locally to build a lesson and to deploy it. |
| 9 | +keypoints: |
| 10 | +- If you can do basic markdown, you can do this. |
| 11 | +--- |
| 12 | + |
| 13 | + |
| 14 | +## Here I describe how I built this lesson. You can follow along. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +> #### Note: |
| 19 | +> Check out the [previous episode]({{ site.baseurl }}/00-Local-Setup-For-Local-Build.html)to set up a local server and to do local builds. |
| 20 | +{: .callout} |
| 21 | + |
| 22 | +## First you need to decide on a name for your new lesson. |
| 23 | + |
| 24 | +> #### Note: |
| 25 | +> Because github insists on using gh_pages for deployment, it is good to use your own github account for initial (and ongoing) development and pull over to /DUNE/ for the official version rather than using branches in the /DUNE/ github area. |
| 26 | +{: .callout} |
| 27 | + |
| 28 | +## Do local setup for local rendering (optional) |
| 29 | + |
| 30 | +Then follow the instructions [https://carpentries.github.io/lesson-example/setup.html#setup-for-local-rendering-of-the-lessons-optional](https://carpentries.github.io/lesson-example/setup.html#setup-for-local-rendering-of-the-lessons-optional) for setup on your local machine - in principle this is optional but in practice it is really helpful. You are going to need ruby and pyYAML. I used conda on a mac but they have instructions for Windows, Mac and UNIX. |
| 31 | + |
| 32 | +> #### Alert!!! |
| 33 | +> At this point you should stop following their instructions and start using our template to avoid overwriting DUNE specific items. |
| 34 | +{: .callout} |
| 35 | + |
| 36 | +## Then import this template. |
| 37 | + |
| 38 | +- Use the [GitHub’s importer](https://github.com/new/import) to make a copy of this repo in your own GitHub account. (Note: This is like a GitHub Fork, but not connected to the upstream changes) |
| 39 | + |
| 40 | +- Put the URL of this repository, that is https://github.com/DUNE/lesson-template.git in the “Your old repository’s clone URL” box. |
| 41 | + |
| 42 | +- Select the owner for your new repository (you). |
| 43 | + |
| 44 | +- Set the name you chose for your lesson repository. |
| 45 | + |
| 46 | +- Make sure the repository is public. |
| 47 | + |
| 48 | +> #### Note: |
| 49 | +> Please import to your own account and new lesson, work there and then move it over to `/DUNE/` once you have a decent draft in place. |
| 50 | +{: .callout} |
| 51 | + |
| 52 | + |
| 53 | +The difference from the carpentries is the addition of the DUNE logo and stuff specific to our lessons. |
| 54 | + |
| 55 | + |
| 56 | +## now make a local copy on the gh-pages branch and edit away |
| 57 | +~~~ |
| 58 | +git clone -b gh-pages <your new repository> |
| 59 | +~~~ |
| 60 | +{: .language-bash} |
| 61 | + |
| 62 | +You need to look at the following pages. |
| 63 | + |
| 64 | +- `_config.yml ` to set the title and other parameters for the lesson |
| 65 | +- `AUTHORS` to tell people who is doing this |
| 66 | +- `CITATION` how to cite the page - often just the URL |
| 67 | +- `LICENSE` you can keep it as is |
| 68 | +- `LICENSE.md` |
| 69 | +- `README.md` |
| 70 | +- `reference.md` |
| 71 | +- `setup.md` This is currently the full setup for new users. |
| 72 | + |
| 73 | +Then throw your individual modules into `_episodes` with leading numbers to set the order. The code will follow the ordering of the files in `_episodes`. |
| 74 | + |
| 75 | +There are very nice examples and a formatting tutorial at: [https://carpentries.github.io/lesson-example/](https://carpentries.github.io/lesson-example/) |
| 76 | + |
| 77 | +You can throw supplemental stuff into `_extras`. |
| 78 | + |
| 79 | +## You can then build your site locally either as a server or just a local site. |
| 80 | + |
| 81 | +### local site |
| 82 | + |
| 83 | +~~~ |
| 84 | +make site |
| 85 | +~~~ |
| 86 | +{: .language-bash} |
| 87 | + |
| 88 | +This does a lot of setup - it's pulling in a lot of ruby "gem" files. |
| 89 | + |
| 90 | +Your local site will be in _sites/index.html |
| 91 | + |
| 92 | +#### Checking |
| 93 | + |
| 94 | +~~~ |
| 95 | +make lesson-check |
| 96 | +~~~ |
| 97 | +{: .language-bash} |
| 98 | + |
| 99 | +will tell you about all the FIXME's you haven't fixed and missing formatting syntax. |
| 100 | + |
| 101 | +### local server |
| 102 | + |
| 103 | +~~~ |
| 104 | +make serve |
| 105 | +~~~ |
| 106 | +{: .language-bash} |
| 107 | + |
| 108 | +will launch a web server and a site at: `http://127.0.0.1:4000` |
| 109 | + |
| 110 | +You need to reload the web site to see your changes. |
| 111 | + |
| 112 | +> ### Note: |
| 113 | +These will hang around until you kill them so if you try to launch twice so look for processes with: |
| 114 | +{: .callout} |
| 115 | + |
| 116 | + |
| 117 | +~~~ |
| 118 | +ps -ef | grep jekyll |
| 119 | +~~~ |
| 120 | +{: .language-bash} |
0 commit comments