Giter Site home page Giter Site logo

vinta / hubot-reload-scripts Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 14.0 10 KB

Reloads scripts without restart, loads new scripts too. (a fork version that works perfectly)

Home Page: https://www.npmjs.com/package/hubot-reload-scripts

License: MIT License

CoffeeScript 100.00%

hubot-reload-scripts's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hubot-reload-scripts's Issues

npm package out of date

The current package version on npm is 0.1.2, whereas the most recent version in your recent commit (5 days ago, at the time of this writing) is 0.1.4.

I was trying to debug why my external script wasn't reloading properly, and I was looking at your code wondering why the code I was seeing wasn't working, until I noticed the version discrepancy.

Doesn't seem to remove/reset the EventEmitter

If you have a script that subscribes to an event, eg.

module.exports = (robot) ->
  robot.on 'some-event', ->
    robot.logger.info 'saw the event'

  robot.hear 'test', ->
    robot.emit 'some-event'

After you reload then you get this log message twice.

Seems the events needs to be handled as well - https://github.com/hubotio/hubot/blob/main/src/robot.js#L37

Here's a session illustrating the issue (docker run --rm -it --entrypoint bash 3ch01c/hubot)

Hubot> test
Hubot> [Thu Aug 17 2023 05:41:13 GMT+0000 (Coordinated Universal Time)] INFO saw the event

Hubot> test
Hubot> [Thu Aug 17 2023 05:41:15 GMT+0000 (Coordinated Universal Time)] INFO saw the event

Hubot> reload
Hubot> hubot reload
Hubot> Invalidate require cache for /hubot/scripts/example.coffee
Invalidate require cache for /hubot/scripts/proxy.coffee
Invalidate require cache for /hubot/scripts/test.coffee
[Thu Aug 17 2023 05:41:22 GMT+0000 (Coordinated Universal Time)] INFO /hubot/scripts/proxy.coffee is using deprecated documentation syntax
[Thu Aug 17 2023 05:41:22 GMT+0000 (Coordinated Universal Time)] INFO /hubot/scripts/test.coffee is using deprecated documentation syntax
Reloaded all scripts
Invalidate require cache for /hubot/node_modules/hubot-auth/src/auth.coffee
Invalidate require cache for /hubot/node_modules/hubot-diagnostics/src/diagnostics.js
Invalidate require cache for /hubot/node_modules/hubot-dice/src/dice.coffee
Invalidate require cache for /hubot/node_modules/hubot-help/src/help.js
Invalidate require cache for /hubot/node_modules/hubot-redis-brain/src/redis-brain.js
Invalidate require cache for /hubot/node_modules/hubot-voting/src/index.coffee
Invalidate require cache for /hubot/node_modules/hubot-voting/src/scripts/voting.coffee
Invalidate require cache for /hubot/node_modules/hubot-reload-scripts/src/reload-scripts.coffee
[Thu Aug 17 2023 05:41:22 GMT+0000 (Coordinated Universal Time)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Thu Aug 17 2023 05:41:22 GMT+0000 (Coordinated Universal Time)] WARNING The HUBOT_AUTH_ADMIN environment variable not set

Hubot> test
Hubot> [Thu Aug 17 2023 05:41:25 GMT+0000 (Coordinated Universal Time)] INFO saw the event
[Thu Aug 17 2023 05:41:25 GMT+0000 (Coordinated Universal Time)] INFO saw the event

Hubot> test
Hubot> [Thu Aug 17 2023 05:41:28 GMT+0000 (Coordinated Universal Time)] INFO saw the event
[Thu Aug 17 2023 05:41:28 GMT+0000 (Coordinated Universal Time)] INFO saw the event

Hubot>

fails if scripts dir is a git repo

My scripts dir is a git repo for other employees to be able to submit scripts to. Reload fails on the .git folder within the scripts folder.

Hubot reloader: { [Error: Cannot find module 'C:\myhubot\scripts\.git'] code: 'MODULE_NOT_FOUND' }

coffeelint check

Could you add an coffeelint check before reloading and abort if it fails?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.