ChefでHubotをインストールする
コマンドラインでのインストールと同様のことをChefで行おうとしたときに、対話式の部分で躓いたのでそのときのメモ。
※Node.jsがインストールされている前提です。
コマンドラインでインストール
$npm install -g yo generator-hubot hubot coffee-script
$yo hubot
このときに対話式でいくつか入力を求められます。
Owner : 制作者のメールアドレス
Bot name : 生成するHubotの名前
Description : 生成するHubotの説明
Bot adapter : 使用するアダプタ
Chefでインストール
chefで対話式のインストーラを扱う場合はexpectと使うと自動入力してくれる。
cookbook_file "/tmp/yo_hubot.sh" do
mode "755"
source "your_directory/yo_hubot.sh"
end
execute "install hubot" do
not_if "which hubot"
command "npm install -g yo generator-hubot hubot coffee-script"
notifies :run, "execute[yo_hubot]"
end
execute "yo_hubot" do
action :nothing
command "/tmp/yo_hubot.sh"
end
yo_hubot.sh
#!/bin/bash
expect -c '
spawn yo hubot
set timeout -1
expect {
-regexp ".*Y/n.*" {
exp_send "n\r"
-regexp ".*Owner.*" {
exp_send "your e-mail adress\r"
}
}
-regexp ".*Owner.*" {
exp_send "your e-mail adress\r"
}
}
expect {
-regexp ".*Bot name.*" {
exp_send "your bot name\r"
}
}
expect {
-regexp ".*Description.*" {
exp_send "your bot description\r"
}
}
expect {
-regexp ".*Bot adapter.*" {
exp_send "use adapter name\r"
}
}
expect eof
'
何か間違ってるとかこっちの方がいいとかありましたらお願いします。
Author And Source
この問題について(ChefでHubotをインストールする), 我々は、より多くの情報をここで見つけました https://qiita.com/usayuki/items/7e00523a329e3b4b8fcc著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .