Commit 8202611b000a0b3a4c0ead7f40d086af14776c0b
0 parents
Exists in
master
Primera versión estable.
Showing
9 changed files
with
256 additions
and
0 deletions
Show diff stats
.gitignore
.jshintrc
| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | +{ | |
| 2 | + /* | |
| 3 | + * ENVIRONMENTS | |
| 4 | + * ================= | |
| 5 | + */ | |
| 6 | + | |
| 7 | + // Define globals exposed by modern browsers. | |
| 8 | + "browser": true, | |
| 9 | + | |
| 10 | + // Define globals exposed by jQuery. | |
| 11 | + "jquery": true, | |
| 12 | + | |
| 13 | + // Define globals exposed by Node.js. | |
| 14 | + "node": true, | |
| 15 | + | |
| 16 | + // Allow ES6. | |
| 17 | + "esversion": 6, | |
| 18 | + | |
| 19 | + /* | |
| 20 | + * ENFORCING OPTIONS | |
| 21 | + * ================= | |
| 22 | + */ | |
| 23 | + | |
| 24 | + // Force all variable names to use either camelCase style or UPPER_CASE | |
| 25 | + // with underscores. | |
| 26 | + "camelcase": true, | |
| 27 | + | |
| 28 | + // Prohibit use of == and != in favor of === and !==. | |
| 29 | + "eqeqeq": true, | |
| 30 | + | |
| 31 | + // Enforce tab width of 2 spaces. | |
| 32 | + "indent": 4, | |
| 33 | + | |
| 34 | + // Prohibit use of a variable before it is defined. | |
| 35 | + "latedef": true, | |
| 36 | + | |
| 37 | + // Enforce line length to 100 characters | |
| 38 | + "maxlen": 100, | |
| 39 | + | |
| 40 | + // Require capitalized names for constructor functions. | |
| 41 | + "newcap": true, | |
| 42 | + | |
| 43 | + // Enforce use of single quotation marks for strings. | |
| 44 | + "quotmark": "single", | |
| 45 | + | |
| 46 | + // Enforce placing 'use strict' at the top function scope | |
| 47 | + "strict": false, | |
| 48 | + | |
| 49 | + // Prohibit use of explicitly undeclared variables. | |
| 50 | + "undef": true, | |
| 51 | + | |
| 52 | + // Warn when variables are defined but never used. | |
| 53 | + "unused": true, | |
| 54 | + | |
| 55 | + // Para que funcione en angular | |
| 56 | + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | |
| 57 | + /* | |
| 58 | + * RELAXING OPTIONS | |
| 59 | + * ================= | |
| 60 | + */ | |
| 61 | + | |
| 62 | + // Suppress warnings about == null comparisons. | |
| 63 | + "eqnull": true | |
| 64 | +} |
README.md
gulpfile.js
| ... | ... | @@ -0,0 +1,82 @@ |
| 1 | +const clean = require('gulp-clean'); | |
| 2 | +const concat = require('gulp-concat'); | |
| 3 | +const connect = require('gulp-connect'); | |
| 4 | +const gulp = require('gulp'); | |
| 5 | +const htmlmin = require('gulp-htmlmin'); | |
| 6 | +const jshint = require('gulp-jshint'); | |
| 7 | +const pump = require('pump'); | |
| 8 | +const rename = require('gulp-rename'); | |
| 9 | +const replace = require('gulp-replace'); | |
| 10 | +const templateCache = require('gulp-angular-templatecache'); | |
| 11 | +const uglify = require('gulp-uglify-es').default; | |
| 12 | + | |
| 13 | +var paths = { | |
| 14 | + srcJS: 'src/js/*.js', | |
| 15 | + srcViews: 'src/views/*.html', | |
| 16 | + tmp: 'tmp', | |
| 17 | + dist: 'dist/' | |
| 18 | +}; | |
| 19 | + | |
| 20 | +gulp.task('templates', ['clean'], function() { | |
| 21 | + return pump( | |
| 22 | + [ | |
| 23 | + gulp.src(paths.srcViews), | |
| 24 | + htmlmin(), | |
| 25 | + templateCache('views.js', { | |
| 26 | + module: 'focaSeguimiento', | |
| 27 | + root: '' | |
| 28 | + }), | |
| 29 | + gulp.dest(paths.tmp) | |
| 30 | + ] | |
| 31 | + ); | |
| 32 | +}); | |
| 33 | + | |
| 34 | +gulp.task('uglify', ['templates'], function() { | |
| 35 | + return pump( | |
| 36 | + [ | |
| 37 | + gulp.src([ | |
| 38 | + paths.srcJS, | |
| 39 | + 'tmp/views.js' | |
| 40 | + ]), | |
| 41 | + concat('foca-seguimiento.js'), | |
| 42 | + replace("['ngRoute', 'ngCookies', 'focaDirectivas']",'[]'), | |
| 43 | + replace('src/views/', ''), | |
| 44 | + gulp.dest(paths.tmp), | |
| 45 | + rename('foca-seguimiento.min.js'), | |
| 46 | + uglify(), | |
| 47 | + gulp.dest(paths.dist) | |
| 48 | + ] | |
| 49 | + ); | |
| 50 | +}); | |
| 51 | + | |
| 52 | +gulp.task('clean', function() { | |
| 53 | + return gulp.src(['tmp', 'dist'], {read: false}) | |
| 54 | + .pipe(clean()); | |
| 55 | +}); | |
| 56 | + | |
| 57 | +gulp.task('pre-commit', function() { | |
| 58 | + pump( | |
| 59 | + [ | |
| 60 | + gulp.src(paths.srcJS), | |
| 61 | + jshint('.jshintrc'), | |
| 62 | + jshint.reporter('default'), | |
| 63 | + jshint.reporter('fail') | |
| 64 | + ] | |
| 65 | + ); | |
| 66 | +}); | |
| 67 | + | |
| 68 | +gulp.task('clean-post-install', function() { | |
| 69 | + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | |
| 70 | + 'index.html'], {read: false}) | |
| 71 | + .pipe(clean()); | |
| 72 | +}); | |
| 73 | + | |
| 74 | +gulp.task('compile', ['templates', 'uglify']); | |
| 75 | + | |
| 76 | +gulp.task('webserver', function() { | |
| 77 | + pump [ | |
| 78 | + connect.server({port: 3000}) | |
| 79 | + ] | |
| 80 | +}); | |
| 81 | + | |
| 82 | +gulp.task('default', ['webserver']); |
index.html
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +<html ng-app="focaSeguimiento"> | |
| 2 | + <head> | |
| 3 | + <meta charset="UTF-8"/> | |
| 4 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| 5 | + | |
| 6 | + <!--VENDOR JS--> | |
| 7 | + <script src="node_modules/angular/angular.min.js"></script> | |
| 8 | + | |
| 9 | + <script src="src/js/app.js"></script> | |
| 10 | + <script src="src/js/service.js"></script> | |
| 11 | + <script src="src/etc/develop.js"></script> | |
| 12 | + </head> | |
| 13 | + <body> | |
| 14 | + <div ng-view> | |
| 15 | + </div> | |
| 16 | + </body> | |
| 17 | +</html> |
package.json
| ... | ... | @@ -0,0 +1,60 @@ |
| 1 | +{ | |
| 2 | + "name": "foca-seguimiento", | |
| 3 | + "version": "0.0.1", | |
| 4 | + "description": "Seguimiento", | |
| 5 | + "main": "dist/foca-seguimiento.js", | |
| 6 | + "scripts": { | |
| 7 | + "test": "echo \"Error: no test specified\" && exit 1", | |
| 8 | + "compile": "gulp compile", | |
| 9 | + "gulp-pre-commit": "gulp pre-commit", | |
| 10 | + "postinstall": "npm run compile && gulp clean-post-install", | |
| 11 | + "install-dev": "npm install -D gulp gulp-connect jasmine-core pre-commit angular angular-route angular-cookies bootstrap font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-replace jquery jshint pump && npm i -D git+https://debo.suite.repo/modulos-npm/foca-directivas" | |
| 12 | + }, | |
| 13 | + "pre-commit": [ | |
| 14 | + "gulp-pre-commit" | |
| 15 | + ], | |
| 16 | + "repository": { | |
| 17 | + "type": "git", | |
| 18 | + "url": "https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | |
| 19 | + }, | |
| 20 | + "author": "Foca Software", | |
| 21 | + "license": "ISC", | |
| 22 | + "peerDependencies": { | |
| 23 | + "angular": "^1.7.x", | |
| 24 | + "bootstrap": "^4.1.x", | |
| 25 | + "jquery": "^3.3.x", | |
| 26 | + "font-awesome": "^4.7.x", | |
| 27 | + "gulp": "^3.9.x", | |
| 28 | + "gulp-concat": "2.6.x", | |
| 29 | + "gulp-jshint": "^2.1.x", | |
| 30 | + "gulp-rename": "^1.4.x", | |
| 31 | + "gulp-replace": "^1.0.x", | |
| 32 | + "gulp-uglify-es": "^1.0.x", | |
| 33 | + "jshint": "^2.9.x", | |
| 34 | + "pump": "^3.0.x", | |
| 35 | + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas" | |
| 36 | + }, | |
| 37 | + "devDependencies": { | |
| 38 | + "angular": "^1.7.5", | |
| 39 | + "angular-cookies": "^1.7.5", | |
| 40 | + "angular-route": "^1.7.5", | |
| 41 | + "bootstrap": "^4.1.3", | |
| 42 | + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas", | |
| 43 | + "font-awesome": "^4.7.0", | |
| 44 | + "gulp": "^3.9.1", | |
| 45 | + "gulp-angular-templatecache": "2.2.3", | |
| 46 | + "gulp-clean": "^0.4.0", | |
| 47 | + "gulp-connect": "^5.6.1", | |
| 48 | + "gulp-htmlmin": "5.0.1", | |
| 49 | + "gulp-jshint": "2.1.0", | |
| 50 | + "gulp-rename": "1.4.0", | |
| 51 | + "gulp-replace": "1.0.0", | |
| 52 | + "gulp-sequence": "^1.0.0", | |
| 53 | + "gulp-uglify-es": "1.0.4", | |
| 54 | + "jasmine-core": "^3.2.1", | |
| 55 | + "jquery": "^3.3.1", | |
| 56 | + "jshint": "2.9.6", | |
| 57 | + "pre-commit": "^1.2.2", | |
| 58 | + "pump": "3.0.0" | |
| 59 | + } | |
| 60 | +} |
src/etc/develop.js.ejemplo
src/js/app.js
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +angular.module('focaSeguimiento', []); |
src/js/service.js
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +angular.module('focaSeguimiento') | |
| 2 | + .service('focaSeguimientoService', [ | |
| 3 | + '$http', 'API_ENDPOINT', 'cordovaGeolocationService', | |
| 4 | + function($http, API_ENDPOINT, cordovaGeolocationService) { | |
| 5 | + return { | |
| 6 | + guardarPosicion: function(actividad, observaciones) { | |
| 7 | + cordovaGeolocationService.getCurrentPosition(function(posicion){ | |
| 8 | + var nuevaPosicion = { | |
| 9 | + posicion: { | |
| 10 | + latitud: posicion.coords.latitude, | |
| 11 | + longitud: posicion.coords.longitude, | |
| 12 | + actividad: actividad, | |
| 13 | + observaciones: observaciones | |
| 14 | + } | |
| 15 | + }; | |
| 16 | + return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); | |
| 17 | + }); | |
| 18 | + } | |
| 19 | + }; | |
| 20 | + } | |
| 21 | + ]); |