Skip to content

Commit 23ec645

Browse files
committed
fix
1 parent 5dc9d2e commit 23ec645

File tree

7 files changed

+116
-94
lines changed

7 files changed

+116
-94
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ splash
44
splash-cli
55
.env.*
66
.env
7+
.envrc
78
dist/
89
*.log

.goreleaser.yaml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
# This is an example .goreleaser.yml file with some sensible defaults.
22
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 2
10+
311
project_name: splash
12+
413
universal_binaries:
514
- name_template: splash
615
replace: false
16+
717
before:
818
hooks:
919
- go mod tidy
10-
- go test -v ./__tests__
20+
- go test -v ./__tests__/
1121
- rm -f splash-cli.log
22+
1223
builds:
1324
- binary: splash
1425
env:
1526
- CGO_ENABLED=0
27+
goos:
28+
- linux
29+
- windows
30+
- darwin
1631
ldflags:
1732
- -s -w -X "github.com/rawnly/splash-cli/config.ClientId={{ .Env.UNSPLASH_CLIENT_ID }}"
1833
- -s -w -X "github.com/rawnly/splash-cli/config.ClientSecret={{ .Env.UNSPLASH_CLIENT_SECRET }}"
@@ -24,15 +39,11 @@ builds:
2439
- -s -w -X "github.com/rawnly/splash-cli/config.Commit={{ .Commit }}"
2540
- -s -w -X "github.com/rawnly/splash-cli/config.Date={{ .Date }}"
2641
- -s -w -X "github.com/rawnly/splash-cli/config.SentryDebug={{ .Env.ENABLE_SENTRY_DEBUG }}"
27-
goos:
28-
- linux
29-
- windows
30-
- darwin
3142
brews:
3243
- name: splash-cli
33-
homepage: https://splash-cli.app
44+
homepage: https://untitled.dev
3445
license: MIT
35-
folder: Formula
46+
directory: Formula
3647
description: Splash is a command line interface for Unsplash.
3748
repository:
3849
owner: rawnly
@@ -57,16 +68,28 @@ release:
5768
```
5869
go install github.com/rawnly/splash-cli@{{ .Version }}
5970
```
60-
checksum:
61-
name_template: "checksums.txt"
62-
snapshot:
63-
name_template: "{{ incpatch .Version }}"
71+
archives:
72+
- formats: [tar.gz]
73+
# this name template makes the OS and Arch compatible with the results of `uname`.
74+
name_template: >-
75+
{{ .ProjectName }}_
76+
{{- title .Os }}_
77+
{{- if eq .Arch "amd64" }}x86_64
78+
{{- else if eq .Arch "386" }}i386
79+
{{- else }}{{ .Arch }}{{ end }}
80+
{{- if .Arm }}v{{ .Arm }}{{ end }}
81+
# use zip for windows archives
82+
format_overrides:
83+
- goos: windows
84+
formats: [zip]
85+
6486
changelog:
6587
sort: asc
6688
filters:
6789
exclude:
6890
- "^docs:"
6991
- "^test:"
70-
- "^ci:"
71-
gomod:
72-
proxy: true
92+
checksum:
93+
name_template: "checksums.txt"
94+
snapshot:
95+
name_template: "{{ incpatch .Version }}"

.goreleaser.yaml.bck

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
project_name: splash
4+
universal_binaries:
5+
- name_template: splash
6+
replace: false
7+
before:
8+
hooks:
9+
- go mod tidy
10+
- go test -v ./__tests__
11+
- rm -f splash-cli.log
12+
builds:
13+
- binary: splash
14+
env:
15+
- CGO_ENABLED=0
16+
ldflags:
17+
- -s -w -X "github.com/rawnly/splash-cli/config.ClientId={{ .Env.UNSPLASH_CLIENT_ID }}"
18+
- -s -w -X "github.com/rawnly/splash-cli/config.ClientSecret={{ .Env.UNSPLASH_CLIENT_SECRET }}"
19+
- -s -w -X "github.com/rawnly/splash-cli/config.PostHogKey={{ .Env.POSTHOG_API_KEY }}"
20+
21+
- -s -w -X "github.com/rawnly/splash-cli/config.Debug={{ .Env.DEBUG }}"
22+
- -s -w -X "github.com/rawnly/splash-cli/config.SentryDSN={{ .Env.SENTRY_DSN }}"
23+
- -s -w -X "github.com/rawnly/splash-cli/config.Version={{ .Version }}"
24+
- -s -w -X "github.com/rawnly/splash-cli/config.Commit={{ .Commit }}"
25+
- -s -w -X "github.com/rawnly/splash-cli/config.Date={{ .Date }}"
26+
- -s -w -X "github.com/rawnly/splash-cli/config.SentryDebug={{ .Env.ENABLE_SENTRY_DEBUG }}"
27+
goos:
28+
- linux
29+
- windows
30+
- darwin
31+
brews:
32+
- name: splash-cli
33+
homepage: https://untitled.dev
34+
license: MIT
35+
folder: Formula
36+
description: Splash is a command line interface for Unsplash.
37+
repository:
38+
owner: rawnly
39+
name: homebrew-tap
40+
branch: master
41+
commit_author:
42+
name: Goreleaser BOT
43+
email: goreleaser@fedevitale.dev
44+
release:
45+
prerelease: auto
46+
github:
47+
owner: rawnly
48+
name: splash-cli
49+
footer: |
50+
## How to Update
51+
### Homebrew
52+
```
53+
brew update splash-cli
54+
```
55+
56+
### Go
57+
```
58+
go install github.com/rawnly/splash-cli@{{ .Version }}
59+
```
60+
checksum:
61+
name_template: "checksums.txt"
62+
snapshot:
63+
name_template: "{{ incpatch .Version }}"
64+
changelog:
65+
sort: asc
66+
filters:
67+
exclude:
68+
- "^docs:"
69+
- "^test:"
70+
- "^ci:"
71+
gomod:
72+
proxy: true

package-lock.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// Setup the logs
1414
func setupLogs() {
1515
// You could set this to any `io.Writer` such as a file
16-
file, err := os.OpenFile("splash-cli.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
16+
file, err := os.OpenFile("/var/log/splash-cli.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666)
1717
if err == nil {
1818
logrus.SetOutput(file)
1919
} else {

unsplash/photos.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package unsplash
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77

88
"github.com/rawnly/splash-cli/unsplash/models"
99
)
@@ -39,8 +39,8 @@ func (a Api) GetRandomPhoto(params models.RandomPhotoParams) ([]models.Photo, er
3939
return photo, nil
4040
}
4141

42-
func (a Api) TrackDownload(photoId string) error {
43-
if _, err := a.get(fmt.Sprintf("/photos/%s/download", photoId), nil); err != nil {
42+
func (a Api) TrackDownload(photoID string) error {
43+
if _, err := a.get(fmt.Sprintf("/photos/%s/download", photoID), nil); err != nil {
4444
return err
4545
}
4646

@@ -66,12 +66,12 @@ func (a Api) Unlike(id string) error {
6666
func (a Api) GetPhotoOfTheDay() (*models.Photo, error) {
6767
var response models.PhotoOfTheDay
6868

69-
r, err := a.Client.Get("https://lambda.splash-cli.app/api/wallpapers")
69+
r, err := a.Client.Get("https://splash-cli-api.untitled.dev/api/wallpapers")
7070
if err != nil {
7171
return nil, err
7272
}
7373

74-
data, err := ioutil.ReadAll(r.Body)
74+
data, err := io.ReadAll(r.Body)
7575
if err != nil {
7676
return nil, err
7777
}

0 commit comments

Comments
 (0)