Githubプロジェクトのファイル操作に関するベストプラクティス

Githubプロジェクトのファイル操作に関するベストプラクティス

gem install tmuxinator私はプロジェクトのgithubインストール手順を介してインストールされたtmuxinator ruby​​ gemを使用しています。

tmuxinatorリンク

インストール手順の一環として、リポジトリから「フル」ファイルをダウンロードし、シェルのrcファイルからそのファイルに接続することを指定します。

私の問題:プロジェクトをRuby gemとしてインストールするときにGithubリポジトリを複製するのではなく、必要なファイルだけをダウンロードしても更新されません。リポジトリを複製し、zshrcでその場所を指すどこかに保存する必要がありますか?

人々はベストプラクティスや一般的なアプローチを持っていますか?それ以外の場合は、ファイルを更新しないか、この方法で作業するためにすべてのプロジェクトリポジトリを複製する必要がありますか?

ベストアンサー1

これはあなたが求めていることを達成しzshますbash

gem clean以前のバージョンを削除すると、次にコードを実行するとき(つまり、次回シェルが起動するとき)のtmuxinator問題が解決されます。.zshrc

# Allow shell-specific code
function sh_is_zsh { [[ -n $ZSH_VERSION ]]; }
function sh_is_bash { [[ -n $BASH_VERSION ]]; }

# Update "tmuxinator.{z,ba}sh" if needed
tmuxinator_source="$XDG_CONFIG_HOME/tmuxinator/tmuxinator.$(sh_is_zsh && echo zsh || echo bash)"
# If not a regular file or symlink to one
if [[ ! -f $tmuxinator_source ]]; then
    # If doesn't exist or is a symlink to nowhere
    if [[ ! -e $tmuxinator_source ]] || [[ -L $tmuxinator_source ]] && [[ ! -e $tmuxinator_source ]]; then
        echo "Creating ${tmuxinator_source##*/} symlink:"
        tmp=$(gem which tmuxinator) # tmuxinator executable
        tmp=$(readlink -f "${tmp%/*}/../completion") # completion scripts dir
        ln -fsv "$tmp/${tmuxinator_source##*/}" "$tmuxinator_source"
        unset tmp
    else
      echo "Not creating symlink at at existing:"
      ls -lF "$tmuxinator_source"
    fi
fi

source "$tmuxinator_source"
unset $tmuxinator_source

shellcheck追加のブラウニーポイントのためにきれいです。

おすすめ記事