<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700' rel='stylesheet' type='text/css'>
<script src="../bower_components/chance/chance.js"></script>
<script src="../bower_components/d3/d3.min.js"></script>
- <script src="../src/namespaces.js"></script>
- <script src="../src/util/fib.js"></script>
- <script src="../src/models/cycle.js"></script>
- <script src="../src/models/blip.js"></script>
- <script src="../src/models/quadrant.js"></script>
- <script src="../src/models/radar.js"></script>
- <script src="../src/graphing/radar.js"></script>
- <style>
- </style>
+ <script src="../dist/tech-radar.min.js"></script>
+ <link href="../dist/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="radar">
var gulp = require('gulp')
+ , pkg = require('./package.json')
, gutil = require('gulp-util')
, gkarma = require('gulp-karma')
+ , sass = require('gulp-sass')
+ , concat = require('gulp-concat')
+ , uglify = require('gulp-uglify')
+ , clean = require('gulp-clean')
+ , header = require('gulp-header')
, files;
+
+banner = [
+ '/**',
+ ' * <%= pkg.name %>
+ ' * @version v<%= pkg.version %>',
+ ' */',
+ ''
+].join('\n');
+
files = {
LIB: 'bower_components/d3/*.min.js',
NS: 'src/namespaces.js',
SOURCE: 'src/**/*.js',
- SPEC: 'test/**/*-spec.js'
+ SPEC: 'test/**/*-spec.js',
+ STYLESHEETS: 'src/stylesheets/**/*.scss'
};
+gulp.task('sass', function () {
+ gulp.src(files.STYLESHEETS)
+ .pipe(sass())
+ .pipe(gulp.dest('./dist/'));
+});
+
+gulp.task('concat', function () {
+ gulp.src([files.NS, files.SOURCE])
+ .pipe(concat('tech-radar.js'))
+ .pipe(header(banner, { pkg: pkg }))
+ .pipe(gulp.dest('./dist/'));
+});
+var clean = require('gulp-clean');
+
+gulp.task('clean', function() {
+ gulp.src('./dist/', {read: false})
+ .pipe(clean({force: true}));
+});
+
+gulp.task('compress', function() {
+ gulp.src([files.NS, files.SOURCE])
+ .pipe(concat('tech-radar.min.js'))
+ .pipe(uglify({outSourceMap: true}))
+ .pipe(header(banner, { pkg: pkg }))
+ .pipe(gulp.dest('./dist/'))
+});
+
+gulp.task('dist', ['clean', 'concat', 'compress', 'sass']);
+
gulp.task('test', function (){
var karma;
.attr('r', 10);
}
- function plotBlips(cycles, quadrant, adjustX, adjustY) {
+ function plotBlips(cycles, quadrant, adjustX, adjustY, cssClass) {
var blips;
blips = quadrant.blips();
cycles.forEach(function (cycle, i) {
var y = center() + radius * Math.sin(angleInRad) * adjustY;
if (blip.isNew()) {
- triangle(x, y, cssClassFor(quadrant.name()));
+ triangle(x, y, cssClass);
} else {
- circle(x, y, cssClassFor(quadrant.name()));
+ circle(x, y, cssClass);
}
svg.append('text')
});
};
- function cssClassFor(string) {
- return string.toLowerCase().replace(/\s\&/g, '').replace(/\s/g, '-');
- }
-
function plotQuadrantNames(quadrants) {
- function plotName(name, anchor, x, y) {
+ function plotName(name, anchor, x, y, cssClass) {
svg.append('text')
.attr('x', x)
.attr('y', y)
- .attr('class', cssClassFor(name))
+ .attr('class', cssClass)
.attr('text-anchor', anchor)
.text(name);
}
- plotName(quadrants.I.name(), 'end', size - 10, 10)
- plotName(quadrants.II.name(), 'start', 10, 10)
- plotName(quadrants.III.name(), 'start', 10, size - 10)
- plotName(quadrants.IV.name(), 'end', size -10, size - 10)
+ plotName(quadrants.I.name(), 'end', size - 10, 10, 'first')
+ plotName(quadrants.II.name(), 'start', 10, 10, 'second')
+ plotName(quadrants.III.name(), 'start', 10, size - 10, 'third')
+ plotName(quadrants.IV.name(), 'end', size -10, size - 10, 'fourth')
}
self.init = function (selector) {
if (radar.hasQuadrants()) {
plotQuadrantNames(quadrants);
- plotBlips(cycles, quadrants.I, 1, -1);
- plotBlips(cycles, quadrants.II, -1, -1);
- plotBlips(cycles, quadrants.III, -1, 1);
- plotBlips(cycles, quadrants.IV, 1, 1);
+ plotBlips(cycles, quadrants.I, 1, -1, 'first');
+ plotBlips(cycles, quadrants.II, -1, -1, 'second');
+ plotBlips(cycles, quadrants.III, -1, 1, 'third');
+ plotBlips(cycles, quadrants.IV, 1, 1, 'fourth');
}
};