4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【hubot】0からhubot入れてみる

Last updated at Posted at 2014-12-29

とりあえずローカルで動くところまで。
node.js使ったことなかったので色々入れる。

  • nvm
  • node.js(npm)
  • coffee script
  • redis
  • hubot

環境:OS X 10.9.5

nvm

$ git clone git://github.com/creationix/nvm.git ~/.nvm
$ sudo vi ~/.bash_profile

.bash_profileに記述:

#nvm
export NVM_NODEJS_ORG_MIRROR="https://nodejs.org/dist"
source ~/.nvm/nvm.sh

再読込:

$ source .bash_profile

node.js(npm)

$ nvm ls-remote
$ nvm install v0.11.14
$ nvm alias default v0.11.14

npmを利用してSocket.io入れる

$ npm install socket.io
$ npm ls

coffee script

$ npm install -g coffee-script

redis

brewで入れる:

$ brew install node redis

起動:

$ redis-server &

hubot

$ npm install -g hubot
$ hubot --create tars
'hubot --create' is deprecated. Use the yeoman generator instead:
    npm install -g yo generator-hubot
    mkdir -p tars
    yo hubot
See https://github.com/github/hubot/blob/master/docs/README.md for more details on getting started.

怒られたのでyeoman generator入れる:

$ npm install -g yo generator-hubot
$ mkdir -p tars
$ yo hubot

hubot起動:

$ bin/hubot

hubotコマンド作成

$ cd scripts
$ vim hello.coffee

hello.coffeeに記述:

module.exports = (robot) ->
    robot.respond /I am (.*)/i, (msg) ->
      msg.send "Hello, world! #{msg.match[1]}"

再度起動:

$ bin/hubot
Hubot> hubot I am kz56cd
Hello, world! kz56cd

参考

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?