まとめ
cron に仕込んで定期実行させて、「バージョンを上げるときに実質待ち時間ゼロ」みたいにできるかもしれない
レシピ
- rbenv-each
- Bash Script
コマンド
Bash script 形式:
#!/bin/bash commands=( "gem update --system" "gem update" "gem cleanup" ) for c in "$commands" do yes | rbenv each $commands done
ワンライナー形式:
for c in "gem update --system" "gem update" "gem cleanup";do yes | rbenv each $c;done
yes
しているのは
If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN]
で処理が止まるため
もしここで「no」と答えたいなら: yes
はオプションとして文字列を受け取れるので、 yes N
と1文字をオプションとして渡してあげる(詳細は man yes
で確認)
Links
- rbenv/rbenv-each: rbenv plugin to Run a command across all installed rubies. - GitHub
- Array variables
- Bash For Loop Array: Iterate Through Array Values – nixCraft
- yes (Unix) - Wikipedia
(Wikipedia を参照元としてリンクを貼るときに %28
とか %23
とか変換して指定してあげないとURL として認識してくれないの 地味に手間...)