Skip to content

Commit 9c19b6a

Browse files
committed
refactor for latest Up. Closes #29
1 parent add5eab commit 9c19b6a

File tree

7 files changed

+32
-21
lines changed

7 files changed

+32
-21
lines changed

.goreleaser.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ build:
22
main: cmd/polls/main.go
33
binary: polls
44
goos:
5-
- windows
65
- darwin
76
- linux
7+
- windows
8+
- freebsd
9+
- netbsd
10+
- openbsd
811
goarch:
912
- amd64
13+
- 386

.upignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!static/**

Readme.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
User polls for GitHub powered by [Up](https://github.com/apex/up).
44

5-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20A)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20A/vote)
6-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20B)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20B/vote)
7-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20C)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20C/vote)
5+
[![](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20A)](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20A/vote)
6+
[![](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20B)](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20B/vote)
7+
[![](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20C)](https://gh-polls.com/poll/01BM2T00TMSDTZWJ1RP6TQF200/Option%20C/vote)
88

99
## About
1010

@@ -17,7 +17,7 @@ What do they look like? The poll above is live, click one out and give it a try!
1717
Via `go get`:
1818

1919
```
20-
$ go get github.com/tj/gh-polls/cmd/polls
20+
$ go get github.com/apex/gh-polls/cmd/polls
2121
```
2222

2323
Then create your own poll with `polls new`, the markdown is copied to your clipboard.
@@ -30,19 +30,19 @@ Create a new poll for who is the best ferret.
3030
$ polls new Tobi Loki Jane
3131
```
3232

33-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Tobi)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Tobi/vote)
34-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Loki)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Loki/vote)
35-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Jane)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Jane/vote)
33+
[![](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Tobi)](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Tobi/vote)
34+
[![](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Loki)](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Loki/vote)
35+
[![](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Jane)](https://gh-polls.com/poll/01BM2ZHFZXYKQV9N3HNFXCBH3N/Jane/vote)
3636

3737
Create a new poll for the best species:
3838

3939
```
4040
$ polls new "Cats are cool" "Dogs are better" "Ferrets for the win"
4141
```
4242

43-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Cats%20are%20cool)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Cats%20are%20cool/vote)
44-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Dogs%20are%20better)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Dogs%20are%20better/vote)
45-
[![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Ferrets%20for%20the%20win)](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BM2ZHPN7BA19X15SQDGX4D88/Ferrets%20for%20the%20win/vote)
43+
[![](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Cats%20are%20cool)](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Cats%20are%20cool/vote)
44+
[![](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Dogs%20are%20better)](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Dogs%20are%20better/vote)
45+
[![](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Ferrets%20for%20the%20win)](https://gh-polls.com/poll/01BM2ZHPN7BA19X15SQDGX4D88/Ferrets%20for%20the%20win/vote)
4646

4747
## Statistics
4848

@@ -54,7 +54,7 @@ GitHub poll API statistics powered by [Up](https://github.com/apex/up).
5454

5555
---
5656

57-
[![GoDoc](https://godoc.org/github.com/tj/gh-polls?status.svg)](https://godoc.org/github.com/tj/gh-polls)
57+
[![GoDoc](https://godoc.org/github.com/apex/gh-polls?status.svg)](https://godoc.org/github.com/apex/gh-polls)
5858
![](https://img.shields.io/badge/license-MIT-blue.svg)
5959
![](https://img.shields.io/badge/status-experimental-orange.svg)
6060

cmd/polls/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import (
77

88
"github.com/tj/kingpin"
99

10-
"github.com/tj/gh-polls/internal/cli"
11-
"github.com/tj/gh-polls/internal/client"
10+
"github.com/apex/gh-polls/internal/cli"
11+
"github.com/apex/gh-polls/internal/client"
1212
)
1313

1414
// Config.
1515
var (
1616
version = "master"
17-
endpoint = "https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod"
17+
endpoint = "https://gh-polls.com"
1818
)
1919

2020
func main() {

internal/cli/cli.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ func CopyToClipboard(id string, options []string) error {
2525

2626
// Link returns a poll option link with image.
2727
func Link(id, option string) string {
28-
return fmt.Sprintf(`[%s](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/%s/%s/vote)`, Image(id, option), id, url.PathEscape(option))
28+
return fmt.Sprintf(`[%s](https://gh-polls.com/poll/%s/%s/vote)`, Image(id, option), id, url.PathEscape(option))
2929
}
3030

3131
// Image returns a poll option image.
3232
func Image(id, option string) string {
33-
return fmt.Sprintf(`![](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/%s/%s)`, id, url.PathEscape(option))
33+
return fmt.Sprintf(`![](https://gh-polls.com/poll/%s/%s)`, id, url.PathEscape(option))
3434
}

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import (
1111
"github.com/gohttp/response"
1212
"github.com/segmentio/go-env"
1313

14-
"github.com/tj/gh-polls/internal/poll"
14+
"github.com/apex/gh-polls/internal/poll"
1515
)
1616

1717
func main() {
1818
app := pat.New()
1919
app.Post("/poll", http.HandlerFunc(addPoll))
2020
app.Get("/poll/:id/:option", http.HandlerFunc(getPollOption))
2121
app.Get("/poll/:id/:option/vote", http.HandlerFunc(getPollOptionVote))
22-
addr := env.MustGet("UP_ADDR")
22+
addr := ":" + env.MustGet("PORT")
2323
if err := http.ListenAndServe(addr, app); err != nil {
2424
log.WithError(err).Fatal("binding")
2525
}

up.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"name": "polls",
2+
"name": "gh-polls",
33
"description": "GitHub polls.",
4-
"cors": {}
4+
"cors": {},
5+
"stages": {
6+
"production": {
7+
"domain": "gh-polls.com"
8+
}
9+
}
510
}

0 commit comments

Comments
 (0)