Skip to content

Commit c7cbff0

Browse files
authored
Merge pull request #37 from twpayne/activate-goreleaser
Activate goreleaser
2 parents 5b1c3b8 + 9fdf9d1 commit c7cbff0

File tree

7 files changed

+48
-33
lines changed

7 files changed

+48
-33
lines changed

.goreleaser.yaml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
# run a local "snapshot" build without publishing:
2-
# TRAVIS_BUILD_NUMBER=1 goreleaser --snapshot --rm-dist --debug
3-
#
41
project_name: chezmoi
52

3+
before:
4+
hooks:
5+
- go mod download
6+
67
builds:
78
- binary: chezmoi
89
env:
910
- CGO_ENABLED=0
10-
ldflags:
11-
- -s -w
11+
- GO111MODULE=on
1212
goos:
1313
- linux
1414
- darwin
15-
# TODO: uncomment when compatible with windows. currently fails on 'undefined: syscall.Stat_t'
16-
# - windows
15+
- windows
1716
- freebsd
1817
- openbsd
1918
# - dragonfly
@@ -56,9 +55,9 @@ changelog:
5655

5756
## generate RPM and DEB packages
5857
nfpm:
59-
vendor: "TODO"
58+
vendor: "Tom Payne <twpayne@gmail.com>"
6059
homepage: "https://github.com/twpayne/chezmoi"
61-
maintainer: Tom Payne <TODO@TODO.tld>
60+
maintainer: Tom Payne <twpayne@gmail.com>
6261
description: "chezmoi is a tool for managing your dotfiles across multiple machines."
6362
license: MIT
6463
formats:
@@ -78,17 +77,17 @@ nfpm:
7877
386: i386
7978
arm: armel
8079

81-
## generate a homebrew formula and push to github.com/twpayne/homebrew-taps
82-
# brew:
83-
# github:
84-
# owner: twpayne
85-
# name: homebrew-taps
86-
# commit_author:
87-
# name: Tom Payne
88-
# email: TODO@TODO.tld
89-
# folder: Formula
90-
# homepage: "https://github.com/twpayne/chezmoi"
91-
# description: "chezmoi is a tool for managing your dotfiles across multiple machines."
80+
# generate a homebrew formula and push to github.com/twpayne/homebrew-taps
81+
brew:
82+
github:
83+
owner: twpayne
84+
name: homebrew-taps
85+
commit_author:
86+
name: Tom Payne
87+
email: twpayne@gmail.com
88+
folder: Formula
89+
homepage: "https://github.com/twpayne/chezmoi"
90+
description: "chezmoi is a tool for managing your dotfiles across multiple machines."
9291

9392
## generate and push docker images:
9493
# dockers:
@@ -126,4 +125,4 @@ nfpm:
126125
# - "twpayne/chezmoi:{{ .Tag }}-arm" # v1.0.0
127126
# - "twpayne/chezmoi:v{{ .Major }}-arm" # v1
128127
# - "twpayne/chezmoi:v{{ .Major }}.{{ .Minor }}-arm" # v1.0
129-
# - "twpayne/chezmoi:latest-arm"
128+
# - "twpayne/chezmoi:latest-arm"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ To create a new release, push a tag, eg:
335335
$ git tag -a v0.1.0 -m "First release"
336336
$ git push origin v0.1.0
337337

338+
To run a local "snapshot" build without publishing:
339+
340+
$ TRAVIS_BUILD_NUMBER=1 goreleaser --snapshot --rm-dist --debug
341+
338342
## License
339343

340344
The MIT License (MIT)

cmd/keyring_set.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cmd
22

33
import (
44
"fmt"
5-
"syscall"
5+
"os"
66

77
"github.com/spf13/cobra"
88
"github.com/twpayne/go-vfs"
@@ -28,7 +28,7 @@ func (c *Config) runKeyringSetCommand(fs vfs.FS, cmd *cobra.Command, args []stri
2828
passwordString := c.keyring.password
2929
if passwordString == "" {
3030
fmt.Print("Password: ")
31-
password, err := terminal.ReadPassword(syscall.Stdin)
31+
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
3232
if err != nil {
3333
return err
3434
}

cmd/root.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"os"
66
"path/filepath"
7-
"syscall"
87

98
"github.com/mitchellh/go-homedir"
109
"github.com/spf13/cobra"
@@ -97,10 +96,3 @@ func (c *Config) persistentPreRunRootE(fs vfs.FS, command *cobra.Command, args [
9796
}
9897
return nil
9998
}
100-
101-
func getUmask() int {
102-
// FIXME should we call runtime.LockOSThread or similar?
103-
umask := syscall.Umask(0)
104-
syscall.Umask(umask)
105-
return umask
106-
}

cmd/umask.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//+build !windows
2+
3+
package cmd
4+
5+
import "syscall"
6+
7+
func getUmask() int {
8+
// FIXME should we call runtime.LockOSThread or similar?
9+
umask := syscall.Umask(0)
10+
syscall.Umask(umask)
11+
return umask
12+
}

cmd/umask_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package cmd
2+
3+
func getUmask() int {
4+
return 0
5+
}

lib/chezmoi/chezmoi.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"sort"
1313
"strconv"
1414
"strings"
15-
"syscall"
1615
"text/template"
1716
"time"
1817

@@ -363,7 +362,11 @@ func (ts *TargetState) Add(fs vfs.FS, target string, info os.FileInfo, addEmpty,
363362
// If the directory is empty, add a .keep file so the directory is
364363
// managed by git. Chezmoi will ignore the .keep file as it begins with
365364
// a dot.
366-
if stat, ok := info.Sys().(*syscall.Stat_t); ok && stat.Nlink == 2 {
365+
infos, err := fs.ReadDir(target)
366+
if err != nil {
367+
return err
368+
}
369+
if len(infos) == 0 {
367370
if err := actuator.WriteFile(filepath.Join(ts.SourceDir, sourceName, ".keep"), nil, 0666&^ts.Umask, nil); err != nil {
368371
return err
369372
}

0 commit comments

Comments
 (0)