Skip to content

Commit

Permalink
Released 0.3 and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Young committed Mar 9, 2011
1 parent 8026ecd commit 03c3ab1
Show file tree
Hide file tree
Showing 20 changed files with 3,056 additions and 699 deletions.
86 changes: 86 additions & 0 deletions Jakefile.js
@@ -0,0 +1,86 @@
var sys = require('sys'),
path = require('path'),
fs = require('fs'),
jsmin = require('jsmin').jsmin,
exec = require('child_process').exec,
files;

files = ('src/start.js src/helpers.js src/normaliser.js src/base.js '
+ 'src/graphs/base.js src/graphs/bar.js src/graphs/horizontal_bar.js '
+ 'src/graphs/line.js src/graphs/sparkline.js src/graphs/sparkbar.js '
+ 'src/end.js').split(' ');

desc('Builds build/turing.js.');
task('concat', [], function() {
var filesLeft = files.length,
pathName = '.',
outFile = fs.openSync('ico.js', 'w+');
files.forEach(function(fileName) {
var fileName = path.join(pathName, fileName),
contents = fs.readFileSync(fileName);
fs.writeSync(outFile, contents.toString());
});
fs.closeSync(outFile);
});

desc('Minifies with uglify-js');
task('min', ['concat'], function() {
// uglify-js
var uglify = require('uglify-js'),
jsp = uglify.parser,
pro = uglify.uglify,
ast = jsp.parse(fs.readFileSync('ico.js').toString()),
outFile = fs.openSync('ico-min.js', 'w+');
ast = pro.ast_mangle(ast);
ast = pro.ast_squeeze(ast);
fs.writeSync(outFile, pro.gen_code(ast));
});

function lint(file) {
var JSHINT = require('jshint').JSHINT,
result = JSHINT(fs.readFileSync(file).toString(), {});
if (result) {
console.log(file + ': Lint passed');
} else {
console.log(file + ' ERRORS:');
console.log(JSHINT.errors);
}
}

desc('Lint');
task('lint', [], function() {
files.forEach(function(file) {
if (file.match(/(start|end)\.js/)) return;
lint(file);
});

lint('ico.js');
});

desc('Documentation');
task('docs', [], function() {
exec('dox --title Ico src/*.js src/graphs/*.js --intro docs/intro.md > docs/index.html');
exec('cp ico-min.js docs/');
exec('cp raphael.js docs/');
});

desc('Run tests');
task('tests', [], function() {
require.paths.unshift('./test/turing-test/lib/');

fs.readdir('test', function(err, files) {
files.forEach(function(file) {
if (file.match(/^[^.](.*)test\.js$/)) {
try {
console.log('\n*** ' + file + '\n');
require('./test/' + file);
} catch(e) {
}
}
});
});
});

desc('Main build task');
task('build', ['concat', 'min', 'docs'], function() {});

5 changes: 4 additions & 1 deletion README.textile
Expand Up @@ -4,10 +4,13 @@ Ico is a JavaScript graph library that uses "Raphael":http://raphaeljs.com/ to d

Raphael is the only dependency.

<a href="http://dl.getdropbox.com/u/221414/graphs.png">View Examples.</a>
* "Documentation":http://github.com/alexyoung/ico
* "Examples":http://alexyoung.github.com/ico/examples.html

h3. News

* [2011-03-09] Added documentation and published it to http://alexyoung.github.com/ico/
* [2011-03-09] 0.3.0 released: Split project into separate files, added build script, fixes for HorizontalBarGraph
* [2011-03-01] 0.2.2 released: Ico.SparkLine will now work correctly, particularly in IE6

h3. Targeted graph types
Expand Down
4 changes: 2 additions & 2 deletions index.html → docs/examples.html
Expand Up @@ -4,7 +4,7 @@
<head>
<title>Raphael Ico</title>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="ico.js" type="text/javascript" charset="utf-8"></script>
<script src="ico-min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function $(id) {
return document.getElementById(id);
Expand Down Expand Up @@ -122,7 +122,7 @@ <h2>Contributed Examples</h2>

new Ico.LineGraph($('linegraph_5'),{shoe_size: [15,14,10]},{ markers: 'circle', colours: {shoe_size: '#990000' }, grid: true });

new Ico.HorizontalBarGraph($('bargraph_5'), [2, 5, 1, 10, 15, 33, 20, 25, 1], { font_size: 20, labels: ['label one', 'label two', 'label three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], colour: '#ff0099' });
new Ico.HorizontalBarGraph($('bargraph_5'), [2, 5, 1, 10, 15, 33, 20, 25, 1], { font_size: 20, labels: ['label one', 'label two', 'label three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], colour: '#ff0099', background_colour: '#ccc' });
new Ico.BarGraph($('bargraph_6'), [2, 5, 1, 10, 15, 33, 20, 25, 1], { labels: ['label one', 'label two', 'label three', 'label four', 'label five', 'label six', 'label seven', 'label eight', 'label nine'] });
new Ico.HorizontalBarGraph($('bargraph_7'), [2, 5, 1, 10, 15, 33, 20, 25, 1], { font_size: 14 });
new Ico.HorizontalBarGraph($('bargraph_8'), [0.23, 0.1, 0.9, 0.95, 0.99, 0.3, 0.5, 0.35, 0.3], { colours: { one: '#990000', two: '#009900', three: '#000099'}, labels: ['label one', 'label two', 'label three', 'four', 'five', 'six', 'longest label seven', 'eight', 'nine'] });
Expand Down
1 change: 1 addition & 0 deletions docs/ico-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03c3ab1

Please sign in to comment.