hubot 3.3.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ name: Node.js (macOS) CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ schedule:
7
+ - cron: '5 4 * * 0'
8
+
9
+ jobs:
10
+ npm-test:
11
+
12
+ runs-on: macos-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ node-version: [18.x]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v3
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+ - run: npm ci
26
+ - run: npm test
@@ -0,0 +1,28 @@
1
+ name: Node.js (Ubuntu) CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+ schedule:
9
+ - cron: '5 4 * * 0'
10
+
11
+ jobs:
12
+ npm-test:
13
+
14
+ runs-on: ubuntu-latest
15
+
16
+ strategy:
17
+ matrix:
18
+ node-version: [14.x, 16.x, 18.x, latest]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Use Node.js ${{ matrix.node-version }}
23
+ uses: actions/setup-node@v3
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+ cache: 'npm'
27
+ - run: npm ci
28
+ - run: npm test
@@ -0,0 +1,26 @@
1
+ name: Node.js (Windows) CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ schedule:
7
+ - cron: '5 4 * * 0'
8
+
9
+ jobs:
10
+ npm-test:
11
+
12
+ runs-on: windows-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ node-version: [18.x]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v3
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+ - run: npm ci
26
+ - run: npm test
@@ -0,0 +1,36 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ permissions:
7
+ contents: read
8
+ jobs:
9
+ release:
10
+ name: Release
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write
14
+ issues: write
15
+ pull-requests: write
16
+ id-token: write
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v3
20
+ with:
21
+ fetch-depth: 0
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v3
24
+ with:
25
+ node-version: "lts/*"
26
+ - name: Install Dependencies
27
+ run: npm clean-install
28
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
29
+ run: npm audit signatures
30
+ - name: Run Tests
31
+ run: npm test
32
+ - name: Release
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36
+ run: npx semantic-release
package/.node-version ADDED
@@ -0,0 +1 @@
1
+ 18.16.0
package/README.md CHANGED
@@ -1,4 +1,6 @@
1
- [![Build Status](https://travis-ci.org/hubotio/hubot.svg?branch=master)](https://travis-ci.org/hubotio/hubot) [![Coverage Status](https://coveralls.io/repos/github/hubotio/hubot/badge.svg?branch=master)](https://coveralls.io/github/hubotio/hubot?branch=master)
1
+ ![Build Status: MacOS](https://github.com/hubotio/hubot/actions/workflows/nodejs-macos.yml/badge.svg)
2
+ ![Build Status: Ubuntu](https://github.com/hubotio/hubot/actions/workflows/nodejs-ubuntu.yml/badge.svg)
3
+ ![Build Status: Window](https://github.com/hubotio/hubot/actions/workflows/nodejs-windows.yml/badge.svg)
2
4
 
3
5
  # Hubot
4
6
 
@@ -13,8 +15,7 @@ for details on getting up and running with your very own robot friend.
13
15
  In most cases, you'll probably never have to hack on this repo directly if you
14
16
  are building your own bot. But if you do, check out [CONTRIBUTING.md](CONTRIBUTING.md)
15
17
 
16
- If you'd like to chat with Hubot users and developers, [join us on Slack](https://hubot-slackin.herokuapp.com/).
17
-
18
18
  ## License
19
19
 
20
20
  See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
21
+ `
package/bin/hubot CHANGED
@@ -3,7 +3,7 @@
3
3
  # While all other files have been converted to JavaScript via https://github.com/github/hubot/pull/1347,
4
4
  # we left the `bin/hubot` file to remain in CoffeeScript in order prevent
5
5
  # breaking existing 3rd party adapters of which some are still written in
6
- # CoffeeScript themselves. We will depracate and eventually remove this file
6
+ # CoffeeScript themselves. We will deprecate and eventually remove this file
7
7
  # in a future version of hubot
8
8
 
9
9
  require './hubot.js'
package/bin/hubot.js CHANGED
@@ -23,7 +23,7 @@ const options = {
23
23
  adapter: process.env.HUBOT_ADAPTER || 'shell',
24
24
  alias: process.env.HUBOT_ALIAS || false,
25
25
  create: process.env.HUBOT_CREATE || false,
26
- enableHttpd: process.env.HUBOT_HTTPD || true,
26
+ enableHttpd: process.env.HUBOT_HTTPD !== 'false',
27
27
  scripts: process.env.HUBOT_SCRIPTS || [],
28
28
  name: process.env.HUBOT_NAME || 'Hubot',
29
29
  path: process.env.HUBOT_PATH || '.',
@@ -80,10 +80,6 @@ Parser.on((opt, value) => {
80
80
 
81
81
  Parser.parse(process.argv)
82
82
 
83
- if (process.platform !== 'win32') {
84
- process.on('SIGTERM', () => process.exit(0))
85
- }
86
-
87
83
  if (options.create) {
88
84
  console.error("'hubot --create' is deprecated. Use the yeoman generator instead:")
89
85
  console.error(' npm install -g yo generator-hubot')
@@ -6,43 +6,40 @@ permalink: /docs/adapters/development/
6
6
 
7
7
  ## Adapter Basics
8
8
 
9
- All adapters inherit from the Adapter class in the `src/adapter.coffee` file. If you're writing your adapter in CoffeeScript, require the primary version of the adapter:
10
-
11
- ```coffee
12
- Adapter = require('hubot').Adapter
13
- ```
9
+ All adapters inherit from the Adapter class in the `src/adapter.js` file.
14
10
 
15
11
  If you're writing your adapter in ES2015, you must require the ES2015 entrypoint instead:
16
12
 
17
- ```js
13
+ ```javascript
18
14
  const Adapter = require('hubot/es2015').Adapter;
19
15
  ```
20
16
 
21
17
  There are certain methods that you will want to override. Here is a basic stub of what an extended Adapter class would look like:
22
18
 
23
- ```coffee
24
- class Sample extends Adapter
25
-
26
- constructor: ->
27
- super
28
- @robot.logger.info "Constructor"
29
-
30
- send: (envelope, strings...) ->
31
- @robot.logger.info "Send"
32
-
33
- reply: (envelope, strings...) ->
34
- @robot.logger.info "Reply"
35
-
36
- run: ->
37
- @robot.logger.info "Run"
38
- @emit "connected"
39
- user = new User 1001, name: 'Sample User'
40
- message = new TextMessage user, 'Some Sample Message', 'MSG-001'
41
- @robot.receive message
42
-
43
-
44
- exports.use = (robot) ->
45
- new Sample robot
19
+ ```javascript
20
+ const Adapter = require('../adapter')
21
+ const User = require('../user')
22
+ const TextMessage = require('../message').TextMessage
23
+ class Sample extends Adapter {
24
+ constructor(robot) {
25
+ super(robot)
26
+ this.robot.logger.info('Constructor')
27
+ }
28
+ send(envelope, ...strings) {
29
+ this.robot.logger.info('Send')
30
+ }
31
+ reply(envelope, ...strings) {
32
+ this.robot.logger.info('Reply')
33
+ }
34
+ run() {
35
+ this.robot.logger.info('Run')
36
+ this.emit('connected')
37
+ const user = new User(1001, 'Sample User')
38
+ const message = new TextMessage(user, 'Some Sample Message', 'MSG-001')
39
+ this.robot.receive(message)
40
+ }
41
+ }
42
+ exports.use = (robot) => new Sample(robot)
46
43
  ```
47
44
 
48
45
  ## Setting Up Your Development Environment
@@ -76,16 +73,18 @@ exports.use = (robot) ->
76
73
 
77
74
  ## Gotchas
78
75
 
79
- There is a an open issue in the node community around [npm linked peer dependencies not working](https://github.com/npm/npm/issues/5875). To get this working for our project you will need to do some minor changes to your code.
76
+ There is a an open issue in the node community around [npm linked peer dependencies not working](https://github.com/npm/npm/issues/5875). To get this working for our project you will need to do some minor changes to your code.
80
77
 
81
78
  1. For the import in your `hubot-sample` adapter, add the following code
82
79
 
83
- ```coffee
84
- try
85
- {Robot,Adapter,TextMessage,User} = require 'hubot'
86
- catch
87
- prequire = require('parent-require')
88
- {Robot,Adapter,TextMessage,User} = prequire 'hubot'
80
+ ```javascript
81
+ let {Robot,Adapter,TextMessage,User} = {}
82
+ try {
83
+ {Robot,Adapter,TextMessage,User} = require('hubot')
84
+ } catch {
85
+ const prequire = require('parent-require')
86
+ {Robot,Adapter,TextMessage,User} = prequire('hubot')
87
+ }
89
88
  ```
90
89
  2. In your `hubot-sample` folder, modify the `package.json` to include the following dependency so this custom import mechanism will work
91
90
 
@@ -8,16 +8,16 @@ Hasn't been fully tested - YMMV
8
8
 
9
9
  There are 4 primary steps to deploying and running hubot on a Windows machine:
10
10
 
11
- * node and npm
12
- * a way to get source code updated on the server
13
- * setting up environment variables for hubot
14
- * a way to start hubot, start it up if it crashes, and restart it when code updates
11
+ * node and npm
12
+ * a way to get source code updated on the server
13
+ * setting up environment variables for hubot
14
+ * a way to start hubot, start it up if it crashes, and restart it when code updates
15
15
 
16
16
  ## node and npm
17
17
 
18
18
  To start, your windows server will need node and npm.
19
19
  The best way to do this is with [chocolatey](http://chocolatey.org) using the [nodejs.install](http://chocolatey.org/packages/nodejs.install) package.
20
- I've found that sometimes the system path variable is not correctly set; ensure you can run node/npm from the command line. If needed set the PATH variable with "setx PATH \"%PATH%;C:\Program Files\nodejs\" "
20
+ I've found that sometimes the system path variable is not correctly set; ensure you can run node/npm from the command line. If needed set the PATH variable with `set PATH=%PATH%;\"C:\Program Files\nodejs\"`
21
21
 
22
22
  Your other option is to install directly from [NodeJS](https://nodejs.org/) and run the current download (v0.12.4 as of this documentation). This should set your PATH variables for you.
23
23
 
@@ -43,9 +43,7 @@ Furthermore, Hubot scripts exist to enable persistence across Hubot restarts.
43
43
  `hubot-redis-brain` is such a script and uses a backend Redis server.
44
44
 
45
45
  By default, the brain contains a list of all users seen by Hubot.
46
- Therefore, without persistence across restarts, the brain will contain the list of users encountered so far, during the current run of Hubot.
47
- On the other hand, with persistence across restarts, the brain will contain all users encountered by Hubot during all of its runs.
48
- This list of users can be accessed through `hubot.brain.users()` and other utility methods.
46
+ Therefore, without persistence across restarts, the brain will contain the list of users encountered so far, during the current run of Hubot. On the other hand, with persistence across restarts, the brain will contain all users encountered by Hubot during all of its runs. This list of users can be accessed through `hubot.brain.users()` and other utility methods.
49
47
 
50
48
  ### Datastore
51
49
 
package/docs/index.md CHANGED
@@ -44,15 +44,12 @@ You now have your own functional hubot! There's a `bin/hubot`
44
44
  command for convenience, to handle installing npm dependencies, loading scripts,
45
45
  and then launching your hubot.
46
46
 
47
- Hubot needs Redis to persist data, so before you can start hubot on your own computer, you should have Redis installed on your localhost. If just want to test Hubot without Redis, then you can remove `hubot-redis-brain` from `external-scripts.json`.
47
+ Note: Hubot can use Redis to persist data, so before you can start hubot on your own computer, if you want to persist data, then you should have Redis running on your machine accessible via `localhost`. Then, ensure that `hubot-redis-brain` is listed in `external-scripts.json` as an `Array` of module names (e.g. `['hubot-redis-brain']`) or an `object` where the key is the name of the module (e.g. `{'hubot-redis-brain': 'some arbitrary value'}`) where the value of the property in the object is passed to the module function as the second argument. The first argument being the hubot Robot instance.
48
48
 
49
49
  % bin/hubot
50
50
  Hubot>
51
51
 
52
- This starts hubot using the [shell adapter](./adapters/shell.md), which
53
- is mostly useful for development. Make note of the name in the `hubot>` prompt;
54
- this is the name your hubot will respond to with commands. If the prompt
55
- reads `myhubot>` then your commands must start with `myhubot <command>`
52
+ This starts hubot using the [shell adapter](./adapters/shell.md), which is mostly useful for development. Make note of the name in the `hubot>` prompt; this is the name your hubot will respond to with commands. If the prompt reads `myhubot>` then your commands must start with `myhubot <command>`.
56
53
 
57
54
  For example, to list available commands:
58
55
 
@@ -107,7 +104,7 @@ To use a script from an NPM package:
107
104
  2. Add the package to `external-scripts.json`.
108
105
  3. Run `npm home <package-name>` to open a browser window for the homepage of the script, where you can find more information about configuring and installing the script.
109
106
 
110
- You can also put your own scripts under the `scripts/` directory. All scripts placed there are automatically loaded and ready to use with your hubot. Read more about customizing hubot by [writing your own scripts](scripting.md).
107
+ You can also put your own scripts under the `scripts/` directory. All scripts (files ending with either `.js` or `.mjs`) placed there are automatically loaded and ready to use with your hubot. Read more about customizing hubot by [writing your own scripts](scripting.md).
111
108
 
112
109
  ## Adapters
113
110
 
@@ -115,9 +112,7 @@ Hubot uses the adapter pattern to support multiple chat-backends. Here is a [lis
115
112
 
116
113
  ## Deploying
117
114
 
118
- You can deploy hubot to Heroku, which is the officially supported method.
119
- Additionally you are able to deploy hubot to a UNIX-like system or Windows.
120
- Please note the support for deploying to Windows isn't officially supported.
115
+ You can deploy hubot to Heroku, which is the officially supported method. Additionally you are able to deploy hubot to a UNIX-like system or Windows. Please note the support for deploying to Windows isn't officially supported.
121
116
 
122
117
  * [Deploying Hubot onto Azure](./deploying/azure.md)
123
118
  * [Deploying Hubot onto Bluemix](./deploying/bluemix.md)
@@ -127,4 +122,4 @@ Please note the support for deploying to Windows isn't officially supported.
127
122
 
128
123
  ## Patterns
129
124
 
130
- Using custom scripts, you can quickly customize Hubot to be the most life embettering robot he or she can be. Read [docs/patterns.md](patterns.md) for some nifty tricks that may come in handy as you teach your hubot new skills.
125
+ Using custom scripts, you can quickly customize Hubot to be the most life embettering robot he or she can be. Read [docs/patterns.md](patterns.md) for some nifty tricks that may come in handy as you teach your hubot new skills.