babblebots
Advanced tools
Comparing version 0.2.35 to 0.2.61
@@ -52,13 +52,2 @@ var path = require('path'); | ||
console.log(chalk.green('Main application ' + this.project.name + '.ino written!')); | ||
this.map.includeFiles.forEach(function(file){ | ||
fs.copyRecursive(file, path.resolve(process.cwd(), this.project.dest), function(err){ | ||
if(err){ | ||
if(err.toString().indexOf('exists') !== -1){ | ||
console.log(chalk.yellow('WARNING: ' + err.toString())); | ||
} else { | ||
throw err; | ||
} | ||
} | ||
}); | ||
}.bind(this)); | ||
}.bind(this)); | ||
@@ -65,0 +54,0 @@ } |
@@ -1,4 +0,30 @@ | ||
function Component(build){ | ||
this.build = build; | ||
} | ||
var https = require('https'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var _ = require('lodash'); | ||
var Component = { | ||
fetchDeps: function(build){ | ||
_.forEach(this.includeFiles, function(url, name){ | ||
https.get(url, function(res){ | ||
var body = ''; | ||
res.on('data', function(chunk) { | ||
body += chunk; | ||
}); | ||
res.on('end', function() { | ||
fs.writeFile(path.resolve(process.cwd(), build.project.dest, name), | ||
body, | ||
function(err){ | ||
if(err){ | ||
console.error('Error writing firmware to file: ' + err); | ||
} | ||
}); | ||
}); | ||
}).on('error', function(err){ | ||
callback('Problem fetching firmware: ' + err); | ||
}); | ||
}); | ||
} | ||
}; | ||
module.exports = Component; |
@@ -22,2 +22,3 @@ var path = require('path'); | ||
if(!this.components[component.type]){ | ||
console.log('ERROR', this.components); | ||
console.error('Component file not found for type ' + component.type + '!'); | ||
@@ -24,0 +25,0 @@ process.exit(1); |
{ | ||
"name": "babblebots", | ||
"version": "0.2.35", | ||
"version": "0.2.61", | ||
"description": "BabbleBots allows you to declaratively generate thin NodeBots clients in appropriate languages for IoT microcontrollers\"", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,6 +13,6 @@ var fs = require('fs'); | ||
}, | ||
includeFiles: [ | ||
'includes/neopixel.h', | ||
'includes/neopixel.cpp' | ||
], | ||
includeFiles: { | ||
'neopixel.h': 'https://raw.githubusercontent.com/technobly/SparkCore-NeoPixel/master/firmware/neopixel.h', | ||
'neopixel.cpp': 'https://raw.githubusercontent.com/technobly/SparkCore-NeoPixel/master/firmware/neopixel.cpp': | ||
}, | ||
includes:[ | ||
@@ -23,3 +23,3 @@ '#include neopixel.h' | ||
pixels: 'templates/pixels.tmpl' | ||
}, | ||
} | ||
preInit: function(build, component){ | ||
@@ -46,3 +46,3 @@ build.map.preInit.push('#define PIXEL_PIN ' + component.pins.data + | ||
build.map.init.push('\n\tSpark.function("' + func + '", ' + func + ');'); | ||
build.map.init.push('\n\tParticle.function("' + func + '", ' + func + ');'); | ||
@@ -49,0 +49,0 @@ var result = fs.readFileSync(path.join(__dirname, Neopixels.compFunctions[func])); |
@@ -30,3 +30,5 @@ var fs = require('fs'); | ||
components: { | ||
neopixels: 'components/neopixels/neopixels' | ||
neopixels: 'components/neopixels/neopixels', | ||
internetbutton: 'components/internetbutton/internetbutton', | ||
tcs34725: 'components/tcs34725/tcs34725' | ||
}, | ||
@@ -36,3 +38,4 @@ addComponents: function(build){ | ||
build.project.components.forEach(function(component){ | ||
component.definition.includeFiles.forEach(function(incl){ | ||
component.definition.fetchDeps(build, component); | ||
_.forEach(component.definition.includeFiles, function(incl){ | ||
build.map.includeFiles.push(path.resolve(__dirname, 'components', component.name, incl)); | ||
@@ -39,0 +42,0 @@ }); |
@@ -17,4 +17,9 @@ # BabbleBots | ||
This doesn't do much yet-- if you want a Particle Photon to have neopixels, this is your friend. I'm working on adding some other components before EmpireNode 2015-- namely a typical LED component, and typical sensor component. | ||
Here are the components this supports: | ||
* Creating a setPin function that allows you to set any pin to any value via REST API | ||
* Neopixels, with function that allows you to set colors on neopixels strands via REST API | ||
* Internet Button, with function that allows you to set the neopixels colors and access accelerometer values and button push events via REST API | ||
* TCS34725 color sensor with variables that allow you to access red green and blue values via REST API | ||
# Goals | ||
@@ -31,4 +36,2 @@ | ||
* Docs. All the docs. | ||
* write a outputPin component and sensor component for Particle Photon | ||
* write default setPin function for Photon | ||
* UNIT TESTS. I failed at TDD but I need to put tests in. | ||
@@ -40,2 +43,8 @@ * write a spark upload task | ||
0.2.61 -- docs push. | ||
0.2.6 -- minor bug fixes and added TCS34725 color sensor | ||
0.2.5 -- minor bug fixes and added Internet Button. Also, dependencies now fetch from GitHub instead of keeping files in BabbleBots repo. | ||
0.2.1 -- I did a major refactor. Build, Platform, and Component now separate concerns much better than they did. Still a lot of cleaning to do. | ||
@@ -42,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
150271
37
424
53
9
1