Skip to content

Commit

Permalink
Merge pull request #37 from 47deg/jp-adds-more-documentation
Browse files Browse the repository at this point in the history
JP - Adds Additional Documentation
  • Loading branch information
juanpedromoreno authored Sep 23, 2016
2 parents c592a28 + e917afe commit 8b6ae3a
Show file tree
Hide file tree
Showing 36 changed files with 541 additions and 476 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
project/project/
project/target/
target/
deploy_key
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ before_install:
install:
- gem install jekyll -v 2.5

env:
global:
- ENCRYPTION_LABEL: "0d40c3508e9d"
- COMMIT_AUTHOR_EMAIL: "developer@47deg.com"

script:
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- sbt ++$TRAVIS_SCALA_VERSION test scripted

after_success:
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then bash deploy.sh; fi
- bash scripts/publishMicrosite.sh
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then bash scripts/deploy.sh; fi
- if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then echo "Not in master branch, skipping release"; fi
117 changes: 11 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,127 +1,32 @@
---
layout: home
technologies:
- scala: ["Scala", "sbt-microsites plugin is completely written in Scala"]
- sbt: ["SBT", "sbt-microsites plugin uses SBT and other sbt plugins to generate microsites easily"]
- jekyll: ["Jekyll", "Jekyll allows to transform plain text into static websites and blogs."]
---

[![Build Status](https://travis-ci.org/47deg/sbt-microsites.svg?branch=master)](https://travis-ci.org/47deg/sbt-microsites) [![Join the chat at https://gitter.im/47deg/sbt-microsites](https://badges.gitter.im/47deg/sbt-microsites.svg)](https://gitter.im/47deg/sbt-microsites?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# sbt-microsites

**sbt-microsites** is a sbt plugin tool that facilitates the creation of fancy microsites for your projects.

It's based in other awesome sbt plugins to make it posible, so basically, integrates everything in some basic steps to automatically create and publish the microsite to [GitHub Pages](https://pages.github.com/).

The plugin provides some basic free styles, css, and image resources by default, everything based [Bootstrap](http://getbootstrap.com/) framework. If you want to personalize color palette, styles and images you can do it in your project side in a easy way as you can see in the [documentation](https://47deg.github.io/sbt-microsites/docs.html).

In order to achieve the microsite creation, it uses directly these plugins and libraries:

* [tut-plugin](https://github.com/tpolecat/tut)
* [sbt-site](https://github.com/sbt/sbt-site)
* [sbt-ghpages](https://github.com/sbt/sbt-ghpages)
* [scalatags](https://github.com/lihaoyi/scalatags)

Additionally it depends on other useful libraries and plugins like:

* [sbt-native-packager](https://github.com/sbt/sbt-native-packager)
* [sbt-scalafmt](https://github.com/olafurpg/scalafmt)
* [sbt-pgp](https://github.com/sbt/sbt-pgp)
* [sbt-header](https://github.com/sbt/sbt-header)

## Prerequisites

* [sbt](http://www.scala-sbt.org/) 0.13.8+
* [jekyll](https://jekyllrb.com/)

To satisfy the `jekyll` prerequisite, here a couple of hints for local and travis environments.

### Local Environment
**sbt-microsites** is an SBT plugin that facilitates the creation of fancy microsites for your projects, with minimal tweaks.

Depending on your platform, you might do this with:
## What is a microsite?

```bash
yum install jekyll
A microsite is an instance of Jekyll, ready to publish a static web page for your new library. Some of the benefits of having these auto-generated web pages are:

apt-get install jekyll
- You can write documentation easily in markdown format.
- Templates, layouts, styles, and other resources will be able through the plugin at compile time.
- You don't have to deal with the styling.

gem install jekyll
```

### Continuous Integration - Travis

If you have enabled [Travis](https://travis-ci.org/) for your project, you might have to tweak some parts of your `.travis.yml` file:
# Installation

Potentially, your project is a scala project (`language: scala`), therefore you need to add the bundle gems vendor path in the `PATH` environment variable:
To Begin, add the following lines to the `project/plugins.sbt` file within your project or sbt module where you want to use the `sbt-microsites` plugin.

```
before_install:
- export PATH=${PATH}:./vendor/bundle
```

This is needed in order to install and be able to use `jekyll` gem from other parts of your project. We have to do it in the Travis `install` section:

```
install:
- ...
- gem install jekyll -v 3.2.1
```

## Setup

First of all, add the following lines to the `project/plugins.sbt` file, within your project or sbt module where you want to use the `sbt-microsites` plugin. Depending on the version:

Latest release:
```
addSbtPlugin("com.fortysevendeg" % "sbt-microsites" % "0.2.0")
```

Latest snapshot built from the `master` branch code:

```tut:evaluated
println("""resolvers += Resolver.sonatypeRepo("snapshots")""")
println(s"""addSbtPlugin("com.fortysevendeg" % "sbt-microsites" % "${microsites.BuildInfo.version}"""")
```

Finally, to enable the plugin, add this to your `build.sbt` file:
```
enablePlugins(MicrositesPlugin)
```

## Build the microsite

Once you have written down your documents you can build the microsite running this sbt task:

```
sbt> makeMicrosite
```

Internally, sequentially it'll run other tasks, among theirs, [`tut`](https://github.com/tpolecat/tut) and `makeSite` ([sbt-site](https://github.com/sbt/sbt-site)) tasks.

## View the microsite in your browser

1. In a shell, navigate to the generated site directory in `target/site`

2. Start jekyll with `jekyll serve`

3. Navigate to http://localhost:4000/yourbase_url/ in your browser, where `yourbase_url` depends on your own preferences (see `micrositeBaseUrl` setting).

## Publish the microsite

Before publishing, a couple of requirements should be satisfied:

1. Initializing the gh-pages branch, you can follow the instructions defined in the [sbt-ghpages](https://goo.gl/G0Ffv0) repository
2. Define `micrositeGithubOwner` and `micrositeGithubRepo` settings, you can see more details about them later on in this document

Once both requirements are satisfied, you can just run:

```
sbt> publishMicrosite
```

## Examples
We recommend taking a look at the `Getting Started` section at the [documentation](https://47deg.github.io/sbt-microsites/docs/getting-started.html) since there are some prerequisites that are needed to build your microsite.

Apart from the microsite for this plugin that you can finde in the `docs` sbt module in this repository, a quite complete example is located on https://github.com/47deg/dummy-sbt-microsite.
# Documentation

Please see the [documentation](https://47deg.github.io/sbt-microsites/docs.html) for more information.
Microsites comes with a range of options to customize and configure your project's site. Please visit the [documentation](https://47deg.github.io/sbt-microsites/docs/) section for more information.
5 changes: 2 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lazy val artifactSettings = Seq(
name := "sbt-microsites",
organization := "com.fortysevendeg",
organizationName := "47 Degrees",
homepage := Option(url("http://47deg.github.io/sbt-microsites/")),
homepage := Option(url("http://www.47deg.com")),
organizationHomepage := Some(new URL("http://47deg.com")),
headers := Map(
"scala" -> Apache2_0("2016", "47 Degrees, LLC. <http://www.47deg.com>")
Expand All @@ -32,10 +32,9 @@ lazy val micrositeSettings = Seq(
micrositeName := "sbt-microsites",
micrositeDescription := "A sbt plugin to create awesome microsites for your project",
micrositeBaseUrl := "sbt-microsites",
micrositeDocumentationUrl := "/sbt-microsites/docs.html",
micrositeDocumentationUrl := "/sbt-microsites/docs/",
micrositeGithubOwner := "47deg",
micrositeGithubRepo := "sbt-microsites",
micrositeExtraMdFiles := Map(file("README.md") -> "index.md"),
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.md"
)

Expand Down
Binary file added deploy_key.enc
Binary file not shown.
191 changes: 0 additions & 191 deletions docs/src/main/tut/docs.md

This file was deleted.

Loading

0 comments on commit 8b6ae3a

Please sign in to comment.