#1 上传文件至 ''

Merged
AIisAllweNeed merged 1 commits from 1.0 into master 11 months ago
  1. +46
    -0
      CODE_OF_CONDUCT.md
  2. +62
    -0
      CONTRIBUTING.md
  3. +20
    -0
      LICENSE.md
  4. +20
    -1
      README.md
  5. +47
    -0
      e2e-test.sh
  6. +32
    -0
      es2015.js
  7. +9
    -0
      hubot
  8. +39
    -0
      index.js
  9. +8233
    -0
      package-lock.json
  10. +58
    -0
      package.json

+ 46
- 0
CODE_OF_CONDUCT.md View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@github.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

+ 62
- 0
CONTRIBUTING.md View File

@@ -0,0 +1,62 @@
# Contributing

Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md).

Everyone is welcome to contribute to Hubot. Contributing doesn’t just mean submitting pull requests—there are many different ways for you to get involved, including answering questions in [chat](https://hubot-slackin.herokuapp.com/), reporting or triaging [issues](https://github.com/github/hubot/issues), and participating in the [Hubot Evolution](https://github.com/hubotio/evolution) process.

No matter how you want to get involved, we ask that you first learn what’s expected of anyone who participates in the project by reading the [Contributor Covenant Code of Conduct](http://contributor-covenant.org). By participating, you are expected to uphold this code.

We love pull requests. Here's a quick guide:

1. If you're adding a new feature or changing user-facing APIs, check out the [Hubot Evolution](https://github.com/hubotio/evolution) process.
1. Check for [existing issues](https://github.com/github/hubot/issues) for duplicates and confirm that it hasn't been fixed already in the [master branch](https://github.com/github/hubot/commits/master)
1. Fork the repo, and clone it locally
1. `npm link` to make your cloned repo available to npm
1. Follow [Getting Started](docs/index.md) to generate a testbot
1. `npm link hubot` in your newly created bot to use your hubot fork
1. Create a new branch for your contribution
1. Add [tests](test/) (run with `npm test`)
1. Push to your fork and submit a pull request

At this point you're waiting on us. We like to at least comment on, if not
accept, pull requests within a few days. We may suggest some changes or improvements or alternatives.

Some things that will increase the chance that your pull request is accepted:

* Make sure the tests pass
* Update the documentation: code comments, example code, guides. Basically,
update everything affected by your contribution.
* Include any information that would be relevant to reproducing bugs, use cases for new features, etc.

* Discuss the impact on existing [hubot installs](docs/index.md), [hubot adapters](docs/adapters.md), and [hubot scripts](docs/scripting.md) (e.g. backwards compatibility)
* If the change does break compatibility, how can it be updated to become backwards compatible, while directing users to the new way of doing things?
* Your commits are associated with your GitHub user: https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/
* Make pull requests against a feature branch,
* Follow our commit message conventions:
* use imperative, present tense: “change” not “changed” nor “changes”
* Commit test files with `test: …` or `test(scope): …` prefix.
* Commit bug fixes with `fix: …` or `fix(scope): …` prefix
* Commit features with `feat: …` or `feat(scope): …` prefix
* Commit breaking changes by adding `BREAKING CHANGE:` in the commit body.
The commit subject does not matter. A commit can have multiple `BREAKING CHANGE:`
sections
* Commit changes to `package.json`, `.gitignore` and other meta files with
`chore(filenamewithout.ext): …`
* Commit changes to README files or comments with `docs(README): …`
* Cody style changes with `style: standard`
* see [Angular’s Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153)
for a full list of recommendations.

# Stale issue and pull request policy

Issues and pull requests have a shelf life and sometimes they are no longer relevant. All issues and pull requests that have not had any activity for 90 days will be marked as `stale`. Simply leave a comment with information about why it may still be relevant to keep it open. If no activity occurs in the next 7 days, it will be automatically closed.

The goal of this process is to keep the list of open issues and pull requests focused on work that is actionable and important for the maintainers and the community.

# Pull Request Reviews & releasing

Releasing `hubot` is fully automated using [semantic-release](https://github.com/semantic-release/semantic-release). Once merged into the `master` branch, `semantic-release` will automatically release a new version based on the commit messages of the pull request. For it to work correctly, make sure that the correct commit message conventions have been used. The ones relevant are

* `fix: …` will bump the fix version, e.g. 1.2.3 → 1.2.4
* `feat: …` will bump the feature version, e.g. 1.2.3 → 1.3.0
* `BREAKING CHANGE: …` in the commit body will bump the breaking change version, e.g. 1.2.3 → 2.0.0

+ 20
- 0
LICENSE.md View File

@@ -0,0 +1,20 @@
Copyright (c) 2011-2017 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 20
- 1
README.md View File

@@ -1,2 +1,21 @@
# hubot
![Build Status: MacOS](https://github.com/hubotio/hubot/actions/workflows/nodejs-macos.yml/badge.svg)
![Build Status: Ubuntu](https://github.com/hubotio/hubot/actions/workflows/nodejs-ubuntu.yml/badge.svg)
![Build Status: Window](https://github.com/hubotio/hubot/actions/workflows/nodejs-windows.yml/badge.svg)

# Hubot

Hubot is a framework to build chat bots, modeled after GitHub's Campfire bot of the same name, hubot.
He's pretty cool. He's [extendable with scripts](http://hubot.github.com/docs/#scripts) and can work
on [many different chat services](https://hubot.github.com/docs/adapters/).

This repository provides a library that's distributed by `npm` that you
use for building your own bots. See the [documentation](http://hubot.github.com/docs)
for details on getting up and running with your very own robot friend.

In most cases, you'll probably never have to hack on this repo directly if you
are building your own bot. But if you do, check out [CONTRIBUTING.md](CONTRIBUTING.md)

## License

See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
`

+ 47
- 0
e2e-test.sh View File

@@ -0,0 +1,47 @@
#!/bin/bash
HUBOT_FOLDER=$(pwd)
TEMP_ROOT=$(mktemp -d)

echo "$ pushd $TEMP_ROOT"
pushd $TEMP_ROOT
trap "{ CODE=$?; popd; rm -rf $TEMP_ROOT; exit $CODE; }" EXIT

## https://hubot.github.com/docs/

echo "$ npm install -g yo generator-hubot"
npm install -g yo generator-hubot

## simulate pressing enter for each generator question to accept defaults
## https://stackoverflow.com/a/6264618/206879
echo "$ yo hubot --defaults"
yo hubot --defaults

## use hubot from last commit
echo "$ npm install $HUBOT_FOLDER"
npm install $HUBOT_FOLDER

# npm install /path/to/hubot will create a symlink in npm 5+ (http://blog.npmjs.org/post/161081169345/v500).
# As the require calls for app-specific scripts happen inside hubot, we have to
# set NODE_PATH to the app’s node_modules path so they can be found
echo "$ NODE_PATH=$HUBOT_FOLDER/node_modules:$TEMP_ROOT/node_modules"
export NODE_PATH=$NODE_PATH/$HUBOT_FOLDER/node_modules:$TEMP_ROOT/node_modules

## start
expect <<EOL
set timeout 30

spawn bin/hubot --name e2etest

# workaround for current hubot which does not show prompt until pressed enter
# so we simulate it once 'INFO hubot-redis-brain: Using default redis on localhost:6379' appears
expect "localhost:6379"
send "\r"

expect "e2etest> "

send "e2etest ping\r"
expect {
"PONG" {}
timeout {exit 1}
}
EOL

+ 32
- 0
es2015.js View File

@@ -0,0 +1,32 @@
'use strict'

const User = require('./src/user')
const Brain = require('./src/brain')
const Robot = require('./src/robot')
const Adapter = require('./src/adapter')
const Response = require('./src/response')
const Listener = require('./src/listener')
const Message = require('./src/message')
const DataStore = require('./src/datastore')

module.exports = {
User,
Brain,
Robot,
Adapter,
Response,
Listener: Listener.Listener,
TextListener: Listener.TextListener,
Message: Message.Message,
TextMessage: Message.TextMessage,
EnterMessage: Message.EnterMessage,
LeaveMessage: Message.LeaveMessage,
TopicMessage: Message.TopicMessage,
CatchAllMessage: Message.CatchAllMessage,
DataStore: DataStore.DataStore,
DataStoreUnavailable: DataStore.DataStoreUnavailable,

loadBot (adapterPath, adapterName, enableHttpd, botName, botAlias) {
return new module.exports.Robot(adapterPath, adapterName, enableHttpd, botName, botAlias)
}
}

+ 9
- 0
hubot View File

@@ -0,0 +1,9 @@
#!/usr/bin/env coffee

# While all other files have been converted to JavaScript via https://github.com/github/hubot/pull/1347,
# we left the `bin/hubot` file to remain in CoffeeScript in order prevent
# breaking existing 3rd party adapters of which some are still written in
# CoffeeScript themselves. We will deprecate and eventually remove this file
# in a future version of hubot

require './hubot.js'

+ 39
- 0
index.js View File

@@ -0,0 +1,39 @@
'use strict'

const inherits = require('util').inherits

const hubotExport = require('./es2015')

// make all es2015 class declarations compatible with CoffeeScript’s extend
// see https://github.com/hubotio/evolution/pull/4#issuecomment-306437501
module.exports = Object.keys(hubotExport).reduce((map, current) => {
if (current !== 'loadBot') {
map[current] = makeClassCoffeeScriptCompatible(hubotExport[current])
} else {
map[current] = hubotExport[current]
}
return map
}, {})

function makeClassCoffeeScriptCompatible (klass) {
function CoffeeScriptCompatibleClass () {
const Hack = Function.prototype.bind.apply(klass, [null].concat([].slice.call(arguments)))
const instance = new Hack()

// pass methods from child to returned instance
for (const key in this) {
instance[key] = this[key]
}

// support for constructor methods which call super()
// in which this.* properties are set
for (const key in instance) {
this[key] = instance[key]
}

return instance
}
inherits(CoffeeScriptCompatibleClass, klass)

return CoffeeScriptCompatibleClass
}

+ 8233
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 58
- 0
package.json View File

@@ -0,0 +1,58 @@
{
"name": "hubot",
"version": "0.0.0-development",
"author": "hubot",
"keywords": [
"github",
"hubot",
"campfire",
"bot"
],
"description": "A simple helpful robot for your Company",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/hubotio/hubot.git"
},
"dependencies": {
"async": "^3.2.4",
"cline": "^0.8.2",
"coffeescript": "^2.7.0",
"connect-multiparty": "^2.2.0",
"express": "^4.18.2",
"express-basic-auth": "^1.2.1",
"log": "^6.3.1",
"log-node": "^8.0.3",
"optparse": "^1.0.5"
},
"devDependencies": {
"chai": "^4.3.7",
"is-circular": "^1.0.2",
"mocha": "^10.2.0",
"mockery": "^2.1.0",
"semantic-release": "^21.0.1",
"sinon": "^15.0.4",
"sinon-chai": "^3.7.0",
"standard": "^17.0.0"
},
"engines": {
"node": "> 4.0.0",
"npm": "> 2.0.0"
},
"main": "./index",
"bin": {
"hubot": "./bin/hubot"
},
"scripts": {
"start": "bin/hubot",
"pretest": "standard",
"test": "mocha --exit",
"test:smoke": "node src/**/*.js"
},
"release": {
"branches": [
"master"
],
"dryRun": false
}
}

Loading…
Cancel
Save