Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #65 from goreleaser/site
Browse files Browse the repository at this point in the history
feat: added website
  • Loading branch information
caarlos0 committed Apr 17, 2018
2 parents f016947 + e773d04 commit ce436e3
Show file tree
Hide file tree
Showing 25 changed files with 571 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -20,7 +20,7 @@ deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: treeout
local_dir: www/public
target_branch: master
repo: goreleaser/goinstall
verbose: true
Expand Down
29 changes: 15 additions & 14 deletions Makefile
Expand Up @@ -3,17 +3,23 @@ TEST_PATTERN?=.
TEST_OPTIONS?=
OS=$(shell uname -s)

export PATH := ./bin:$(PATH)

setup: ## Install all the build and lint dependencies
mkdir -p bin
go get -u golang.org/x/tools/cmd/cover
go get -u gopkg.in/alecthomas/gometalinter.v2
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | bash
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | bash
curl -sfL https://install.goreleaser.com/github.com/alecthomas/gometalinter.sh | bash
ifeq ($(OS), Darwin)
brew install dep
curl -sfL -o ./bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck_darwin
else
curl -sfL -o ./bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
endif
chmod +x ./bin/shellcheck
dep ensure
gometalinter.v2 --install
.PHONY: setup

install: build ## build and install
Expand All @@ -29,39 +35,34 @@ fmt: ## gofmt and goimports all go files
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done

lint: ## Run all the linters
./scripts/lint.sh
gometalinter --vendor ./...

precommit: ## Run precommit hook
./scripts/lint.sh
precommit: lint ## Run precommit hook

ci: build lint test ## travis-ci entrypoint
./samples/godownloader-goreleaser.sh
git diff .
./bin/goreleaser --snapshot

build: hooks ## Build a beta version of goreleaser
go build
./scripts/build_samples.sh
./scripts/build-site.sh

.DEFAULT_GOAL := build

generate: ## regenerate shell code from client9/shlib
./makeshellfn.sh > shellfn.go

.PHONY: ci help generate samples clean
.PHONY: ci help generate clean

clean: ## clean up everything
go clean ./...
rm -f godownloader
rm -rf ./bin ./dist ./vendor
git gc --aggressive

# https://www.client9.com/automatically-install-git-hooks/
.git/hooks/pre-commit: scripts/lint.sh
# TODO: this could be echo 'make lint' >> .git/hooks/pre-commit and we
# could remove the lint.sh script
cp -f scripts/lint.sh .git/hooks/pre-commit
hooks: .git/hooks/pre-commit
hooks:
echo "make lint" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
Expand Down
38 changes: 38 additions & 0 deletions scripts/build-site.sh
@@ -0,0 +1,38 @@
#!/bin/sh -ex

# use gfind on osx
if which gfind >/dev/null 2>&1; then
alias find=gfind
fi

# add ./bin to PATH as well
export PATH="./bin:$PATH"

# clean up
rm -rf ./www/public
rm -rf ./www/static/github.com
rm -rf ./www/data/projects
mkdir -p ./www/data/projects

# generate the sh files
./godownloader --tree=tree ./www/static/

# lint generated files
# SC2034 is unused variable
# some generated scripts contain 1 or more variables with aren't used
# sometimes.
find ./www/static -name '*.sh' | while read -r f; do
shellcheck -e SC2034 -s sh "$f"
shellcheck -e SC2034 -s bash "$f"
shellcheck -e SC2034 -s dash "$f"
shellcheck -e SC2034 -s ksh "$f"
done

# generate the hugo data files
find tree -name '*.yaml' -printf '%P\n' | while read -r f; do
ff="$(echo "$f" | sed -e 's/\.yaml//' -e 's/\./-/g' -e 's/\//-/g')"
echo "path: $f" | sed 's/\.yaml//' > ./www/data/projects/"$ff.yaml"
done

# generate the site
hugo -s www -d public
23 changes: 0 additions & 23 deletions scripts/build_samples.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/lint.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/shellcheck.sh

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions www/.gitignore
@@ -0,0 +1 @@
public/
5 changes: 5 additions & 0 deletions www/config.toml
@@ -0,0 +1,5 @@
baseURL = "http://install.goreleaser.com/"
languageCode = "en-us"
title = "Install | GoReleaser"
pygmentsCodeFences = true
pygmentsStyle = "dracula"
23 changes: 23 additions & 0 deletions www/content/add-your-project.md
@@ -0,0 +1,23 @@
---
title: Add your project
weight: 10
---

This will guide you on how to add your own project to this site.

If you use [GoReleaser], all you need to do is to add an empty YAML
file to the [GoDownloader] `tree` folder, under the right path.

For example, if your project lives under `https://github.com/foo/bar`, you
may create the YAML file at `tree/github.com/foo/bar.yaml`.

After that, you just need to open a pull request, and everything will happen
magically.

If you do not use [GoReleaser], additional steps will be required.
<!-- TODO: document additional steps here -->

[GoReleaser]: https://goreleaser.com
[GoDownloader]: https://github.com/goreleaser/godownloader

You can see the list of all projects being served [here](/projects).
10 changes: 10 additions & 0 deletions www/content/introduction.md
@@ -0,0 +1,10 @@
---
title: Introduction
weight: 1
---

Install scripts generated by godownloader!

This page contains scripts generated using [godownloader].

[godownloader]: https://github.com/goreleaser/godownloader
10 changes: 10 additions & 0 deletions www/content/projects.md
@@ -0,0 +1,10 @@
---
title: Projects
weight: 100
layout: projects
hide: true
---

This is the list of all projects being served in this site.

You can see both the project path and the one-liner to install it here.
1 change: 1 addition & 0 deletions www/data/.gitignore
@@ -0,0 +1 @@
projects/*.yaml
15 changes: 15 additions & 0 deletions www/layouts/_default/baseof.html
@@ -0,0 +1,15 @@
{{ partial "head" . }}
<body>
<div class="Wrapper">
<div class="Container">
{{ partial "header" . }}
<div class="Content-wrapper">
{{ partial "menu" . }}
<div class="Content">
{{ block "main" . }}{{ end }}
{{ partial "footer" . }}
</div>
</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions www/layouts/_default/list.html
@@ -0,0 +1,11 @@
{{ define "main" }}
{{ .Content }}
{{ range .Data.Pages.ByWeight }}
{{ if not .Params.hide }}
<div class="Page" id="{{ .Title }}">
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
{{ .Content }}
</div>
{{ end }}
{{ end }}
{{ end }}
6 changes: 6 additions & 0 deletions www/layouts/_default/single.html
@@ -0,0 +1,6 @@
{{ define "main" }}
<div class="Page" id="{{ .Slug }}">
<h1>{{ .Title }}</h1>
{{ .Content }}
</div>
{{ end }}
9 changes: 9 additions & 0 deletions www/layouts/page/projects.html
@@ -0,0 +1,9 @@
{{ define "main" }}
{{ .Content }}
{{ range sort .Site.Data.projects "path" "asc" }}
<div class="Page">
<h1><a href="https://{{.path}}">{{ .path }}</a></h1>
<pre><code>curl -sfL https://install.goreleaser.com/{{ .path }}.sh | bash</code></pre>
</div>
{{ end }}
{{ end }}
4 changes: 4 additions & 0 deletions www/layouts/partials/footer.html
@@ -0,0 +1,4 @@
<div class="Footer">
Made with ❤️ by GoReleaser contributors.
</div>
<script src="theme/apex/js/index.js"></script>
14 changes: 14 additions & 0 deletions www/layouts/partials/head.html
@@ -0,0 +1,14 @@

<!DOCTYPE HTML>

<html>
<head>
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} &middot; {{ .Site.Title }}{{ end }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ with .Site.Params.name }}<meta name="author" content="{{ . }}">{{ end }}
{{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }}
{{ with .Site.LanguageCode }}<meta http-equiv="content-language" content="{{ . }}" />{{ end }}
{{ .Hugo.Generator }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/index.css">
</head>
8 changes: 8 additions & 0 deletions www/layouts/partials/header.html
@@ -0,0 +1,8 @@
<div class="Header">
<a href="{{ .Site.BaseURL }}">
<div class="Title center">
<span class="text">{{.Site.Title}}</span>
<span class="subtext">GoReleaser</span>
</div>
</a>
</div>
9 changes: 9 additions & 0 deletions www/layouts/partials/menu.html
@@ -0,0 +1,9 @@
<div class="Sidebar">
<div class="Menu">
{{ range .Pages }}
<div class="item">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</div>
{{ end }}
</div>
</div>
1 change: 1 addition & 0 deletions www/static/.gitignore
@@ -0,0 +1 @@
github.com/

0 comments on commit ce436e3

Please sign in to comment.