一键搭建Hexo环境

每次在一台新的电脑上进行环境搭建,都需要搜索一下才行,然而弄来弄去命令就是那么几条,这里的脚本就是用来做hexo环境的搭建。

SYS=`uname`

function init {
    git clone [email protected]:yyuyang/sasuraiu.github.io.git
    cd projects/sasuraiu.github.io
    npm config set registry https://registry.npm.taobao.org
    npm install -g hexo-cli
    # npm install hexo --save
}

if [ "$SYS" == "Darwin" ]; then
    echo "macOS"
    if [ `command -v node` ]; then
        echo "node exist"
    else
        echo "install node: "
        brew install node
    fi
    init
elif [ "$SYS" == "Linux"]; then
    echo "Linux"
    if [ `command -v node` ]; then
        echo "node exist"
    else
        echo "install node:"
        sudo apt install -y node git
    fi
    init
else 
    echo "no solution yet"
fi

留待下次验证

发布了166 篇原创文章 · 获赞 118 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/asahinokawa/article/details/96729337
今日推荐