-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dd58f44
Showing
41 changed files
with
21,736 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
dist | ||
cabal-dev | ||
*.o | ||
*.hi | ||
*.chi | ||
*.chs.h | ||
.virtualenv | ||
.hsenv | ||
.cabal-sandbox/ | ||
cabal.sandbox.config | ||
cabal.config | ||
|
||
# hakyll generated files | ||
/.hakyll-cache | ||
/generated-site | ||
|
||
# stack | ||
.stack-work/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
# Use new container infrastructure to enable caching | ||
sudo: false | ||
|
||
# Choose a lightweight base image; we provide our own build tools. | ||
language: node_js | ||
|
||
# Caching so the next build will be fast too. | ||
cache: | ||
directories: | ||
- $HOME/.ghc | ||
- $HOME/.cabal | ||
- $HOME/.stack | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- ghc-8.0.2 | ||
- libgmp-dev | ||
sources: | ||
- hvr-ghc | ||
|
||
# Use the latest version of node-6 available | ||
node_js: "6" | ||
|
||
before_install: | ||
# Using compiler above sets CC to an invalid value, so unset it | ||
- unset CC | ||
|
||
# Download and unpack the stack executable | ||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH | ||
- mkdir -p ~/.local/bin | ||
- | | ||
travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' | ||
# Use the more reliable S3 mirror of Hackage | ||
mkdir -p $HOME/.cabal | ||
echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config | ||
echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config | ||
if [ "$CABALVER" != "1.16" ] | ||
then | ||
echo 'jobs: $ncpus' >> $HOME/.cabal/config | ||
fi | ||
install: | ||
- if [ -f configure.ac ]; then autoreconf -i; fi | ||
- | | ||
set -ex | ||
time stack --no-terminal --install-ghc test --bench --only-dependencies | ||
set +ex | ||
script: | ||
- | | ||
set -ex | ||
time travis_wait 30 stack --no-terminal test --bench --no-run-benchmarks --haddock --no-haddock-deps | ||
time stack exec -- site build | ||
set +ex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Copyright (c) 2017 Haskell-jp | ||
|
||
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. | ||
|
||
This project is forked from [arow-oss/blog](https://github.com/arow-oss/blog). | ||
Here is the original copyright notice for it. | ||
|
||
Copyright (c) 2017-2017 ARoW | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
.PHONY: build clean deploy release site watch | ||
all: site | ||
|
||
############# | ||
# Variables # | ||
############# | ||
|
||
# Path to the directory that `stack` uses to install binaries locally. | ||
STACK_LOCAL_INSTALL_PATH = $(shell stack path --local-install-root) | ||
|
||
# Path to the `site` binary. | ||
SITE_PROG_PATH = $(STACK_LOCAL_INSTALL_PATH)/site | ||
|
||
# The current commit's git hash. | ||
GIT_HASH = $(shell git rev-parse --short HEAD) | ||
|
||
################################ | ||
## Targets for specific files ## | ||
################################ | ||
|
||
# target for the `site` binary. This binary is used to actually create the | ||
# html files. | ||
$(SITE_PROG_PATH): src/site.hs | ||
@echo "Building..." | ||
@stack build | ||
@echo "Built." | ||
|
||
##################### | ||
## General targets ## | ||
##################### | ||
|
||
# Build the `site` binary. The `site` binary is used to build the actual .html | ||
# files for the site. | ||
build: $(SITE_PROG_PATH) | ||
|
||
# Clean all generated files. | ||
clean: | ||
@echo "Cleaning..." | ||
-@stack exec -- site clean 2>/dev/null || true | ||
@rm -rf .hakyll-cache/ generated-site/ | ||
@stack clean | ||
@echo "Clean." | ||
|
||
# Deploy the site. | ||
# Commit the generated-site directory to the gh-pages git branch. | ||
# The way this is done is pretty hacky, but it works. | ||
deploy: site | ||
# Make sure this temporary working directory is empty. | ||
# (TODO: Really we should be using a directory with a random filename, | ||
# generated with something like mktemp.) | ||
rm -rf /tmp/haskell-jp-blog-deploy/ | ||
mkdir /tmp/haskell-jp-blog-deploy/ | ||
# Copy the generated site to the temp directory. | ||
cp -r generated-site /tmp/haskell-jp-blog-deploy/ | ||
# Checkout the gh-pages branch. | ||
git checkout gh-pages | ||
# Remove the pages for the current site. | ||
git rm -r -f --ignore-unmatch * | ||
git status | ||
# Copy all of the generated site's files to the current directory. | ||
cp -r /tmp/haskell-jp-blog-deploy/generated-site/* ./ | ||
# Add everything back. (A lot of files probably won't change, so, for | ||
# instance, they won't show up on 'git status' even though we just did 'git | ||
# rm -rf *'. A 'git rm -rf FILE' followed by 'git add FILE' is a noop if | ||
# the file hasn't changed.) | ||
git add -A . | ||
git status | ||
# Do the commit and push. | ||
git commit -m "Release $(GIT_HASH) on `date`." | ||
git push origin gh-pages | ||
# Go back to master. | ||
git checkout master | ||
rm -rf /tmp/haskell-jp-blog-deploy | ||
|
||
# Alias for deploy. | ||
release: deploy | ||
|
||
# Generate the .html files for our blog. | ||
site: $(SITE_PROG_PATH) | ||
@# We don't actually need to use rebuild here, we could just use build. | ||
@# If this blog becomes really big and produces tons of pages, then switching | ||
@# to 'build' here (and adding an additional site-rebuild target) would be a | ||
@# good idea. | ||
stack exec -- site rebuild | ||
|
||
# Run a test webserver on http://0.0.0.0:8000 serving up the content of our | ||
# blog. If the content changes, it is automatically rebuilt. | ||
watch: $(SITE_PROG_PATH) | ||
stack exec -- site watch --host 0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
# Blog for [Haskell-jp](https://haskell.jp) | ||
|
||
[](http://travis-ci.org/arow-oss/blog) | ||
[](https://opensource.org/licenses/MIT) | ||
|
||
This is the blog for [Haskell-jp](https://haskell.jp). It is built with | ||
[Hakyll](http://jaspervdj.be/hakyll/index.html). The `Makefile` contains some | ||
simple targets for building the site. In order to use the targets in the | ||
Makefile, it is assumed that the `stack` build tool is installed. | ||
|
||
### Installing `stack` | ||
|
||
`stack` can be installed by following the directions from the [stack | ||
README](https://github.com/commercialhaskell/stack#how-to-install). Once stack | ||
is installed on your `PATH`, the following Makefile targets can be used. | ||
|
||
### Building the Blog | ||
|
||
``` | ||
$ make site | ||
``` | ||
|
||
Build the HTML for the actual site. Generated HTML is placed under `generated-site/`. | ||
|
||
### Run Webserver to Serve Blog and Rebuild on Changes | ||
|
||
``` | ||
$ make watch | ||
``` | ||
|
||
Run a test webserver that will serve our blog content. If the content is | ||
changed, it will automatically be rebuilt and you will be able to see the | ||
changes live. | ||
|
||
### Clean All Generated Files | ||
|
||
``` | ||
$ make clean | ||
``` | ||
|
||
Cleans out all generated files (such as `generated-site/` and `.hakyll-cache/`). Also runs | ||
`stack clean`. | ||
|
||
### Deploying the Blog | ||
|
||
``` | ||
$ make deploy | ||
``` | ||
|
||
First generates the site, then commits the generated files to the `gh-pages` | ||
branch. This is kind of hacky, but it seems to mostly work. | ||
|
||
### Publish a Post as Draft | ||
|
||
A sample post is in `posts/2017-03-25-sample-post.markdown`. | ||
Providing an option `draft: true`, the post is published as draft, which is listed in `/drafts` page. | ||
This feature is mainly used for the purpose of asking review to someone. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: haskell-jp-blog | ||
version: 0.1.0.0 | ||
build-type: Simple | ||
cabal-version: >= 1.10 | ||
license: MIT | ||
license-file: LICENSE | ||
|
||
executable site | ||
hs-source-dirs: src | ||
main-is: site.hs | ||
build-depends: base == 4.* | ||
, containers >= 0.5 | ||
, data-default >= 0.5 | ||
, hakyll | ||
ghc-options: -threaded -Wall | ||
default-language: Haskell2010 |
Oops, something went wrong.