Skip to content

Commit

Permalink
install programing languages by asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
JY8752 committed Jul 13, 2023
1 parent 565aa75 commit bb360c8
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 37 deletions.
1 change: 0 additions & 1 deletion .zshenv
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
. "$HOME/.cargo/env"
33 changes: 23 additions & 10 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd(){ vcs_info }

#nodenv
eval "$(nodenv init - --no-rehash)"
# eval "$(nodenv init - --no-rehash)"

#java
#export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"

#go
export GOPATH=/Users/yamanakajunichi # GOPATHにすると決めた場所
export PATH=$GOPATH/bin:$PATH
# export GOPATH=/Users/yamanakajunichi # GOPATHにすると決めた場所
# export PATH=$GOPATH/bin:$PATH

#jenv
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# export PATH="$HOME/.jenv/bin:$PATH"
# eval "$(jenv init -)"

# vim alias
alias vi="nvim"
Expand Down Expand Up @@ -81,14 +81,14 @@ export EDITOR=vim
eval "$(direnv hook zsh)"

# graal
export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.2.0/Contents/Home/bin:"$PATH"
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.2.0/Contents/Home
# export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.2.0/Contents/Home/bin:"$PATH"
# export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.2.0/Contents/Home

export JAVA_HOME=$GRAALVM_HOME
# export JAVA_HOME=$GRAALVM_HOME

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
# export SDKMAN_DIR="$HOME/.sdkman"
# [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"

# キーボードアシスト
alias chkey="open /System/Library/CoreServices/KeyboardSetupAssistant.app"
Expand All @@ -112,3 +112,16 @@ PS1='$(kube_ps1)'$PS1
# helm 補完
source <(helm completion zsh)

# asdf

# asdfの補完
# . /opt/homebrew/opt/asdf/libexec/asdf.sh
# fpath=($(brew --prefix asdf)/completions $fpath)
# autoload -Uz compinit && compinit

# asdfのJAVA_HOMEを設定
. ~/.asdf/plugins/java/set-java-home.zsh

# asdfのGOROOTを設定
. ~/.asdf/plugins/golang/set-env.zsh

6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do everything.
all: init link defaults brew
all: init link defaults brew code asdf

# Set initial preference.
init:
Expand Down Expand Up @@ -28,3 +28,7 @@ code:
# google chrome extentions list up
chromeex:
@ls -l $${HOME}/Library/Application\ Support/Google/Chrome/Default/Extensions | awk '{print $$9}' | sed 's/^/https:\/\/chrome.google.com\/webstore\/detail\//g' | sed -e '1,2d' > chrome/extensions

# Install Languages
asdf:
@scripts/asdf.sh
96 changes: 84 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# dotfiles

このリポジトリはdotfilesを管理するためのリポジトリです。このリポジトリでは以下の項目について管理しています。なお、このdotfilesは**MacOSを対象**としており、新しいMac端末に開発環境を構築することを目的として作成しています。
This repository is for managing dotfiles. It covers the following items. Note that these dotfiles **target MacOS** and are designed to set up a development environment on a new Mac machine.

- Macの初期設定。
- brewで管理しているモジュールのインストール。
- dotfilesのリンクの作成。
- 使用頻度の高いプログラミング言語の管理。
- (vscode, google chromeの拡張機能の管理。)変更検知はせずリストアップのみ。つまり、手動設定をしています。
- (グローバルインストールしたgo, nodeライブラリの管理。)変更検知はせずリストアップのみ。つまり、手動設定をしています。
- Initial setup of Mac.
- Installation of modules managed with brew.
- Creation of symbolic links for dotfiles.
- Management of frequently used programming languages.
- Listing and installation of VSCode extensions.
- Listing of Google Chrome extensions.
- Import file for Raycast.

拡張機能や各プログラミング言語ライブラリは追加、削除、バージョン追従が難しいので手動管理としています。
We manually manage globally installed libraries for Node and Go as version management can be challenging in this repository.

## 開発環境
## Development Environment

- aws
- gcp
- GitHub
- hammerspoon
- vscode
Expand All @@ -23,15 +23,87 @@
- neovim
- kitty
- Homebrew
- asdf

- Go
- TypeScript
- Java
- Kotlin

## インストール
## Installation

## 使い方
```
git clone git@github.com:JY8752/dotfiles.git
```

## Usage

### initialize all setting

By running the make command, the following settings and installations will be made.

- Initial settings for MacOS (installation of xcode command line tools and homebrew).
- Creation of symbolic links for various dotfiles in the home directory.
- Changing the default terminal settings of MacOS itself.
- Installation of packages listed in Homebrew's ```.Brewfile```.
- Installation of VSCode extensions and creation of a symbolic link for ```setting.json``` (extensions to be installed are listed in ```vscode/extensions```).
- Installation of various programming languages via asdf.

```
make
```

### Mac OS initial setting(xcode command line tool and homebrew install)

```
make init
```

### create symbolic link to home dir

```
make link
```

### change Mac OS default setting

```
make defaults
```

### install brew package

```
make berw
```

### list up vscode

Overwrite the ```vscode/extensions``` with extensions installed in the running OS's VSCode.

```
make codeex
```

### install vscode extensions

```
make code
```

### list up google chrome extensions

Write out a list of installation URLs for Google Chrome extensions installed on the running terminal to ```chrome/extensions``` (these extensions are only written out and manually managed).

```
make chromeex
```

### install languages

```
make asdf
```

## 参考

Expand Down
5 changes: 3 additions & 2 deletions scripts/.Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ brew "age"
brew "awscli"
# brew "binaryen"
brew "clang-format"
brew "coreutils"
# cmake
brew "deno"
brew "direnv"
Expand Down Expand Up @@ -57,14 +58,14 @@ cask "hammerspoon"
cask "intellij-idea-ce"
# cask "intellij-idea"
cask "obsidian"
cask "deel"
cask "deepl"
cask "visualvm"
cask "mysqlworkbench"

# cask "discord"
# cask "line"
# cask "kindle"

# 手動
# manual install
# gifski https://gif.ski/
# Flux https://justgetflux.com/
25 changes: 25 additions & 0 deletions scripts/asdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# install node
command asdf -v >/dev/null 2>&1 \
&& asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git \
&& asdf install nodejs latest \
&& asdf global nodejs latest

# install java
command asdf -v >/dev/null 2>&1 \
&& asdf plugin add java https://github.com/halcyon/asdf-java.git \
&& asdf install java latest:adoptopenjdk \
&& asdf global java latest:adoptopenjdk

# install golang
command asdf -v >/dev/null 2>&1 \
&& asdf plugin add golang https://github.com/kennyp/asdf-golang.git \
&& asdf install golang latest \
&& asdf global golang latest

# install rust
command asdf -v >/dev/null 2>&1 \
&& asdf plugin add rust https://github.com/code-lever/asdf-rust.git \
&& asdf install rust latest \
&& asdf global rust latest
18 changes: 9 additions & 9 deletions scripts/link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source $(dirname "${BASH_SOURCE[0]:-$0}")/util.sh

function link_to_homedir() {
# backupディレクトリを作成 
# make backup directory
print_notice "backup old dotfiles..."

local tmp_date
Expand All @@ -19,51 +19,51 @@ function link_to_homedir() {
local dotfiles_dir
dotfiles_dir="$(builtin cd "$current_dir" && git rev-parse --show-toplevel)"

# 除外ファイルの読み込み
# Load excluded files
linkignore=()
if [[ -e "$dotfiles_dir/.linkignore" ]]; then
while IFS= read -r line; do
linkignore+=("$line")
done <"$dotfiles_dir/.linkignore"
fi

# シンボリックリンクの作成
# make symbolic links
for f in "$dotfiles_dir"/.??*; do
local f_filename
f_filename=$(basename "$f")

# 除外ファイルの場合はスキップ
# if excluded file, skip
[[ ${linkignore[*]} =~ $f_filename ]] && continue

# .awsは配下のconfigをシンボリックリンクにする
# .aws make the subordinate config a symbolic link
if [ "$f_filename" = ".aws" ]; then
for config in "$f"/*; do
local config_filename
config_filename=$(basename "$config")

# 除外ファイルの場合はスキップ
# if excluded file, skip
[[ ${linkignore[*]} =~ $config_filename ]] && continue

backup_and_link "$config" "$HOME/.aws" "$backupdir"
done
continue
fi

# .configは配下のディレクトリをシンボリックリンクにする
# .config makes the directory under it a symbolic link
if [ "$f_filename" = ".config" ]; then
for config in "$f"/*; do
local config_filename
config_filename=$(basename "$config")

# 除外ファイルの場合はスキップ
# if excluded file, skip
[[ ${linkignore[*]} =~ $config_filename ]] && continue

backup_and_link "$config" "$HOME/.config" "$backupdir"
done
continue
fi

# それ以外はそのままホームディレクトリにシンボリックリンクを作成
# Create a symbolic link to the home directory as is otherwise
backup_and_link "$f" "$HOME" "$backupdir"
done
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ function backup_and_link() {
f_filename=$(basename "$link_src_file")
local f_filepath="$link_dest_dir/$f_filename"

# 既にシンボリックリンクとして存在する場合は削除
# Delete if already exists as a symbolic link
if [[ -L "$f_filepath" ]]; then
command rm -f "$f_filepath"
fi

# シンボリックリンクでなく実ファイルであればバックアップ
# Backup if it is a real file, not a symbolic link
if [[ -e "$f_filepath" && ! -L "$f_filepath" ]]; then
command mv "$f_filepath" "$backupdir"
fi
Expand Down

0 comments on commit bb360c8

Please sign in to comment.