This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash'); | |
var list = ['a', 'b', 'c', 'd']; | |
_.each(list, function(data) { | |
console.log('------', data); | |
if (data === 'b') { | |
return false; | |
} | |
console.log('-----after'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Installing hubot coffee-script | |
$ npm install -g hubot coffee-script | |
// Cheking hubot version | |
$ hubot -v | |
2.18.0 | |
// After hubot version 2.9, we use generator-hubot when initializing hubot. | |
$ npm install -g yo generator-hubot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yo hubot | |
_____________________________ | |
/ \ | |
//\ | Extracting input for | | |
////\ _____ | self-replication process | | |
//////\ /_____\ \ / | |
======= |[^_/\_]| /---------------------------- | |
| | _|___@@__|__ | |
+===+/ /// \_\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tree -L 2 | |
. | |
├── Procfile | |
├── README.md | |
├── bin | |
│ ├── hubot | |
│ └── hubot.cmd | |
├── external-scripts.json | |
├── hubot-scripts.json | |
├── node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (robot) -> | |
robot.hear /ping/i, (res) -> | |
res.send "pong" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bin/hubot | |
hubot-slack> [Sat Jan 23 2016 15:58:38 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)` | |
[Sat Jan 23 2016 15:58:38 GMT+0900 (JST)] INFO hubot-redis-brain: Using default redis on localhost:6379 | |
hubot-slack> ping | |
hubot-slack> pong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ここでターミナルからherokuへのログインを行う | |
$ heroku login | |
# herokuのアプリケーション作成 XXXXはアプリ名 | |
$ heroku create XXXX | |
# ここで作成したhubotディレクトリ(以前作成したhubot-slackディレクトリ)へ移動する | |
$ cd ./hubot-slack | |
# herokuにコミットする git commitして、herokuにpushする |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 作成したhubotディレクトリ直下で以下のコマンドを実行する | |
# package.jsonにhubot-slackの情報を記述するため、-gコマンドはつけず、--saveをつける | |
$ npm install hubot-slack --save | |
# hubotディレクトリ直下のProcfileを以下の内容に変える | |
web: bin/hubot --adapter slack | |
#変更後、git commit してherokuにpushする | |
git add --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#tokenをコンフィグ値に設定する | |
$heroku config:set HUBOT_SLACK_TOKEN=????_??????????? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hubotスクリプトのディレクトリへ移動して | |
// hubot-heroku-keepalive をインストール | |
$ cd hubot-sciript-dir | |
$ npm install hubot-heroku-keepalive --save | |
// ./external-scripts.jsonに以下の文字列を追記する | |
"hubot-heroku-keepalive" | |
// 修正した分をherokuにpushする | |
$ git add -A |
OlderNewer