forked from circuit/hubot-circuit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Despoina Topali
committed
May 29, 2017
0 parents
commit 649f7da
Showing
7 changed files
with
1,399 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/coverage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# hubot-circuit | ||
|
||
[![CircleCI](https://circleci.com/bb/breadboard/hubot-circuit.svg?style=shield)](https://circleci.com/bb/breadboard/hubot-circuit) | ||
[![Coverage Status](https://coveralls.io/repos/bitbucket/breadboard/hubot-circuit/badge.svg)](https://coveralls.io/bitbucket/breadboard/hubot-circuit) | ||
[![Dependency Status](https://gemnasium.com/badges/bitbucket.org/breadboard/hubot-circuit.svg)](https://gemnasium.com/bitbucket.org/breadboard/hubot-circuit) | ||
|
||
## Description | ||
This is the [Circuit](http://circuit.com) adapter for [hubot](http://hubot.github.com). Now, you can create your own bots in Circuit and have them easily configured through hubot. | ||
|
||
#### Configuration | ||
|
||
* Start by creating a [bot application](https://hubot.github.com/docs/#getting-started-with-hubot) | ||
* Create a Circuit client credentials application | ||
* Get the **client_id** and **client_secret** | ||
* Export necessary environment variables. The Circuit adapter requires 3 environment variables: | ||
|
||
``` | ||
export HUBOT_CIRCUIT_CLIENT_ID="YOUR_CIRCUIT_CLIENT_ID" | ||
export HUBOT_CIRCUIT_CLIENT_SECRET="YOUR_CIRCUIT_CLIENT_SECRET" | ||
export HUBOT_CIRCUIT_WEBHOOKS_URL="YOUR_APP_URL" | ||
``` | ||
The following are optional: | ||
``` | ||
export HUBOT_CIRCUIT_REST_API_URL="CIRCUIT_REST_API_URL" | ||
export HUBOT_CIRCUIT_ADDRESS="YOUR_APP_ADDRESS" | ||
export HUBOT_CIRCUIT_PORT="YOUR_APP_PORT" | ||
export HUBOT_CIRCUIT_SCOPE="YOUR_APP_SCOPE" | ||
``` | ||
If you do not specify the optional parameters above the default ones will be loaded. | ||
``` | ||
HUBOT_CIRCUIT_ADDRESS="0.0.0.0" | ||
HUBOT_CIRCUIT_PORT="8181" | ||
HUBOT_CIRCUIT_REST_API_URL="https://eu.yourcircuit.com/v2" | ||
HUBOT_CIRCUIT_SCOPE="READ_USER_PROFILE,READ_CONVERSATIONS,WRITE_CONVERSATIONS" | ||
``` | ||
|
||
#### Run hubot | ||
``` | ||
./bin/hubot -a circuit | ||
``` | ||
|
||
hubot-circuit uses [Rest API](https://eu.yourcircuit.com/rest/swagger/ui/index.html) and webhooks in order to communicate with Circuit. The default events that are registered through webhooks are the CONVERSATION.ADD_ITEM and CONVERSATION.UPDATE_ITEM. In order to receive events the callback url (HUBOT_CIRCUIT_WEBHOOKS_URL) that you will use must be a secure url. | ||
|
||
###### Certificates | ||
|
||
When you load hubot-circuit adapter, an express https server will start up on 443 port. In order for the https server to start up place the certificate files, named 'key.pem' and 'cert.pem', in the root folder of your application. | ||
|
||
|
||
If you have not provided any certificates an http server will start up on 8181 port. | ||
|
||
**Note:** Hubot starts a server on the address and port you have specified with the corresponding env variables (EXPRESS_BIND_ADDRESS and EXPRESS_PORT) or 0.0.0.0 and 8080, otherwise. If you do not plan to use robot.router in your scripts, you can disable the embedded hubot express server, simply by running | ||
|
||
``` | ||
./bin/hubot -d -a circuit | ||
``` | ||
|
||
Otherwise, you will have two servers running on 8080 and on 8181. | ||
|
||
#### How do I get set up? | ||
|
||
|
||
* Install dependencies with | ||
``` | ||
npm install | ||
``` | ||
* Run tests | ||
``` | ||
npm test | ||
``` | ||
|
||
#### Contribution guidelines | ||
|
||
* Fork the project | ||
* Clone your fork | ||
* Create a feature branch | ||
* Develop your feature | ||
* Write tests | ||
* Make sure everything still passes by running tests | ||
* Make sure you have followed coffeescript's syntax [coffeelint](http://www.coffeelint.org/) | ||
* Make sure coverage is not decreased | ||
* Push your changes | ||
* Send a pull request for your branch |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This is a sample build configuration for Javascript (Node.js). | ||
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples. | ||
# Only use spaces to indent your .yml configuration. | ||
# ----- | ||
# You can specify a custom docker image from Docker Hub as your build environment. | ||
image: node:4.6.0 | ||
|
||
pipelines: | ||
default: | ||
- step: | ||
script: # Modify the commands below to build your repository. | ||
- npm install | ||
- npm test | ||
- npm run coveralls |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"arrow_spacing": { | ||
"level": "warn" | ||
}, | ||
"braces_spacing": { | ||
"level": "warn", | ||
"spaces": 0, | ||
"empty_object_spaces": 0 | ||
}, | ||
"camel_case_classes": { | ||
"level": "error" | ||
}, | ||
"coffeescript_error": { | ||
"level": "error" | ||
}, | ||
"colon_assignment_spacing": { | ||
"level": "ignore", | ||
"spacing": { | ||
"left": 0, | ||
"right": 0 | ||
} | ||
}, | ||
"cyclomatic_complexity": { | ||
"level": "warn", | ||
"value": 10 | ||
}, | ||
"duplicate_key": { | ||
"level": "error" | ||
}, | ||
"empty_constructor_needs_parens": { | ||
"level": "ignore" | ||
}, | ||
"ensure_comprehensions": { | ||
"level": "warn" | ||
}, | ||
"eol_last": { | ||
"level": "ignore" | ||
}, | ||
"indentation": { | ||
"value": 2, | ||
"level": "error" | ||
}, | ||
"line_endings": { | ||
"level": "ignore", | ||
"value": "unix" | ||
}, | ||
"max_line_length": { | ||
"value": 100, | ||
"level": "error", | ||
"limitComments": true | ||
}, | ||
"missing_fat_arrows": { | ||
"level": "ignore", | ||
"is_strict": false | ||
}, | ||
"newlines_after_classes": { | ||
"value": 3, | ||
"level": "ignore" | ||
}, | ||
"no_backticks": { | ||
"level": "error" | ||
}, | ||
"no_debugger": { | ||
"level": "warn", | ||
"console": false | ||
}, | ||
"no_empty_functions": { | ||
"level": "ignore" | ||
}, | ||
"no_empty_param_list": { | ||
"level": "ignore" | ||
}, | ||
"no_implicit_braces": { | ||
"level": "ignore", | ||
"strict": true | ||
}, | ||
"no_implicit_parens": { | ||
"level": "ignore", | ||
"strict": true | ||
}, | ||
"no_interpolation_in_single_quotes": { | ||
"level": "ignore" | ||
}, | ||
"no_nested_string_interpolation": { | ||
"level": "warn" | ||
}, | ||
"no_plusplus": { | ||
"level": "ignore" | ||
}, | ||
"no_private_function_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"no_stand_alone_at": { | ||
"level": "ignore" | ||
}, | ||
"no_tabs": { | ||
"level": "error" | ||
}, | ||
"no_this": { | ||
"level": "ignore" | ||
}, | ||
"no_throwing_strings": { | ||
"level": "error" | ||
}, | ||
"no_trailing_semicolons": { | ||
"level": "error" | ||
}, | ||
"no_trailing_whitespace": { | ||
"level": "error", | ||
"allowed_in_comments": false, | ||
"allowed_in_empty_lines": true | ||
}, | ||
"no_unnecessary_double_quotes": { | ||
"level": "ignore" | ||
}, | ||
"no_unnecessary_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"non_empty_constructor_needs_parens": { | ||
"level": "ignore" | ||
}, | ||
"prefer_english_operator": { | ||
"level": "ignore", | ||
"doubleNotLevel": "ignore" | ||
}, | ||
"space_operators": { | ||
"level": "ignore" | ||
}, | ||
"spacing_after_comma": { | ||
"level": "ignore" | ||
}, | ||
"transform_messes_up_line_numbers": { | ||
"level": "warn" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "hubot-circuit", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "src/circuit.coffee", | ||
"scripts": { | ||
"test": "coffeelint src/circuit.coffee && mocha -c --full-trace --compilers coffee:coffee-script/register --require coffee-coverage/register-istanbul --reporter spec test/*.coffee && istanbul report text-summary lcov", | ||
"coveralls": "istanbul report text-summary lcov && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"body-parser": "^1.17.1", | ||
"express": "^4.15.2", | ||
"parent-require": "^1.0.0", | ||
"request": "^2.81.0" | ||
}, | ||
"peerDependencies": { | ||
"hubot": ">=2.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^6.0.0", | ||
"coffee-coverage": "^2.0.0", | ||
"coffee-script": "^1.12.5", | ||
"coffeelint": "^1.16.0", | ||
"coveralls": "^2.13.1", | ||
"hubot": "^2.19.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"proxyquire": "^1.7.11", | ||
"sinon": "~2.1.0", | ||
"sinon-chai": "^2.9.0", | ||
"supertest": "^3.0.0" | ||
} | ||
} |
Oops, something went wrong.