前提
・OS:MacOSX 10.11.3
・brewインストール済み
手順
Node.jsとredisをインストール
$ brew install node redis
hubotと、coffee-scriptのインストール
$ npm install -g hubot coffee-script
テスト用のボットを作成
$ hubot --create test_bot
'hubot --create' is deprecated. Use the yeoman generator instead:
npm install -g yo generator-hubot
mkdir -p test_bot
cd test_bot
yo hubot
See https://github.com/github/hubot/blob/master/docs/index.md for more details on getting started.
→どうやら、yoコマンドで作らねばいけないようなので、上記コマンドでyoコマンドをインストール
yoコマンドをインストール
$ npm install -g yo generator-hubot
テスト用のボットを作成(yoコマンド版)
$ mkdir -p test_bot #ディレクトリを用意
$ cd test_bot #ディレクトリを移動
$ yo hubot
? ==========================================================================
We're constantly looking for ways to make yo better!
May we anonymously report usage statistics to improve the tool over time?
More info: https://github.com/yeoman/insight & http://yeoman.io
========================================================================== No
_____________________________
/ \
//\ | Extracting input for |
////\ _____ | self-replication process |
//////\ /_____\ \ /
======= |[^_/\_]| /----------------------------
| | _|___@@__|__
+===+/ /// \_\
| |_\ /// HUBOT/\\
|___/\// / \\
\ / +---+
\____/ | |
| //| +===+
\// |xx|
? Owner ****@gmail.com #自身のメアドを指定
? Bot name test-bot #ボット名を指定
? Description **** #ボットの説明
? Bot adapter typetalk #ボットのアダプタを指定。今回はtypetalk
create bin/hubot
create bin/hubot.cmd
create Procfile
create README.md
create external-scripts.json
create hubot-scripts.json
create .gitignore
create package.json
create scripts/example.coffee
create .editorconfig
_____________________________
_____ / \
\ \ | Self-replication process |
| | _____ | complete... |
|__\\| /_____\ \ Good luck with that. /
|//+ |[^_/\_]| /----------------------------
| | _|___@@__|__
+===+/ /// \_\
| |_\ /// HUBOT/\\
|___/\// / \\
\ / +---+
\____/ | |
| //| +===+
\// |xx|
・・・
以下のように、ファイルができている
$ ls
Procfile bin hubot-scripts.json package.json
README.md external-scripts.json node_modules scripts
ボットの動作確認
$ bin/hubot
test-bot> [Tue Feb 16 2016 21:50:32 GMT+0900 (JST)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web-url | cut -d= -f2)`
[Tue Feb 16 2016 21:50:32 GMT+0900 (JST)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Tue Feb 16 2016 21:50:32 GMT+0900 (JST)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis
test-bot> @test-bot ping
test-bot> PONG
→PONGとリプライが来ているのでOK!
次回
Typetalkで動かす!