Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous fixes #1373

Merged
merged 7 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .cirrus.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
- name: ShellCheck
uses: ludeeus/action-shellcheck@1.1.0
with:
scandir: ./assets/scripts
ignore: completions
- name: Whitespace
run: go run ./internal/cmds/lint-whitespace
- name: Typos
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.exe
/.vagrant
/bin/chezmoi
/bin/gofumports
/bin/golangci-lint
Expand Down
32 changes: 18 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,51 @@ build: build-darwin build-freebsd build-linux build-windows

.PHONY: build-darwin
build-darwin:
GOOS=darwin GOARCH=amd64 $(GO) build -o /dev/null .
GOOS=darwin GOARCH=arm64 $(GO) build -o /dev/null .
GOOS=darwin GOARCH=amd64 ${GO} build -o /dev/null .
GOOS=darwin GOARCH=arm64 ${GO} build -o /dev/null .

.PHONY: build-freebsd
build-freebsd:
GOOS=freebsd GOARCH=amd64 $(GO) build -o /dev/null .
GOOS=freebsd GOARCH=amd64 ${GO} build -o /dev/null .

.PHONY: build-linux
build-linux:
GOOS=linux GOARCH=amd64 $(GO) build -o /dev/null .
GOOS=linux GOARCH=amd64 $(GO) build -tags=noupgrade -o /dev/null .
GOOS=linux GOARCH=amd64 ${GO} build -o /dev/null .
GOOS=linux GOARCH=amd64 ${GO} build -tags=noupgrade -o /dev/null .

.PHONY: build-windows
build-windows:
GOOS=windows GOARCH=amd64 $(GO) build -o /dev/null .
GOOS=windows GOARCH=amd64 ${GO} build -o /dev/null .

.PHONY: run
run:
$(GO) run . --version
${GO} run . --version

.PHONY: test
test:
$(GO) test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o022" ./...
$(GO) test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o002" ./...
${GO} test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o022" ./...
${GO} test -ldflags="-X github.com/twpayne/chezmoi/internal/chezmoitest.umaskStr=0o002" ./...

.PHONY: test-os
test-os:
( cd assets/vagrant && ./test.sh fedora33 freebsd13 openbsd6 )

.PHONY: coverage-html
coverage-html: coverage
$(GO) tool cover -html=coverage.out
${GO} tool cover -html=coverage.out

.PHONY: coverage
coverage:
$(GO) test -test.coverprofile=coverage.out ./...
${GO} test -test.coverprofile=coverage.out ./...

.PHONY: generate
generate:
$(GO) generate
${GO} generate

.PHONY: lint
lint: ensure-golangci-lint
./bin/golangci-lint run
$(GO) run ./internal/cmds/lint-whitespace
${GO} run ./internal/cmds/lint-whitespace

.PHONY: format
format: ensure-gofumports
Expand All @@ -62,7 +66,7 @@ ensure-tools: ensure-gofumports ensure-golangci-lint
ensure-gofumports:
if [ ! -x bin/gofumports ] ; then \
mkdir -p bin ; \
GOBIN=$(shell pwd)/bin $(GO) install mvdan.cc/gofumpt/gofumports@latest ; \
GOBIN=$(shell pwd)/bin ${GO} install mvdan.cc/gofumpt/gofumports@latest ; \
fi

.PHONY: ensure-golangci-lint
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Updating your dotfiles on any machine is a single command:
$ chezmoi update
```

---

* [How do I start with chezmoi now?](#how-do-i-start-with-chezmoi-now)
* [What does chezmoi do and why should I use it?](#what-does-chezmoi-do-and-why-should-i-use-it)
* [What are chezmoi's key features?](#what-are-chezmois-key-features)
Expand All @@ -32,6 +34,7 @@ $ chezmoi update
* [What documentation is available?](#what-documentation-is-available)
* [License](#license)

---
## How do I start with chezmoi now?

[Install chezmoi](docs/INSTALL.md) then read the [quick start
Expand All @@ -44,6 +47,7 @@ GitLab](https://gitlab.com/search?search=chezmoi), and see how chezmoi [compares
to other dotfile managers](docs/COMPARISON.md). For a full description of
chezmoi, consult the [reference](docs/REFERENCE.md).

---
## What does chezmoi do and why should I use it?

chezmoi helps you manage your personal configuration files (dotfiles, like
Expand Down Expand Up @@ -71,6 +75,8 @@ If you do not personalize your configuration or only ever use a single operating
system with a single account and none of your dotfiles contain secrets then you
don't need chezmoi. Otherwise, read on...

---

## What are chezmoi's key features?

### Flexible
Expand Down Expand Up @@ -123,10 +129,14 @@ commands, including installation, initialization, and keeping your machines
up-to-date. chezmoi can pull and apply changes from your dotfiles repo in a
single command, and automatically commit and push changes.

---

## I already have a system to manage my dotfiles, why should I use chezmoi?

Read the [comparison of chezmoi to other dotfile managers](docs/COMPARISON.md).

---

## How do people use chezmoi?

### Dotfile repos using chezmoi
Expand All @@ -139,6 +149,8 @@ GitLab](https://gitlab.com/search?search=chezmoi).

Read what [people have said about chezmoi](docs/MEDIA.md).

---

## What documentation is available?

* [Install guide](docs/INSTALL.md) to get chezmoi installed on your machine with
Expand All @@ -156,6 +168,10 @@ Read what [people have said about chezmoi](docs/MEDIA.md).
* [Contributing](docs/CONTRIBUTING.md) and [Architecture](docs/ARCHITECTURE.md)
for people looking to contribute to or package chezmoi.

---

## License

MIT

---
16 changes: 16 additions & 0 deletions assets/chezmoi.io/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Updating your dotfiles on any machine is a single command:
$ chezmoi update
```

---

## How do I start with chezmoi now?

[Install chezmoi](/docs/install/) then read the [quick start
Expand All @@ -32,6 +34,8 @@ GitLab](https://gitlab.com/search?search=chezmoi), and see how chezmoi [compares
to other dotfile managers](/docs/comparison/). For a full description of
chezmoi, consult the [reference](/docs/reference/).

---

## What does chezmoi do and why should I use it?

chezmoi helps you manage your personal configuration files (dotfiles, like
Expand Down Expand Up @@ -59,6 +63,8 @@ If you do not personalize your configuration or only ever use a single operating
system with a single account and none of your dotfiles contain secrets then you
don't need chezmoi. Otherwise, read on...

---

## What are chezmoi's key features?

### Flexible
Expand Down Expand Up @@ -111,10 +117,14 @@ commands, including installation, initialization, and keeping your machines
up-to-date. chezmoi can pull and apply changes from your dotfiles repo in a
single command, and automatically commit and push changes.

---

## I already have a system to manage my dotfiles, why should I use chezmoi?

Read the [comparison of chezmoi to other dotfile managers](/docs/comparison/).

---

## How do people use chezmoi?

### Dotfile repos using chezmoi
Expand All @@ -127,6 +137,8 @@ GitLab](https://gitlab.com/search?search=chezmoi).

Read what [people have said about chezmoi](/docs/media/).

---

## What documentation is available?

* [Install guide](/docs/install/) to get chezmoi installed on your machine with
Expand All @@ -144,6 +156,10 @@ Read what [people have said about chezmoi](/docs/media/).
* [Contributing](/docs/contributing/) and [Architecture](/docs/architecture/)
for people looking to contribute to or package chezmoi.

---

## License

MIT

---
11 changes: 5 additions & 6 deletions assets/chezmoi.io/make-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ rm -rf public/
hugo

# clone and checkout the gh-pages branch in a temporary directory
oldwd=$(pwd)
tmpdir=$(mktemp -d)
cleanup() {
rm -rf ${tmpdir}
rm -rf "${tmpdir}"
}
trap cleanup EXIT
git branch -f gh-pages origin/gh-pages
git clone --branch=gh-pages --local ../.. ${tmpdir}
git clone --branch=gh-pages --local ../.. "${tmpdir}"

# copy the new website to the temporary directory
rm -rf ${tmpdir}/*
cp -r public/* ${tmpdir}
rm -rf "${tmpdir:?}"/*
cp -r public/* "${tmpdir}"

# prepare the clone
cd ${tmpdir}
cd "${tmpdir}"
git checkout CNAME
git remote set-url origin https://github.com/twpayne/chezmoi.git
git fetch origin
Expand Down
9 changes: 9 additions & 0 deletions assets/vagrant/fedora33.Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora33"
config.vm.hostname = "fedora33"
config.vm.synced_folder ".", "/chezmoi", type: "rsync"
config.vm.provision "shell", inline: <<-SHELL
yum install --quiet --assumeyes git gnupg golang
SHELL
config.vm.provision "file", source: "assets/vagrant/fedora33.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
5 changes: 5 additions & 0 deletions assets/vagrant/fedora33.test-chezmoi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

go get golang.org/dl/go1.17
"$HOME"/go/bin/go1.17 download
( cd /chezmoi && "$HOME"/go/bin/go1.17 test ./... )
9 changes: 9 additions & 0 deletions assets/vagrant/freebsd13.Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/freebsd13"
config.vm.hostname = "freebsd13"
config.vm.synced_folder ".", "/chezmoi", type: "rsync"
config.vm.provision "shell", inline: <<-SHELL
pkg install --quiet --yes git gnupg go
SHELL
config.vm.provision "file", source: "assets/vagrant/freebsd13.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
3 changes: 3 additions & 0 deletions assets/vagrant/freebsd13.test-chezmoi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

( cd /chezmoi && go test ./... )
9 changes: 9 additions & 0 deletions assets/vagrant/openbsd6.Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/openbsd6"
config.vm.hostname = "openbsd6"
config.vm.synced_folder ".", "/chezmoi", type: "rsync"
config.vm.provision "shell", inline: <<-SHELL
pkg_add -x git gnupg go
SHELL
config.vm.provision "file", source: "assets/vagrant/openbsd6.test-chezmoi.sh", destination: "test-chezmoi.sh"
end
3 changes: 3 additions & 0 deletions assets/vagrant/openbsd6.test-chezmoi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

( cd /chezmoi && go test ./... )
15 changes: 15 additions & 0 deletions assets/vagrant/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

for os in "$@"; do
if [ -f "${os}.Vagrantfile" ]; then
export VAGRANT_VAGRANTFILE=assets/vagrant/${os}.Vagrantfile
(
cd ../.. &&
vagrant up &&
vagrant ssh -c "sh test-chezmoi.sh" &&
vagrant destroy -f
)
else
echo "${os}.Vagrantfile not found"
fi
done
Loading