Skip to content

Commit

Permalink
Merge pull request #37 from twpayne/activate-goreleaser
Browse files Browse the repository at this point in the history
Activate goreleaser
  • Loading branch information
twpayne authored Nov 29, 2018
2 parents 5b1c3b8 + 9fdf9d1 commit c7cbff0
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 33 deletions.
41 changes: 20 additions & 21 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# run a local "snapshot" build without publishing:
# TRAVIS_BUILD_NUMBER=1 goreleaser --snapshot --rm-dist --debug
#
project_name: chezmoi

before:
hooks:
- go mod download

builds:
- binary: chezmoi
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- GO111MODULE=on
goos:
- linux
- darwin
# TODO: uncomment when compatible with windows. currently fails on 'undefined: syscall.Stat_t'
# - windows
- windows
- freebsd
- openbsd
# - dragonfly
Expand Down Expand Up @@ -56,9 +55,9 @@ changelog:

## generate RPM and DEB packages
nfpm:
vendor: "TODO"
vendor: "Tom Payne <twpayne@gmail.com>"
homepage: "https://github.com/twpayne/chezmoi"
maintainer: Tom Payne <TODO@TODO.tld>
maintainer: Tom Payne <twpayne@gmail.com>
description: "chezmoi is a tool for managing your dotfiles across multiple machines."
license: MIT
formats:
Expand All @@ -78,17 +77,17 @@ nfpm:
386: i386
arm: armel

## generate a homebrew formula and push to github.com/twpayne/homebrew-taps
# brew:
# github:
# owner: twpayne
# name: homebrew-taps
# commit_author:
# name: Tom Payne
# email: TODO@TODO.tld
# folder: Formula
# homepage: "https://github.com/twpayne/chezmoi"
# description: "chezmoi is a tool for managing your dotfiles across multiple machines."
# generate a homebrew formula and push to github.com/twpayne/homebrew-taps
brew:
github:
owner: twpayne
name: homebrew-taps
commit_author:
name: Tom Payne
email: twpayne@gmail.com
folder: Formula
homepage: "https://github.com/twpayne/chezmoi"
description: "chezmoi is a tool for managing your dotfiles across multiple machines."

## generate and push docker images:
# dockers:
Expand Down Expand Up @@ -126,4 +125,4 @@ nfpm:
# - "twpayne/chezmoi:{{ .Tag }}-arm" # v1.0.0
# - "twpayne/chezmoi:v{{ .Major }}-arm" # v1
# - "twpayne/chezmoi:v{{ .Major }}.{{ .Minor }}-arm" # v1.0
# - "twpayne/chezmoi:latest-arm"
# - "twpayne/chezmoi:latest-arm"
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ To create a new release, push a tag, eg:
$ git tag -a v0.1.0 -m "First release"
$ git push origin v0.1.0

To run a local "snapshot" build without publishing:

$ TRAVIS_BUILD_NUMBER=1 goreleaser --snapshot --rm-dist --debug

## License

The MIT License (MIT)
Expand Down
4 changes: 2 additions & 2 deletions cmd/keyring_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"fmt"
"syscall"
"os"

"github.com/spf13/cobra"
"github.com/twpayne/go-vfs"
Expand All @@ -28,7 +28,7 @@ func (c *Config) runKeyringSetCommand(fs vfs.FS, cmd *cobra.Command, args []stri
passwordString := c.keyring.password
if passwordString == "" {
fmt.Print("Password: ")
password, err := terminal.ReadPassword(syscall.Stdin)
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return err
}
Expand Down
8 changes: 0 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"os"
"path/filepath"
"syscall"

"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -97,10 +96,3 @@ func (c *Config) persistentPreRunRootE(fs vfs.FS, command *cobra.Command, args [
}
return nil
}

func getUmask() int {
// FIXME should we call runtime.LockOSThread or similar?
umask := syscall.Umask(0)
syscall.Umask(umask)
return umask
}
12 changes: 12 additions & 0 deletions cmd/umask.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//+build !windows

package cmd

import "syscall"

func getUmask() int {
// FIXME should we call runtime.LockOSThread or similar?
umask := syscall.Umask(0)
syscall.Umask(umask)
return umask
}
5 changes: 5 additions & 0 deletions cmd/umask_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cmd

func getUmask() int {
return 0
}
7 changes: 5 additions & 2 deletions lib/chezmoi/chezmoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"sort"
"strconv"
"strings"
"syscall"
"text/template"
"time"

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

0 comments on commit c7cbff0

Please sign in to comment.