├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── index.js ├── package.json ├── script ├── bootstrap └── test ├── src └── fliptable.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.11" 4 | - "0.10" 5 | notifications: 6 | email: false 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 hubot-scripts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hubot: hubot-fliptable 2 | 3 | Sometimes you need to flip a table. 4 | 5 | See [`src/fliptable.js`](src/fliptable.js) for full documentation. 6 | 7 | ## Installation 8 | 9 | Add **hubot-fliptable** to your `package.json` file: 10 | 11 | ```json 12 | "dependencies": { 13 | "hubot": ">= 2.5.1", 14 | "hubot-scripts": ">= 2.4.2", 15 | "hubot-fliptable": ">= 0.0.0" 16 | } 17 | ``` 18 | 19 | Add **hubot-fliptable** to your `external-scripts.json`: 20 | 21 | ```json 22 | ["hubot-fliptable"] 23 | ``` 24 | 25 | Run `npm install hubot-fliptable` 26 | 27 | ## Sample Interaction 28 | 29 | ``` 30 | user1> hubot flip 31 | Hubot> (╯°□°)╯︵ ┻━┻ 32 | ``` 33 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | module.exports = function(robot, scripts) { 5 | const scriptsPath = path.resolve(__dirname, 'src'); 6 | return fs.exists(scriptsPath, function(exists) { 7 | if (exists) { 8 | return (() => { 9 | const result = []; 10 | for (let script of fs.readdirSync(scriptsPath)) { 11 | if ((scripts != null) && !Array.from(scripts).includes('*')) { 12 | if (Array.from(scripts).includes(script)) { 13 | result.push(robot.loadFile(scriptsPath, script)); 14 | } 15 | } else { 16 | result.push(robot.loadFile(scriptsPath, script)); 17 | } 18 | } 19 | return result; 20 | })(); 21 | } 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hubot-fliptable", 3 | "description": "A hubot script to flip a table", 4 | "version": "2.0.0", 5 | "author": "JJ Asghar ", 6 | "license": "MIT", 7 | 8 | "keywords": [ 9 | "hubot", 10 | "hubot-scripts" 11 | ], 12 | 13 | "repository": { 14 | "type": "git", 15 | "url": "git@github.com:hubot-scripts/hubot-fliptable.git" 16 | }, 17 | 18 | "bugs": { 19 | "url": "https://github.com/hubot-scripts/hubot-fliptable/issues" 20 | }, 21 | 22 | "devDependencies": { 23 | "mocha": "*", 24 | "chai": "*", 25 | "sinon-chai": "*", 26 | "sinon": "*" 27 | }, 28 | 29 | "main": "index.js", 30 | 31 | "scripts": { 32 | "test": "script/test" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure everything is development forever 4 | export NODE_ENV=development 5 | 6 | # Load environment specific environment variables 7 | if [ -f .env ]; then 8 | source .env 9 | fi 10 | 11 | if [ -f .env.${NODE_ENV} ]; then 12 | source .env.${NODE_ENV} 13 | fi 14 | 15 | npm install 16 | 17 | # Make sure coffee and mocha are on the path 18 | export PATH="node_modules/.bin:$PATH" 19 | -------------------------------------------------------------------------------- /script/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # bootstrap environment 4 | source script/bootstrap 5 | 6 | mocha --compilers coffee:coffee-script 7 | -------------------------------------------------------------------------------- /src/fliptable.js: -------------------------------------------------------------------------------- 1 | // Description: 2 | // Make hubot flip a table 3 | // 4 | // Dependencies: 5 | // None 6 | // 7 | // Configuration: 8 | // None 9 | // 10 | // Commands: 11 | // hubot flip - Hubot flips a table 12 | // 13 | // Author: 14 | // jjasghar 15 | // Jason Dixon 16 | 17 | module.exports = robot => 18 | 19 | robot.respond(/flip\b/i, function(msg) { 20 | const flips = [ 21 | '(╯°□°)╯︵ ┻━┻', 22 | '┬─┬ ノ( ゜-゜ノ)', 23 | '(ノ ゜Д゜)ノ ︵ ┻━┻', 24 | '(╯°□°)╯︵ ┻━┻ ︵ ╯(°□° ╯)', 25 | '┬─┬ ︵ /(.□. \)', 26 | '‎(ノಥ益ಥ)ノ ┻━┻', 27 | '(ノ^_^)ノ┻━┻ ┬─┬ ノ( ^_^ノ)', 28 | '(╯°Д°)╯︵ /(.□ . \)', 29 | "(╯'□')╯︵ ┻━┻", 30 | '(ノಥДಥ)ノ︵┻━┻・/', 31 | '(/ .□.)\ ︵╰(゜Д゜)╯︵ /(.□. \)', 32 | '(._.) ~ ︵ ┻━┻', 33 | 'ʕノ•ᴥ•ʔノ ︵ ┻━┻', 34 | '(/¯◡ ‿ ◡)/¯ ~ ┻━┻', 35 | '(/¯◡ ‿ ◡)/¯ ~ ┻━┻', 36 | '┻━┻ ︵ ლ(⌒-⌒ლ)', 37 | 'ʇǝʞɔɐɹq ︵ヽ(`Д´)ノ︵ ǝʞup' 38 | ]; 39 | return msg.send(msg.random(flips)); 40 | }) 41 | ; 42 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | assertion-error@^1.0.1: 6 | version "1.0.2" 7 | resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" 8 | 9 | balanced-match@^1.0.0: 10 | version "1.0.0" 11 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" 12 | 13 | brace-expansion@^1.1.7: 14 | version "1.1.8" 15 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" 16 | dependencies: 17 | balanced-match "^1.0.0" 18 | concat-map "0.0.1" 19 | 20 | browser-stdout@1.3.0: 21 | version "1.3.0" 22 | resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" 23 | 24 | chai@*: 25 | version "4.1.2" 26 | resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" 27 | dependencies: 28 | assertion-error "^1.0.1" 29 | check-error "^1.0.1" 30 | deep-eql "^3.0.0" 31 | get-func-name "^2.0.0" 32 | pathval "^1.0.0" 33 | type-detect "^4.0.0" 34 | 35 | check-error@^1.0.1: 36 | version "1.0.2" 37 | resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" 38 | 39 | coffee-script@~1.6: 40 | version "1.6.3" 41 | resolved "https://registry.yarnpkg.com/coffee-script/-/coffee-script-1.6.3.tgz#6355d32cf1b04cdff6b484e5e711782b2f0c39be" 42 | 43 | commander@2.11.0: 44 | version "2.11.0" 45 | resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" 46 | 47 | concat-map@0.0.1: 48 | version "0.0.1" 49 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 50 | 51 | debug@3.1.0: 52 | version "3.1.0" 53 | resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" 54 | dependencies: 55 | ms "2.0.0" 56 | 57 | deep-eql@^3.0.0: 58 | version "3.0.1" 59 | resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" 60 | dependencies: 61 | type-detect "^4.0.0" 62 | 63 | diff@3.3.1: 64 | version "3.3.1" 65 | resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" 66 | 67 | diff@^3.1.0: 68 | version "3.4.0" 69 | resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" 70 | 71 | escape-string-regexp@1.0.5: 72 | version "1.0.5" 73 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 74 | 75 | formatio@1.2.0, formatio@^1.2.0: 76 | version "1.2.0" 77 | resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb" 78 | dependencies: 79 | samsam "1.x" 80 | 81 | fs.realpath@^1.0.0: 82 | version "1.0.0" 83 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 84 | 85 | get-func-name@^2.0.0: 86 | version "2.0.0" 87 | resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" 88 | 89 | glob@7.1.2: 90 | version "7.1.2" 91 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" 92 | dependencies: 93 | fs.realpath "^1.0.0" 94 | inflight "^1.0.4" 95 | inherits "2" 96 | minimatch "^3.0.4" 97 | once "^1.3.0" 98 | path-is-absolute "^1.0.0" 99 | 100 | growl@1.10.3: 101 | version "1.10.3" 102 | resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" 103 | 104 | has-flag@^2.0.0: 105 | version "2.0.0" 106 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" 107 | 108 | he@1.1.1: 109 | version "1.1.1" 110 | resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" 111 | 112 | inflight@^1.0.4: 113 | version "1.0.6" 114 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 115 | dependencies: 116 | once "^1.3.0" 117 | wrappy "1" 118 | 119 | inherits@2: 120 | version "2.0.3" 121 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" 122 | 123 | isarray@0.0.1: 124 | version "0.0.1" 125 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" 126 | 127 | just-extend@^1.1.26: 128 | version "1.1.27" 129 | resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905" 130 | 131 | lodash.get@^4.4.2: 132 | version "4.4.2" 133 | resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" 134 | 135 | lolex@^1.6.0: 136 | version "1.6.0" 137 | resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" 138 | 139 | lolex@^2.2.0: 140 | version "2.3.1" 141 | resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.1.tgz#3d2319894471ea0950ef64692ead2a5318cff362" 142 | 143 | minimatch@^3.0.4: 144 | version "3.0.4" 145 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" 146 | dependencies: 147 | brace-expansion "^1.1.7" 148 | 149 | minimist@0.0.8: 150 | version "0.0.8" 151 | resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" 152 | 153 | mkdirp@0.5.1: 154 | version "0.5.1" 155 | resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" 156 | dependencies: 157 | minimist "0.0.8" 158 | 159 | mocha@*: 160 | version "4.0.1" 161 | resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.0.1.tgz#0aee5a95cf69a4618820f5e51fa31717117daf1b" 162 | dependencies: 163 | browser-stdout "1.3.0" 164 | commander "2.11.0" 165 | debug "3.1.0" 166 | diff "3.3.1" 167 | escape-string-regexp "1.0.5" 168 | glob "7.1.2" 169 | growl "1.10.3" 170 | he "1.1.1" 171 | mkdirp "0.5.1" 172 | supports-color "4.4.0" 173 | 174 | ms@2.0.0: 175 | version "2.0.0" 176 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" 177 | 178 | nise@^1.2.0: 179 | version "1.2.0" 180 | resolved "https://registry.yarnpkg.com/nise/-/nise-1.2.0.tgz#079d6cadbbcb12ba30e38f1c999f36ad4d6baa53" 181 | dependencies: 182 | formatio "^1.2.0" 183 | just-extend "^1.1.26" 184 | lolex "^1.6.0" 185 | path-to-regexp "^1.7.0" 186 | text-encoding "^0.6.4" 187 | 188 | once@^1.3.0: 189 | version "1.4.0" 190 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 191 | dependencies: 192 | wrappy "1" 193 | 194 | path-is-absolute@^1.0.0: 195 | version "1.0.1" 196 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 197 | 198 | path-to-regexp@^1.7.0: 199 | version "1.7.0" 200 | resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" 201 | dependencies: 202 | isarray "0.0.1" 203 | 204 | pathval@^1.0.0: 205 | version "1.1.0" 206 | resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" 207 | 208 | samsam@1.x: 209 | version "1.3.0" 210 | resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50" 211 | 212 | sinon-chai@*: 213 | version "2.14.0" 214 | resolved "https://registry.yarnpkg.com/sinon-chai/-/sinon-chai-2.14.0.tgz#da7dd4cc83cd6a260b67cca0f7a9fdae26a1205d" 215 | 216 | sinon@*: 217 | version "4.1.2" 218 | resolved "https://registry.yarnpkg.com/sinon/-/sinon-4.1.2.tgz#65610521d926fb53742dd84cd599f0b89a82f440" 219 | dependencies: 220 | diff "^3.1.0" 221 | formatio "1.2.0" 222 | lodash.get "^4.4.2" 223 | lolex "^2.2.0" 224 | nise "^1.2.0" 225 | supports-color "^4.4.0" 226 | type-detect "^4.0.0" 227 | 228 | supports-color@4.4.0: 229 | version "4.4.0" 230 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" 231 | dependencies: 232 | has-flag "^2.0.0" 233 | 234 | supports-color@^4.4.0: 235 | version "4.5.0" 236 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" 237 | dependencies: 238 | has-flag "^2.0.0" 239 | 240 | text-encoding@^0.6.4: 241 | version "0.6.4" 242 | resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" 243 | 244 | type-detect@^4.0.0: 245 | version "4.0.5" 246 | resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.5.tgz#d70e5bc81db6de2a381bcaca0c6e0cbdc7635de2" 247 | 248 | wrappy@1: 249 | version "1.0.2" 250 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 251 | --------------------------------------------------------------------------------