diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e9af1f3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +The MIT License (MIT) + +Copyright (c) 2016 Denis Kalinin & Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and +to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 3315f0c..7bbc06c 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,90 @@ This is a simple static site generator written in Scala for my web-site [appliedscala.com](http://appliedscala.com/). It assumes that you write the content in Markdown and use Freemarker as a template engine. The generator supports watching for file changes and is completely unopinionated about organizing front-end assets. -## Tutorial +## Getting started + +Download the latest release from [the release page](https://github.com/denisftw/s2gen/releases/latest) + +Extract the downloaded package to any directory and add `s2gen` +executable to the `PATH`. To achieve that, you can edit your `.bashrc`: + +```bash +S2GEN=/home/user/DevTools/s2gen +PATH=$S2GEN/bin:$PATH +``` + +Initialize a skeleton project in an empty directory by typing the following: + +``` +$ s2gen -init +``` + +The following directory structure will be generated: + +``` +$ tree -L 4 +. +├── content +│   └── blog +│   └── 2016 +│   └── hello-world.md +├── s2gen.conf +├── site +│   └── css +│   └── styles.css +└── templates + ├── archive.ftl + ├── blog.ftl + ├── footer.ftl + ├── header.ftl + ├── index.ftl + ├── main.ftl + ├── menu.ftl + ├── page.ftl + ├── post.ftl + └── sitemap.ftl + +6 directories, 13 files + +``` The example configuration can be found in `s2gen.conf` (HOCON format). -The main idea here is to specify the base directory. -Other directories are expected to be relative to it. +The default settings are mostly fine, but feel free to change the `site.host`. +In order to generate the site, simply type: + +``` +$ s2gen +[15:09:43.960] [INFO ] SiteGenerator - Cleaning previous version of the site +[15:09:43.997] [INFO ] SiteGenerator - Generation started +[15:09:44.114] [INFO ] SiteGenerator - Generating the archive page +[15:09:44.236] [INFO ] SiteGenerator - The archive page was generated +[15:09:44.236] [INFO ] SiteGenerator - Generating the sitemap +[15:09:44.238] [INFO ] SiteGenerator - The sitemap was generated +[15:09:44.238] [INFO ] SiteGenerator - Generating the index page +[15:09:44.239] [INFO ] SiteGenerator - The index page was generated +[15:09:44.446] [INFO ] SiteGenerator - Successfully generated: 2016/hello-world.md +[15:09:44.447] [INFO ] SiteGenerator - Generation finished +[15:09:44.447] [INFO ] SiteGenerator - Registering a file watcher +[15:09:44.683] [INFO ] SiteGenerator - Waiting for changes... +``` + +After generating, **s2gen** switches to the monitor mode and starts waiting for file changes. +Generated HTML files will be placed to the site directory. +Frontend assets (styles, scripts, images, fonts) could also be added +to this directory manually and **s2gen** will not touch them. + +In order to test the site in the browser, you can use a NodeJS based HTTP server: + +``` +$ npm install http-server -g +$ http-server -p 8080 site +Starting up http-server, serving site +Available on: + http:127.0.0.1:8080 + http:192.168.1.103:8080 +Hit CTRL-C to stop the server +``` + +## Copyright and License -Your version of this file must be placed in the root directory of your project. -In this directory, provided that `s2gen` is in `PATH`, you can start the generator by typing `s2gen`. -It will attempt to generate HTML files and switch to the the monitor mode. -In order to stop the generator, press `Ctrl/Cmd+C`. \ No newline at end of file +Licensed under the MIT License, see the LICENSE file. \ No newline at end of file diff --git a/build.sbt b/build.sbt index 963f8f2..f48dc86 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "s2gen" -version := "0.2.0" +version := "0.2.1" scalaVersion := "2.11.8"