Skip to content

Commit e185951

Browse files
committed
fmt, add vscode
1 parent 26e2f4f commit e185951

File tree

14 files changed

+110
-83
lines changed

14 files changed

+110
-83
lines changed

Taskfile.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ version: '3'
22

33
tasks:
44
# development
5+
fmt:
6+
dir: worker
7+
cmds:
8+
- go fmt ./...
59
test:
610
dir: worker
711
cmds:
812
- go test -cover ./...
9-
build-darwin:
13+
build:
1014
dir: worker
1115
cmds:
1216
- go build -o ./bin/darwin ./...
@@ -23,6 +27,10 @@ tasks:
2327
dir: worker
2428
cmds:
2529
- ./bin/darwin/nix
30+
update-vscode:
31+
dir: worker
32+
cmds:
33+
- ./bin/darwin/vscode
2634
update-zsh:
2735
dir: worker
2836
cmds:

configs/vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"workbench.colorTheme": "Tokyo Hack",
3+
"window.zoomLevel": 2,
4+
"editor.minimap.enabled": false,
5+
"git.openRepositoryInParentFolders": "never",
6+
"editor.fontSize": 18,
7+
"editor.fontFamily": "HackGen35 Console NF",
8+
"security.workspace.trust.untrustedFiles": "open",
9+
"github.copilot.editor.enableAutoCompletions": true
10+
}

worker/bin/darwin/nix

0 Bytes
Binary file not shown.

worker/bin/darwin/nvim

0 Bytes
Binary file not shown.

worker/bin/darwin/vscode

2.27 MB
Binary file not shown.

worker/bin/darwin/wezterm

0 Bytes
Binary file not shown.

worker/bin/darwin/zsh

0 Bytes
Binary file not shown.

worker/entry_point/nix/main.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package main
22

33
import (
4-
"worker/internal/updater"
4+
"worker/internal/updater"
55
)
66

7-
87
func main() {
9-
updater.UpdateDirectory(
10-
// 設定するディレクトリを呼び出す
11-
"../configs/nix",
12-
// 既存の設定ディレクトリがあれば消す
13-
"$HOME/.config/nix",
14-
// 設定を置く場所
15-
"$HOME/.config/",
16-
)
8+
updater.UpdateDirectory(
9+
// 設定するディレクトリを呼び出す
10+
"../configs/nix",
11+
// 既存の設定ディレクトリがあれば消す
12+
"$HOME/.config/nix",
13+
// 設定を置く場所
14+
"$HOME/.config/",
15+
)
1716
}
18-

worker/entry_point/nvim/main.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package main
22

33
import (
4-
"worker/internal/updater"
4+
"worker/internal/updater"
55
)
66

7-
87
func main() {
9-
updater.UpdateDirectory(
10-
// これから設定ファイルとするディレクトリ
11-
"../configs/nvim",
12-
// 既存の設定ディレクトリがあれば消す
13-
"$HOME/.config/nvim",
14-
// 設定を置く場所
15-
"$HOME/.config/",
16-
)
8+
updater.UpdateDirectory(
9+
// これから設定ファイルとするディレクトリ
10+
"../configs/nvim",
11+
// 既存の設定ディレクトリがあれば消す
12+
"$HOME/.config/nvim",
13+
// 設定を置く場所
14+
"$HOME/.config/",
15+
)
1716
}
18-

worker/entry_point/vscode/main.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"worker/internal/updater"
5+
)
6+
7+
func main() {
8+
updater.UpdateFile(
9+
// 既存の設定ファイル
10+
"$HOME/Library/Application Support/Code/User/settings.json",
11+
// 更新に使う設定ファイル
12+
"../configs/vscode/settings.json",
13+
// 設定を置く場所
14+
"$HOME/Library/Application Support/Code/User",
15+
)
16+
}

worker/entry_point/wezterm/main.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package main
22

33
import (
4-
"worker/internal/updater"
4+
"worker/internal/updater"
55
)
66

7-
87
func main() {
9-
updater.UpdateDirectory(
10-
// weztermの設定ディレクトリを呼び出す
11-
"../configs/wezterm",
12-
// 既存の設定ディレクトリがあれば消す
13-
"$HOME/.config/wezterm",
14-
// 設定を置く場所
15-
"$HOME/.config/",
16-
)
8+
updater.UpdateDirectory(
9+
// weztermの設定ディレクトリを呼び出す
10+
"../configs/wezterm",
11+
// 既存の設定ディレクトリがあれば消す
12+
"$HOME/.config/wezterm",
13+
// 設定を置く場所
14+
"$HOME/.config/",
15+
)
1716
}
18-

worker/entry_point/zsh/main.go

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
package main
22

33
import (
4-
"worker/internal/updater"
4+
"worker/internal/updater"
55
)
66

77
func zsh_config_update() {
8-
updater.UpdateDirectory(
9-
// 更新に使う設定ディレクトリ
10-
"../configs/zsh/config",
11-
// 既存の設定ディレクトリ
12-
"$HOME/.zsh/config",
13-
// 設定を置く場所
14-
"$HOME/.zsh/",
15-
)
8+
updater.UpdateDirectory(
9+
// 更新に使う設定ディレクトリ
10+
"../configs/zsh/config",
11+
// 既存の設定ディレクトリ
12+
"$HOME/.zsh/config",
13+
// 設定を置く場所
14+
"$HOME/.zsh/",
15+
)
1616
}
1717

1818
func zshrc_update() {
19-
updater.UpdateFile(
20-
// 既存の設定ファイル
21-
"$HOME/.zshrc",
22-
// 更新に使う設定ファイル
23-
"../configs/zsh/.zshrc",
24-
// 設定を置く場所
25-
"$HOME/",
26-
)
19+
updater.UpdateFile(
20+
// 既存の設定ファイル
21+
"$HOME/.zshrc",
22+
// 更新に使う設定ファイル
23+
"../configs/zsh/.zshrc",
24+
// 設定を置く場所
25+
"$HOME/",
26+
)
2727
}
2828

2929
func main() {
30-
zsh_config_update()
31-
zshrc_update()
30+
zsh_config_update()
31+
zshrc_update()
3232
}
33-

worker/internal/handler/handler_test.go

+29-28
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func teardownFixture(t *testing.T, dirPath string) {
3838
// TestRemoveRecursive: ディレクトリの再帰的削除のテスト
3939
func TestRemoveRecursive(t *testing.T) {
4040
// フィクスチャをセットアップ
41-
srcDir, _ := setupFixture(t) // dstDir は使わない
41+
srcDir, _ := setupFixture(t) // dstDir は使わない
4242
defer teardownFixture(t, srcDir) // テスト後にソースディレクトリを削除
4343

4444
// DirectoryPath を初期化
@@ -64,34 +64,35 @@ func TestRemoveRecursive(t *testing.T) {
6464

6565
// TestCopyRecursive: ディレクトリの再帰的コピーのテスト
6666
func TestCopyRecursive(t *testing.T) {
67-
// フィクスチャをセットアップ
68-
srcDir, dstDir := setupFixture(t)
69-
defer teardownFixture(t, dstDir) // テスト後にコピー先ディレクトリを削除
70-
71-
// DirectoryPath を初期化
72-
srcDirPath := &path.DirectoryPath{}
73-
err := srcDirPath.Initialize(srcDir)
74-
if err != nil {
75-
t.Fatalf("ソースディレクトリの初期化に失敗しました: %v", err)
76-
}
77-
78-
// dstDirPath は存在しないので初期化は不要
79-
dstDirPath := &path.DirectoryPath{Path: dstDir}
80-
81-
// ディレクトリをコピー
82-
dh := &handler.DirectoryHandler{}
83-
err = dh.CopyRecursive(srcDirPath, dstDirPath)
84-
if err != nil {
85-
t.Fatalf("ディレクトリのコピーに失敗しました: %v", err)
86-
}
87-
88-
// コピーされたファイルが存在するか確認
89-
copiedFile := filepath.Join(dstDir, "testfile.txt")
90-
_, err = os.Stat(copiedFile)
91-
if os.IsNotExist(err) {
92-
t.Fatalf("ファイルがコピーされていません")
93-
}
67+
// フィクスチャをセットアップ
68+
srcDir, dstDir := setupFixture(t)
69+
defer teardownFixture(t, dstDir) // テスト後にコピー先ディレクトリを削除
70+
71+
// DirectoryPath を初期化
72+
srcDirPath := &path.DirectoryPath{}
73+
err := srcDirPath.Initialize(srcDir)
74+
if err != nil {
75+
t.Fatalf("ソースディレクトリの初期化に失敗しました: %v", err)
76+
}
77+
78+
// dstDirPath は存在しないので初期化は不要
79+
dstDirPath := &path.DirectoryPath{Path: dstDir}
80+
81+
// ディレクトリをコピー
82+
dh := &handler.DirectoryHandler{}
83+
err = dh.CopyRecursive(srcDirPath, dstDirPath)
84+
if err != nil {
85+
t.Fatalf("ディレクトリのコピーに失敗しました: %v", err)
86+
}
87+
88+
// コピーされたファイルが存在するか確認
89+
copiedFile := filepath.Join(dstDir, "testfile.txt")
90+
_, err = os.Stat(copiedFile)
91+
if os.IsNotExist(err) {
92+
t.Fatalf("ファイルがコピーされていません")
93+
}
9494
}
95+
9596
// TestCreateDirectory tests the Create method
9697
func TestCreateDirectory(t *testing.T) {
9798
dirPath := &path.NonExistentDirectoryPath{}

worker/internal/handler/path_checker_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ func TestPathChecker_FilePathChecker(t *testing.T) {
4545
t.Errorf("存在するファイルを検出できませんでした: %v", tempFile.Name())
4646
}
4747
}
48-

0 commit comments

Comments
 (0)