Skip to content

Commit

Permalink
✨feature : brew 방식 변경
Browse files Browse the repository at this point in the history
feature/FANZ-162
  • Loading branch information
connor-27 committed Jun 17, 2024
1 parent f928300 commit 84782c5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 사용법

brew info fgit
brew update
brew upgrade --cask

```shell
brew tap connor-27/homebrew-submodule-kit
brew install fgit
Expand Down Expand Up @@ -36,10 +40,31 @@ xcode-select --install
-----
## 정상적인 설치가 안될 경우
이유는 잘 모르겠지만.. Uninstall 과 Untab 이 잘 안됌
```shell
brew uninstall fgit
brew untap connor-27/homebrew-submodule-kit
```
-----
## 버전 변경에 따른 재설치
```shell
brew info fgit
brew uninstall fgit
# 만약에 uninstall 이 잘 안될 경우~
# brew update
# brew upgrade --cask
# doctor 를 통해서 현재 brew 의 문제점들을 명령창에 나오는데로 해결해나감
# brew doctor
brew info fgit
brew untap connor-27/homebrew-submodule-kit
# 재설치
brew tap connor-27/homebrew-submodule-kit
brew install fgit
```
----
Expand Down
6 changes: 3 additions & 3 deletions fgit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ class Fgit < Formula
desc "Custom git aliases for submodule management"
homepage "https://github.com/connor-27/homebrew-submodule-kit"
url "https://github.com/connor-27/homebrew-submodule-kit/raw/main/fgit.sh"
version "1.0.3"
# shasum -a 256 fgit.sh
sha256 "94ba0251351f6528ca083e6e4a66758c2a972d7813753841c4ceb47b530e7caa" # 쉘에 대한 해시값 넣기
sha256 "86bf9c3c9b0ae31b0915d52a6d657ec40c3c32b074861b3af9c6f9df6f1fdb3c" # 쉘에 대한 해시값 넣기
version "1.0.5"

def install
bin.install "fgit.sh" => "fgit"
Expand All @@ -13,4 +13,4 @@ def install
test do
system "#{bin}/fgit", "help"
end
end
end
20 changes: 16 additions & 4 deletions fgit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
function help() {
echo "사용 가능한 명령어:"
echo " fgit add <repo_url> - 서브모듈을 추가해주는 명령어"
echo " fgit remove - 서브모듈을 삭제해주는 명령어"
echo " fgit reset [submodule] - 서브모듈을 지우고 다시 추가해주는 명령어 ( 서브모듈 main 브랜치로 )"
echo " fgit clone <repo_url> - 서브모듈이 있는 저장소를 클론하고 서브모듈을 main 브랜치로 체크아웃 후 최신 상태로 업데이트"
echo " fgit branch [submodule] - 서브모듈의 브랜치 정보를 조회"
Expand All @@ -23,6 +24,7 @@ function help() {
}
#####################################################
# - add
# - remove
# - reset
# - clone
# - branch
Expand All @@ -47,13 +49,23 @@ function add() {

#####################################################

# 워킹레포지토리에 서브모듈 삭제
function remove() {
submodule_name=$(basename "$repo_url" .git)
git submodule deinit -f "$submodule_name" &&
rm -rf ".git/modules/$submodule_name" &&
git rm -f "$submodule_name"
}

#####################################################

# 서브모듈을 지우고 다시 추가해주는 명령어
function reset() {
repo_url=$1
submodule_name=${1:-$(awk '/path/ {print $3}' .gitmodules)}
git submodule deinit -f submodule_name &&
rm -rf .git/modules/submodule_name &&
git rm -f submodule_name &&
submodule_name=$(basename "$repo_url" .git)
git submodule deinit -f "$submodule_name" &&
rm -rf ".git/modules/$submodule_name" &&
git rm -f "$submodule_name" &&
add "$repo_url"
}

Expand Down

0 comments on commit 84782c5

Please sign in to comment.