Skip to content

Commit

Permalink
Adding the LICENSE file and updating the README
Browse files Browse the repository at this point in the history
  • Loading branch information
denisftw committed Mar 24, 2016
1 parent b693f10 commit 21181d4
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 8 deletions.
17 changes: 17 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
91 changes: 84 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Licensed under the MIT License, see the LICENSE file.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "s2gen"

version := "0.2.0"
version := "0.2.1"

scalaVersion := "2.11.8"

Expand Down

0 comments on commit 21181d4

Please sign in to comment.