Skip to content

Commit

Permalink
Gera o arquivo não minificado
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagor87 committed Aug 3, 2015
1 parent 68d1382 commit 8b6292d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.1",
"homepage": "https://github.com//n4numberinput",
"authors": [
"N4Works <email>"
"N4Works <contato@n4works.com>"
],
"description": "desc",
"keywords": [],
Expand Down
38 changes: 38 additions & 0 deletions dist/n4numberinput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use strict";

;
(function(ng) {
ng
.module('n4NumberInput', [])
.directive('n4NumberInput', [
function() {
return {
require: 'ngModel',
restrict: 'EAC',
replace: true,
template: '<input type="text">',
link: function(scope, element, attrs, controller) {
var getFormattedValue = function(value) {
if (!value) {
return '';
}
return value.trim().replace(/[^0-9]/g, '');
},
parseValue = function(value) {
var formattedValue = getFormattedValue(value);

if (formattedValue !== value) {
controller.$setViewValue(formattedValue);
controller.$render();
}
return formattedValue;
};

controller.$formatters.unshift(parseValue);
controller.$parsers.unshift(parseValue);
}
};
}
]);

}(angular))
38 changes: 18 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@ var _app = 'src/n4numberinput.js';
var _appMin = 'n4numberinput.min.js';
var _dist = 'dist';

gulp.task('build', ['unit_test'], function()
{
gulp
.src(_app)
.pipe(uglify())
.pipe(rename(_appMin))
.pipe(gulp.dest(_dist));
gulp.task('build', ['unit_test'], function () {
gulp
.src(_app)
.pipe(gulp.dest(_dist))
.pipe(uglify())
.pipe(rename(_appMin))
.pipe(gulp.dest(_dist));
})

gulp.task('unit_test', function(done)
{
var _opts = {
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
};
gulp.task('unit_test', function (done) {
var _opts = {
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
};

karma.start(_opts, done);
karma.start(_opts, done);
})

gulp.task('coverage', ['unit_test'], function()
{
gulp
.src(_coverage)
.pipe(coveralls());
gulp.task('coverage', ['unit_test'], function () {
gulp
.src(_coverage)
.pipe(coveralls());
})

0 comments on commit 8b6292d

Please sign in to comment.