Skip to content

Commit feac9ff

Browse files
committed
Moving assets to public, Fixing jshint error, re-structuring demo application, adding karma testing skeleton
1 parent 7707951 commit feac9ff

23 files changed

+364
-145
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# [ng-breadcrumbs](http://ianwalter.github.io/ng-breadcrumbs/)
22
*A better AngularJS service to help with breadcrumb-style navigation between views.*
33

4+
This project was built using [ng-boilerplate](https://github.com/ianwalter/ng-boilerplate)!
45

56
#### Step 1: Install ng-breadcrumbs
67

@@ -64,4 +65,4 @@ That's it! You should now have breadcrumb navigation that can even handle nested
6465
6566
I hope you find this useful!
6667
67-
«–– [Ian](http://www.ianvonwalter.com)
68+
«–– [Ian](http://ianvonwalter.com)

assets/js/app.js

-70
This file was deleted.

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"route"
1212
],
1313
"authors": [
14-
"Ian Kennington Walter <http://www.iankwalter.com>"
14+
"Ian Kennington Walter (http://ianvonwalter.com)"
1515
],
1616
"license": "MIT",
1717
"homepage": "http://ianwalter.github.io/ng-breadcrumbs/",

dist/js/ng-breadcrumbs.min.js

-1
This file was deleted.

dist/js/ng-breadcrumbs.js dist/ng-breadcrumbs.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ng-breadcrumb.js - v0.0.6 - A better AngularJS service to help with breadcrumb-style navigation between views
33
* Based on https://github.com/angular-app/angular-app/blob/master/client/src/common/services/breadcrumbs.js
44
*
5-
* @author Ian Kennington Walter (http://www.ianvonwalter.com)
5+
* @author Ian Kennington Walter (http://ianvonwalter.com)
66
*/
77

88
/* global angular */
@@ -13,14 +13,15 @@ angular
1313
breadcrumbs: [],
1414
get: function() {
1515
if (this.options) {
16-
var self = this;
1716
for (var key in this.options) {
1817
if (this.options.hasOwnProperty(key)) {
19-
angular.forEach(self.breadcrumbs, function(breadcrumb) {
20-
if (breadcrumb.label === key) {
21-
breadcrumb.label = self.options[key];
18+
for (var breadcrumb in this.breadcrumbs) {
19+
if (this.breadcrumbs.hasOwnProperty(breadcrumb)) {
20+
if (breadcrumb.label === key) {
21+
this.breadcrumbs[breadcrumb].label = this.options[key];
22+
}
2223
}
23-
});
24+
}
2425
}
2526
}
2627
}
@@ -39,7 +40,9 @@ angular
3940
if (re.test(route)) {
4041
param = value;
4142
}
42-
if (value) route = route.replace(re, ':' + key);
43+
if (value) {
44+
route = route.replace(re, ':' + key);
45+
}
4346
});
4447
return { path: route, param: param };
4548
};

dist/ng-breadcrumbs.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

+34-51
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,71 @@
11
var path = require('path'),
22
gulp = require('gulp'),
33
uglify = require('gulp-uglify'),
4-
less = require('gulp-less'),
5-
htmlmin = require('gulp-htmlmin'),
64
jshint = require('gulp-jshint'),
75
concat = require('gulp-concat'),
6+
karma = require('gulp-karma'),
87
rename = require('gulp-rename');
98

109
gulp.task('default', function() {
11-
gulp.run('uglify-js', 'less', 'minify-template', 'lint');
10+
gulp.run('uglify-js', 'lint');
1211

13-
gulp.watch('src/js/**/*.js', function(event) {
12+
gulp.watch('src/**/*.js', function(event) {
1413
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
1514
gulp.run('uglify-js');
1615
});
1716

18-
gulp.watch('src/less/**/*.less', function(event) {
19-
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
20-
gulp.run('less');
21-
});
22-
23-
gulp.watch('src/template/**/*.html', function(event) {
24-
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
25-
gulp.run('minify-template');
26-
});
17+
// gulp.src(['undefined.js'])
18+
// .pipe(karma({
19+
// configFile: 'karma.conf.js',
20+
// action: 'watch'
21+
// }));
2722
});
2823

2924
gulp.task('debug', function() {
30-
gulp.run('copy-js', 'less', 'copy-template', 'lint');
25+
gulp.run('copy-js', 'lint');
3126

32-
gulp.watch('src/js/**/*.js', function(event) {
27+
gulp.watch('src/**/*.js', function(event) {
3328
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
3429
gulp.run('copy-js');
3530
});
3631

37-
gulp.watch('src/less/**/*.less', function(event) {
38-
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
39-
gulp.run('less');
40-
});
41-
42-
gulp.watch('src/js/**/*.js', function(event) {
43-
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
44-
gulp.run('copy-template');
45-
});
32+
// gulp.src(['undefined.js'])
33+
// .pipe(karma({
34+
// configFile: 'karma.conf.js',
35+
// action: 'watch'
36+
// }));
4637
});
4738

4839
gulp.task('uglify-js', function() {
49-
gulp.src('src/js/**/*.js')
40+
gulp.src('src/**/*.js')
5041
.pipe(concat('ng-breadcrumbs.js'))
51-
.pipe(gulp.dest('dist/js'))
42+
.pipe(gulp.dest('dist'))
5243
.pipe(uglify())
5344
.pipe(rename('ng-breadcrumbs.min.js'))
54-
.pipe(gulp.dest('dist/js'));
45+
.pipe(gulp.dest('dist'));
5546
});
5647

5748
gulp.task('copy-js', function() {
58-
gulp.src('src/js/**/*.js')
49+
gulp.src('src/**/*.js')
5950
.pipe(concat('ng-breadcrumbs.js'))
60-
.pipe(gulp.dest('dist/js'))
51+
.pipe(gulp.dest('dist'))
6152
.pipe(rename('ng-breadcrumbs.min.js'))
62-
.pipe(gulp.dest('dist/js'));
63-
});
64-
65-
gulp.task('minify-template', function() {
66-
gulp.src('src/template/**/*.html')
67-
.pipe(htmlmin({ collapseWhitespace: true }))
68-
.pipe(gulp.dest('public/template'));
69-
});
70-
71-
gulp.task('copy-template', function() {
72-
gulp.src('src/template/**/*.html')
73-
.pipe(gulp.dest('public/template'));
74-
});
75-
76-
gulp.task('less', function() {
77-
gulp.src('src/less/**/*.less')
78-
.pipe(less({
79-
paths: [ path.join(__dirname, 'public/less', 'includes') ]
80-
}))
81-
.pipe(gulp.dest('public/css'));
53+
.pipe(gulp.dest('dist'));
8254
});
8355

8456
gulp.task('lint', function() {
85-
gulp.src('src/js/**/*.js')
57+
gulp.src('src/**/*.js')
8658
.pipe(jshint())
8759
.pipe(jshint.reporter('default'));
88-
});
60+
});
61+
62+
//gulp.task('test', function() {
63+
// gulp.run('uglify-js');
64+
//
65+
// // undefined.js: unfortunately necessary for now
66+
// return gulp.src(['undefined.js'])
67+
// .pipe(karma({
68+
// configFile: 'karma.conf.js',
69+
// action: 'run'
70+
// }));
71+
//});

index.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
}
2121
</style>
2222

23-
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js" data-main="assets/js/app.js"></script>
23+
<script src="public/js/requirejs-config.js" type="application/javascript"></script>
24+
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js" data-main="public/js/main.js"></script>
2425
</head>
2526
<body ng-controller="HomeController">
2627
<a href="https://github.com/ianwalter/ng-breadcrumbs">
@@ -48,7 +49,7 @@ <h4>A better AngularJS service to help with breadcrumb-style navigation between
4849
<br>
4950
<p>
5051
I hope you find this useful!<br>
51-
«–– <a href="http://www.iankwalter.com">Ian</a>
52+
«–– <a href="http://ianvonwalter.com">Ian</a>
5253
</p>
5354
<br>
5455
</div>

karma.conf.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Karma configuration
2+
// Generated on Tue Mar 11 2014 15:26:49 GMT-0400 (EDT)
3+
4+
module.exports = function(config) {
5+
6+
var testFiles = [
7+
'public/js/requirejs-config.js',
8+
'test/unit/test-main.js',
9+
{ pattern: 'public/js/**/*.js', included: false },
10+
{ pattern: 'public/lib/**/*.js', included: false }
11+
];
12+
13+
if (process.argv[4]) { // TODO this should be more robust by checking the actual argument name
14+
testFiles.push({ pattern: 'test/unit/' + process.argv[4], included: false });
15+
} else {
16+
testFiles.push({ pattern: 'test/unit/**/*.js', included: false });
17+
}
18+
19+
config.set({
20+
21+
// base path that will be used to resolve all patterns (eg. files, exclude)
22+
basePath: '',
23+
24+
25+
// frameworks to use
26+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
27+
frameworks: ['requirejs', 'mocha', 'chai'],
28+
29+
30+
// list of files / patterns to load in the browser
31+
files: testFiles,
32+
33+
34+
exclude: [
35+
36+
],
37+
38+
39+
// preprocess matching files before serving them to the browser
40+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
41+
preprocessors: {
42+
43+
},
44+
45+
46+
// test results reporter to use
47+
// possible values: 'dots', 'progress'
48+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
49+
reporters: ['progress'],
50+
51+
52+
// web server port
53+
port: 9876,
54+
55+
56+
// enable / disable colors in the output (reporters and logs)
57+
colors: true,
58+
59+
60+
// level of logging
61+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
62+
logLevel: config.LOG_INFO,
63+
64+
65+
// enable / disable watching file and executing tests whenever any file changes
66+
autoWatch: false,
67+
68+
69+
// start these browsers
70+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
71+
browsers: ['Chrome'],
72+
73+
74+
// Continuous Integration mode
75+
// if true, Karma captures browsers, runs the tests and exits
76+
singleRun: false,
77+
78+
captureTimeout: 60000
79+
});
80+
};

package.json

+12-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@
66
"devDependencies": {
77
"gulp": "~3.5.1",
88
"gulp-uglify": "~0.1.0",
9-
"gulp-less": "~1.1.10",
10-
"gulp-htmlmin": "~0.1.1",
119
"gulp-jshint": "~1.3.4",
1210
"gulp-concat": "~2.1.7",
13-
"gulp-rename": "~1.2.0"
11+
"gulp-rename": "~1.2.0",
12+
"karma": "~0.12.1",
13+
"gulp-karma": "0.0.4",
14+
"mocha": "~1.17.1",
15+
"karma-mocha": "~0.1.1",
16+
"requirejs": "~2.1.11",
17+
"karma-requirejs": "~0.2.1",
18+
"karma-phantomjs-launcher": "~0.1.2",
19+
"karma-chrome-launcher": "~0.1.2",
20+
"chai": "~1.9.0",
21+
"karma-chai": "~0.1.0"
1422
},
1523
"scripts": {
1624
"test": "gulp test"
@@ -23,6 +31,6 @@
2331
"navigation",
2432
"route"
2533
],
26-
"author": "Ian Kennington Walter <http://www.iankwalter.com>",
34+
"author": "Ian Kennington Walter (http://ianvonwalter.com)",
2735
"license": "MIT"
2836
}

0 commit comments

Comments
 (0)