<commit_before># Action Jackson
* Starring carl weathers as apollolo creed

![Alt text](https://raw.githubusercontent.com/clarkda/repo-images/master/action-jackson.js/actionjackson.png "I aint got time to bleed")

# What?

Action Jackson executes `action` plugins on a specified interval

# API

http://localhost:port/actions/ - lists all registered actions
http://localhost:port/actions/add - registers a new action

```
curl -i -X POST http://localhost:3000/actions/add --data '{"actionPlugin":"PingGithub", "name":"ping-github"}' -H "Content-Type: application/json"
```

# How?

* Action plugins must inherit from Action and
* Action plugins must override ::execute and ::actionName
* Put plugin def into actions/<ActionName>/index.js
* At interval specified in config::pollIntervalDelay, action jackson will fetch registered actions, and ::execute each one

# Example

```
var Action = require('../../lib/action.js')
  , log = require('logule').init(module, 'ping_github')
  , ping = require("ping")
  , util = require('util');

/**
 *
 * @constructor
 */

var PingGithub = function() {
  this.actionName = 'PingGithub';
  // ..
}
util.inherits(PingGithub, Action);

/**
 * is github.com up?
 */

PingGithub.prototype.execute = function() {
  var hosts = ['github.com'];
  hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
      var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';
      log.info(msg);
    });
  });
}

// ..

module.exports = PingGithub
```

```
chunk:uptime dusty$ node index.js
17:38:19 - INFO  - action-jackson - action_manager - initializing
17:38:19 - INFO  - action-jackson - action_manager - loading actions
17:38:19 - INFO  - action-jackson - action_manager - .. DeployInfo
17:38:19 - INFO  - action-jackson - action_manager - .. MogFlicks
17:38:19 - INFO  - action-jackson - action_manager - .. PingGithub
17:38:19 - INFO  - action-jackson - listening on port 3000
17:38:19 - INFO  - action-jackson - mongoose connected to mongodb://localhost:27017/actionjackson
17:38:49 - INFO  - action-jackson - action_manager - deploy_info - 3.2.0.64
17:38:50 - INFO  - action-jackson - action_manager - mog_flicks - mog flicks is alive
17:38:51 - INFO  - action-jackson - action_manager - ping_github - host github.com is alive
```

# Todo
* Each action should have its own interval
* Maybe should include parameters per action. ex. so a single ping action could be used for X hosts<commit_msg>typos<commit_after># Action Jackson
* Starring CARL WEATHERS as Apollolo Creed

![Alt text](https://raw.githubusercontent.com/clarkda/repo-images/master/action-jackson.js/actionjackson.png "I aint got time to bleed")

# What?

Action Jackson executes `action` plugins on a specified interval

# API

http://localhost:port/actions/ - lists all registered actions
http://localhost:port/actions/add - registers a new action

```
curl -i -X POST http://localhost:3000/actions/add --data '{"actionPlugin":"PingGithub", "name":"ping-github"}' -H "Content-Type: application/json"
```

# How?

* Action plugins must inherit from Action and
* Action plugins must override ::execute and ::actionName
* Place plugin definition into actions/ActionName/index.js
* At interval specified in config::pollIntervalDelay, action jackson will fetch registered actions, and ::execute each one

# Example

```
var Action = require('../../lib/action.js')
  , log = require('logule').init(module, 'ping_github')
  , ping = require("ping")
  , util = require('util');

/**
 *
 * @constructor
 */

var PingGithub = function() {
  this.actionName = 'PingGithub';
  // ..
}
util.inherits(PingGithub, Action);

/**
 * is github.com up?
 */

PingGithub.prototype.execute = function() {
  var hosts = ['github.com'];
  hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
      var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';
      log.info(msg);
    });
  });
}

// ..

module.exports = PingGithub
```

```
chunk:uptime dusty$ node index.js
17:38:19 - INFO  - action-jackson - action_manager - initializing
17:38:19 - INFO  - action-jackson - action_manager - loading actions
17:38:19 - INFO  - action-jackson - action_manager - .. DeployInfo
17:38:19 - INFO  - action-jackson - action_manager - .. MogFlicks
17:38:19 - INFO  - action-jackson - action_manager - .. PingGithub
17:38:19 - INFO  - action-jackson - listening on port 3000
17:38:19 - INFO  - action-jackson - mongoose connected to mongodb://localhost:27017/actionjackson
17:38:49 - INFO  - action-jackson - action_manager - deploy_info - 3.2.0.64
17:38:50 - INFO  - action-jackson - action_manager - mog_flicks - mog flicks is alive
17:38:51 - INFO  - action-jackson - action_manager - ping_github - host github.com is alive
```

# Todo
* Each action should have its own interval
* Maybe should include parameters per action. ex. so a single ping action could be used for X hosts
{'fraction_non_alphanumeric': 0.13836477987421383, 'fraction_numerical': 0.03164942178940962, 'mean_word_length': 3.6378174976481654, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '997151', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1543, 'n_words': 443}