Skip to content

Commit

Permalink
Added: CHANGELOG file, Gulp.js support and Tests for AngularJS versio…
Browse files Browse the repository at this point in the history
…ns 1.2.x, 1.3.x, 1.4.x
  • Loading branch information
lucor committed Feb 26, 2015
1 parent 4d4bd98 commit b3fc7eb
Show file tree
Hide file tree
Showing 17 changed files with 425 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tmp/
/nbproject
.idea
.grunt
/bower_components
bower_components
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: node_js
node_js:
- 0.10
- 0.12
before_install:
- npm install -g bower
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 1
script:
- ./node_modules/karma/bin/karma start karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
- ./node_modules/.bin/gulp test-all-versions
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to `angular-wurfl-image-tailor` will be documented in this file

## 0.9.2 - 2015-02-26

### Added
- $observe expression on 'ngSrc'
- CHANGELOG file
- Gulp.js support
- Tests for AngularJS versions 1.2.x, 1.3.x, 1.4.x

## 0.9.1 - 2015-01-19

### Added
- ngSrc directive support

### Changed
- copyright info

## 0.9.0 - 2014-06-20

### Added
- Initial release
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ Check the [WURFL Image Tailor Documentation](http://wurfl.io/documentation/wit-d
* Run: `npm start`
* Browse: `http://localhost:8000/demo/index.html`

## Testing

``` bash
$ npm test
```

## Authors

- [Luca Corbo](https://github.com/lucor)[view contributions](https://github.com//WURFL/angular-wurfl-image-tailor/commits?author=lucor)
- [All Contributors](../../contributors)

## License

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-wurfl-image-tailor",
"description": "An AngularJS directive for WURFL Image Tailor (WIT)",
"version": "0.9.1",
"version": "0.9.2",
"main": "./src/angular-wurfl-image-tailor.js",
"authors": [
"Luca Corbo (https://github.com/lucor)"
Expand All @@ -15,9 +15,9 @@
"tests"
],
"dependencies": {
"angular": "~1.2.0"
"angular": "^1.2.0"
},
"devDependencies": {
"angular-mocks": "~1.2.0"
"angular-mocks": "^1.2.0"
}
}
34 changes: 34 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var gulp = require('gulp');
var karma = require('karma').server;
var bower = require('gulp-bower');

require('./test/angular-1.2/gulpfile');
require('./test/angular-1.3/gulpfile');
require('./test/angular-1.4/gulpfile');

/**
* Run tests for all angular versions
*/
gulp.task('test-all-versions', ['test-1.2', 'test-1.3', 'test-1.4'], function (done) {
});

/**
* Run test once and exit
*/
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
});

/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js'
}, done);
});

gulp.task('default', ['tdd']);
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-wurfl-image-tailor",
"version": "0.9.1",
"version": "0.9.2",
"description": "An AngularJS directive for WURFL Image Tailor (WIT)",
"author": "Luca Corbo (https://github.com/lucor)",
"maintainers": [
Expand All @@ -26,20 +26,21 @@
],
"devDependencies": {
"chai": "^1.9.1",
"gulp": "^3.8.11",
"gulp-bower": "0.0.10",
"gulp-karma": "0.0.4",
"http-server": "^0.6.1",
"karma": "~0.12",
"karma": "^0.12",
"karma-chai": "^0.1.0",
"karma-mocha": "^0.1.4",
"karma-phantomjs-launcher": "^0.1.4"
},
"scripts": {
"postinstall": "bower install",

"prestart": "npm install",
"start": "http-server -p 8000",

"pretest": "npm install",
"test": "./node_modules/karma/bin/karma start karma.conf.js",
"test-single-run": "./node_modules/karma/bin/karma start karma.conf.js --single-run"
"test": "./node_modules/.bin/gulp",
"test-single-run": "./node_modules/.bin/gulp test"
}
}
7 changes: 5 additions & 2 deletions src/angular-wurfl-image-tailor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* angular-wurfl-image-tailor v0.9.1
* angular-wurfl-image-tailor v0.9.2
* Authors: Luca Corbo (https://github.com/lucor)
* (c) 2014 - 2015 ScientiaMobile, Inc.
* License: MIT
Expand Down Expand Up @@ -35,7 +35,10 @@ angular.module('angular-wurfl-image-tailor', [])
link: function (scope, element, attributes) {
var srcAName = attributes['ngSrc'] ? 'ngSrc' : 'src';

if(!attributes[srcAName]) return;
if(!attributes[srcAName]) {
scope.wit_link = '';
return;
}

attributes.$observe(srcAName, function (src) {
var wit_link_pieces = [witUrls.get()];
Expand Down
21 changes: 21 additions & 0 deletions test/angular-1.2/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "angular-wurfl-image-tailor",
"description": "An AngularJS directive for WURFL Image Tailor (WIT)",
"authors": [
"Luca Corbo (https://github.com/lucor)"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.2.0"
},
"devDependencies": {
"angular-mocks": "~1.2.0"
}
}
23 changes: 23 additions & 0 deletions test/angular-1.2/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var gulp = require('gulp');
var karma = require('karma').server;
var bower = require('gulp-bower');

/**
* Install dependencies for angular-1.2.x
*/
gulp.task('bower-1.2', function() {
return bower({ directory: './bower_components', cwd: './test/angular-1.2' })
});

/**
* Run tests for angular-1.2.x
*/
gulp.task('test-1.2', ['bower-1.2'], function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
noAutoWatch: true,
reporters: 'dots',
browsers: ['PhantomJS']
}, done);
});
70 changes: 70 additions & 0 deletions test/angular-1.2/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Karma configuration

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha','chai'],


// list of files / patterns to load in the browser
files: [

'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'../../src/angular-wurfl-image-tailor.js',
'../../test/**/*Spec.js'
],


// list of files to exclude
exclude: [

],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {

},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};
21 changes: 21 additions & 0 deletions test/angular-1.3/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "angular-wurfl-image-tailor",
"description": "An AngularJS directive for WURFL Image Tailor (WIT)",
"authors": [
"Luca Corbo (https://github.com/lucor)"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.3.0"
},
"devDependencies": {
"angular-mocks": "~1.3.0"
}
}
23 changes: 23 additions & 0 deletions test/angular-1.3/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var gulp = require('gulp');
var karma = require('karma').server;
var bower = require('gulp-bower');

/**
* Install dependencies for angular-1.2.x
*/
gulp.task('bower-1.3', function() {
return bower({ directory: './bower_components', cwd: './test/angular-1.3' })
});

/**
* Run tests for angular-1.2.x
*/
gulp.task('test-1.3', ['bower-1.3'], function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
noAutoWatch: true,
reporters: 'dots',
browsers: ['PhantomJS']
}, done);
});
Loading

0 comments on commit b3fc7eb

Please sign in to comment.