Skip to content

Commit 0d7d065

Browse files
authored
Merge pull request #44 from msgflo/coffeescript_2
CoffeeScript 2
2 parents 2494e04 + a6e51fb commit 0d7d065

10 files changed

Lines changed: 31 additions & 10 deletions

File tree

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
node_modules/
33
.DS_Store
44
mosquitto*
5+
fbp-config.json
6+
.travis.yml

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: node_js
22
services:
33
- rabbitmq
44
node_js:
5-
- '4.2'
5+
- '6'
66
before_install:
77
- sudo apt-get update -qq
88
- sudo apt-get install pkg-config cmake openssl libc-ares-dev

Gruntfile.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module.exports = ->
66
# CoffeeScript compilation
77
coffee:
88
library:
9+
options:
10+
bare: true
911
expand: true
1012
cwd: 'src'
1113
src: ['**.coffee']
@@ -18,6 +20,9 @@ module.exports = ->
1820
src: ['spec/*.coffee']
1921
options:
2022
reporter: 'spec'
23+
require: [
24+
'coffeescript/register'
25+
]
2126
grep: process.env.TESTS
2227

2328
# Protocol tests

bin/msgflo-nodejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
22

3-
require('coffee-script/register')
3+
require('coffeescript/register')
44
require('../src/main').main()

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ try {
22
// Compiled JavaScript first
33
module.exports = require('./lib/');
44
} catch (e) {
5-
require('coffee-script/register');
5+
require('coffeescript/register');
66
module.exports = require('./src/');
77
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"dependencies": {
1515
"async": "^2.1.4",
1616
"chance": "^1.0.4",
17+
"coffeescript": "^2.0.2",
1718
"commander": "^2.6.0",
1819
"debug": "^3.0.0",
1920
"fbp": "^1.1.2",
@@ -24,8 +25,7 @@
2425
"amqplib": "^0.5.1",
2526
"chai": "^4.1.0",
2627
"grunt": "^1.0.1",
27-
"coffee-script": "^1.8.0",
28-
"grunt-contrib-coffee": "^1.0.0",
28+
"grunt-contrib-coffee": "^2.0.0",
2929
"grunt-mocha-test": "^0.13.2",
3030
"grunt-shell-spawn": "^0.3.1",
3131
"mocha": "^4.0.0",

src/amqp.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ catch e
1111
amqp = e
1212

1313
class Client extends interfaces.MessagingClient
14-
constructor: (@address, @options={}) ->
14+
constructor: (address, options={}) ->
15+
super address, options
16+
@address = address
17+
@options = options
1518
@connection = null
1619
@channel = null
1720
@options.prefetch = 2 if not @options.prefetch?

src/direct.coffee

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ brokers = {}
99

1010

1111
class Client extends interfaces.MessagingClient
12-
constructor: (@address, @options) ->
12+
constructor: (address, options) ->
13+
super address, options
14+
@address = address
15+
@options = options
1316
# console.log 'client', @address
1417
@broker = null
1518

@@ -68,6 +71,7 @@ class Client extends interfaces.MessagingClient
6871

6972
class Queue extends EventEmitter
7073
constructor: () ->
74+
super()
7175

7276
send: (msg) ->
7377
@_emitSend msg
@@ -76,7 +80,9 @@ class Queue extends EventEmitter
7680
@emit 'message', msg
7781

7882
class MessageBroker extends interfaces.MessageBroker
79-
constructor: (@address) ->
83+
constructor: (address) ->
84+
super address
85+
@address = address
8086
routing.binderMixin this
8187
@queues = {}
8288
# console.log 'broker', @address

src/mqtt.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ catch e
99
mqtt = e
1010

1111
class Client extends interfaces.MessagingClient
12-
constructor: (@address, @options) ->
12+
constructor: (address, options) ->
13+
super address, options
14+
@address = address
15+
@options = options
1316
@client = null
1417
@subscribers = {} # queueName -> [handler1, ...]
1518

src/participant.coffee

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ defaultDiscoveryPeriod = parseInt process.env.MSGFLO_DISCOVERY_PERIOD if process
4949

5050
class Participant extends EventEmitter
5151
# @func gets called with inport, , and should return outport, outdata
52-
constructor: (client, def, @func, role, options={}) ->
52+
constructor: (client, def, func, role, options={}) ->
53+
super()
54+
@func = func
5355
client = transport.getClient(client) if typeof client == 'string'
5456
@messaging = client
5557
role = 'unknown' if not role

0 commit comments

Comments
 (0)