Permalink
Browse files

Close #1

  • Loading branch information...
1 parent c8284ea commit 8e89ac662c67ab9bd40bf68bf1e3575ab31ef76f @kenhkan kenhkan committed Jul 30, 2013
Showing with 201 additions and 69 deletions.
  1. +5 −1 .gitignore
  2. 0 CHANGELOG.md
  3. +109 −0 Gruntfile.coffee
  4. +22 −0 LICENSE-MIT
  5. +0 −20 LICENSE.md
  6. +1 −25 README.md
  7. +35 −0 component.json
  8. +29 −23 package.json
View
@@ -1,2 +1,6 @@
-node_modules
+.DS_Store
+*.swp
+*.js
+node_modules/
npm-debug.log
+components/*/
View
No changes.
View
@@ -0,0 +1,109 @@
+module.exports = ->
+ # Project configuration
+ @initConfig
+ pkg: @file.readJSON 'package.json'
+
+ # CoffeeScript compilation
+ coffee:
+ spec:
+ options:
+ bare: true
+ expand: true
+ cwd: 'spec'
+ src: ['**.coffee']
+ dest: 'spec'
+ ext: '.js'
+
+ # Browser version building
+ component:
+ install:
+ options:
+ action: 'install'
+ component_build:
+ 'noflo-adapters':
+ output: './browser/'
+ config: './component.json'
+ scripts: true
+ styles: false
+ plugins: ['coffee']
+ configure: (builder) ->
+ # Enable Component plugins
+ json = require 'component-json'
+ builder.use json()
+
+ # Fix broken Component aliases, as mentioned in
+ # https://github.com/anthonyshort/component-coffee/issues/3
+ combine:
+ browser:
+ input: 'browser/noflo-adapters.js'
+ output: 'browser/noflo-adapters.js'
+ tokens: [
+ token: '.coffee'
+ string: '.js'
+ ]
+
+ # JavaScript minification for the browser
+ uglify:
+ options:
+ report: 'min'
+ noflo:
+ files:
+ './browser/noflo-adapters.min.js': ['./browser/noflo-adapters.js']
+
+ # Automated recompilation and testing when developing
+ watch:
+ files: ['spec/*.coffee', 'components/*.coffee']
+ tasks: ['test']
+
+ # BDD tests on Node.js
+ cafemocha:
+ nodejs:
+ src: ['spec/*.coffee']
+ options:
+ reporter: 'dot'
+
+ # BDD tests on browser
+ mocha_phantomjs:
+ options:
+ output: 'spec/result.xml'
+ reporter: 'dot'
+ all: ['spec/runner.html']
+
+ # Coding standards
+ coffeelint:
+ components: ['components/*.coffee']
+
+ # Grunt plugins used for building
+ @loadNpmTasks 'grunt-contrib-coffee'
+ @loadNpmTasks 'grunt-component'
+ @loadNpmTasks 'grunt-component-build'
+ @loadNpmTasks 'grunt-combine'
+ @loadNpmTasks 'grunt-contrib-uglify'
+
+ # Grunt plugins used for testing
+ @loadNpmTasks 'grunt-contrib-watch'
+ @loadNpmTasks 'grunt-cafe-mocha'
+ @loadNpmTasks 'grunt-mocha-phantomjs'
+ @loadNpmTasks 'grunt-coffeelint'
+
+ # Our local tasks
+ @registerTask 'build', 'Build NoFlo for the chosen target platform', (target = 'all') =>
+ @task.run 'coffee'
+ if target is 'all' or target is 'browser'
+ @task.run 'component'
+ @task.run 'component_build'
+ @task.run 'combine'
+ @task.run 'uglify'
+
+ @registerTask 'test', 'Build NoFlo and run automated tests', (target = 'all') =>
+ @task.run 'coffeelint'
+ @task.run 'coffee'
+ if target is 'all' or target is 'nodejs'
+ @task.run 'cafemocha'
+ if target is 'all' or target is 'browser'
+ @task.run 'component'
+ @task.run 'component_build'
+ @task.run 'combine'
+ @task.run 'mocha_phantomjs'
+
+ @registerTask 'default', ['test']
View
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Kenneth Kan
+
+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.
View
@@ -1,20 +0,0 @@
-The MIT License (MIT) Copyright (c) 2013 Kenneth Kan
-
-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.
View
@@ -1,31 +1,7 @@
-Packet Format Conversion for NoFlo [![Build Status](https://secure.travis-ci.org/kenhkan/noflo-adapters.png?branch=master)](https://travis-ci.org/kenhkan/noflo-adapters)
-===============================
+# noflo-adapters [![Build Status](https://secure.travis-ci.org/noflo/adapters.png?branch=master)](http://travis-ci.org/kenhkan/adapters)
This package provides various components to convert packets from one
format to another in [NoFlo](http://noflojs.org/).
Feel free to contribute new components and graphs! I'll try to
incorporate as soon as time allows.
-
-
-Usage
--------------------------------
-
-### ObjectToPackets ###
-
-Convert a packet that is an object into grouped packets.
-
-#### In-ports
-
- * IN: a packet that is an object
- * DEPTH: how many levels to parse in the provided object
-
-#### Out-ports
-
- * OUT: grouped packets
-
-#### Examples
-
-Convert objects to packets.
-
- 'whatever' -> IN Quit(handyman/Quit) OUT -> IN NotReceivingIt(core/Output)
View
@@ -0,0 +1,35 @@
+{
+ "name": "noflo-adapters",
+ "description": "The best project ever.",
+ "author": "Kenneth Kan <kenhkan@gmail.com>",
+ "repo": "kenhkan/adapters",
+ "version": "0.1.0",
+ "keywords": [
+ ],
+ "dependencies": {
+ "noflo/noflo": "*"
+ },
+ "scripts": [
+ "index.js"
+ ],
+ "json": [
+ "component.json"
+ ],
+ "noflo": {
+ "components": {
+ "PacketsToObject": "./components/PacketsToObject.coffee",
+ "ObjectToPackets": "./components/ObjectToPackets.coffee",
+ "PacketsToArray": "./components/PacketsToArray.coffee",
+ "PairsToObject": "./components/PairsToObject.coffee",
+ "ObjectToString": "./components/ObjectToString.coffee",
+ "PropertiesToObjects": "./components/PropertiesToObjects.coffee"
+ },
+ "graphs": {
+ "PropStringToObject": "./graphs/PropStringToObject.fbp",
+ "PacketsToString": "./graphs/PacketsToString.fbp",
+ "StringToArray": "./graphs/StringToArray.fbp",
+ "TupleToArray": "./graphs/TupleToArray.fbp",
+ "TupleToPackets": "./graphs/TupleToPackets.fbp"
+ }
+ }
+}
View
@@ -8,36 +8,46 @@
"packets",
"format"
],
- "author": "Kenneth Kan <kenhkan@gmail.com>",
- "contributors": [
- {
- "name": "Henri Bergius",
- "email": "henri.bergius@iki.fi"
- }
- ],
- "version": "0.1.0",
+ "version": "0.1.1",
+ "author": {
+ "name": "Kenneth Kan",
+ "email": "kenhkan@gmail.com"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/noflo/noflo-adapters.git"
+ },
"licenses": [
{
"type": "MIT",
"url": "https://github.com/noflo/noflo-adapters/blob/master/LICENSE.md"
}
],
- "engines": {
- "node": ">=0.6.0"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/noflo/noflo-adapters"
- },
"dependencies": {
- "noflo": "https://github.com/kenhkan/noflo/tarball/release",
+ "noflo": "~0.3.3",
"underscore": "1.4.x",
- "underscore.string": "2.3.x"
+ "underscore.string": "2.3.x",
+ "owl-deepcopy": "0.0.2"
},
"devDependencies": {
"coffeelint": "*",
- "coffee-script": "1.6.x",
- "noflo-test": "https://github.com/kenhkan/noflo-test/tarball/release"
+ "grunt": "~0.4.1",
+ "grunt-contrib-coffee": "~0.6.6",
+ "grunt-coffeelint": "~0.0.6",
+ "grunt-cafe-mocha": "~0.1.2",
+ "chai": "~1.5.0",
+ "mocha": "~1.9.0",
+ "grunt-mocha-phantomjs": "~0.2.2",
+ "grunt-component-build": "~0.2.7",
+ "grunt-contrib-uglify": "~0.2.0",
+ "grunt-contrib-watch": "~0.3.1",
+ "component-json": "~0.1.4",
+ "grunt-combine": "~0.8.3",
+ "grunt-component": "~0.1.2"
+ },
+ "scripts": {
+ "pretest": "./node_modules/.bin/coffeelint -f coffeelint_config.json -r components spec",
+ "test": "./node_modules/.bin/mocha --compilers coffee:coffee-script spec/*"
},
"noflo": {
"components": {
@@ -55,9 +65,5 @@
"TupleToArray": "./graphs/TupleToArray.fbp",
"TupleToPackets": "./graphs/TupleToPackets.fbp"
}
- },
- "scripts": {
- "pretest": "./node_modules/.bin/coffeelint -r components",
- "test": "./node_modules/.bin/noflo-test --spec test/*.coffee"
}
}

0 comments on commit 8e89ac6

Please sign in to comment.