├── .editorconfig ├── .gitignore ├── .jshintrc ├── .npmignore ├── .travis.yml ├── Gruntfile.js ├── LICENSE ├── README.md ├── grunt-esri-slurp.sublime-project ├── package.json ├── tasks └── index.js └── test └── esrislurp_test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-workspace 2 | jsapi 3 | node_modules 4 | npm-debug.log 5 | src 6 | tmp 7 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "boss": true, 11 | "eqnull": true, 12 | "node": true 13 | } 14 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.sublime-project 2 | *.sublime-workspace 3 | .editorconfig 4 | .gitignore 5 | .travis.yml 6 | jsapi 7 | node_modules 8 | test 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "4.1" 5 | - "4.0" 6 | - "0.12" 7 | - "0.11" 8 | - "0.10" 9 | before_install: 10 | - npm install -g grunt-cli 11 | notifications: 12 | email: 13 | on_success: never 14 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * grunt-esri-slurp 3 | * https://github.com/steveoh/grunt-esri-slurp 4 | * 5 | * Copyright (c) 2014 steveoh 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | var version = '3.13'; 12 | var bumpFiles = [ 13 | 'package.json' 14 | ]; 15 | 16 | module.exports = function(grunt) { 17 | // load all npm grunt tasks 18 | require('load-grunt-tasks')(grunt); 19 | 20 | grunt.initConfig({ 21 | jshint: { 22 | all: [ 23 | 'Gruntfile.js', 24 | 'tasks/*.js', 25 | '<%= nodeunit.tests %>' 26 | ], 27 | options: { 28 | jshintrc: '.jshintrc', 29 | reporter: require('jshint-stylish') 30 | } 31 | }, 32 | clean: { 33 | tests: ['tmp', 'src'] 34 | }, 35 | esri_slurp: { 36 | options: { 37 | version: version 38 | }, 39 | dev: { 40 | options: { 41 | beautify: true 42 | }, 43 | dest: 'src/esri' 44 | }, 45 | travis: { 46 | dest: 'src/esri' 47 | } 48 | }, 49 | nodeunit: { 50 | tests: ['test/*_test.js'] 51 | }, 52 | bump: { 53 | options: { 54 | files: bumpFiles, 55 | commitFiles: bumpFiles.concat('README.md'), 56 | push: false 57 | } 58 | }, 59 | debug: { 60 | options: { 61 | open: true 62 | } 63 | } 64 | }); 65 | 66 | grunt.loadTasks('tasks'); 67 | 68 | grunt.registerTask('test', ['clean', 'jshint', 'nodeunit']); 69 | 70 | grunt.registerTask('default', ['jshint', 'esri_slurp:dev']); 71 | 72 | grunt.registerTask('travis', ['jshint', 'esri_slurp:travis', 'nodeunit']); 73 | }; 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 steveoh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/steveoh/grunt-esri-slurp.svg?branch=master)](https://travis-ci.org/steveoh/grunt-esri-slurp) 2 | [![Dependency Status](https://gemnasium.com/steveoh/grunt-esri-slurp.svg)](https://gemnasium.com/steveoh/grunt-esri-slurp) 3 | [![NPM version](https://badge.fury.io/js/grunt-esri-slurp.svg)](http://badge.fury.io/js/grunt-esri-slurp) 4 | [![deprecated](http://badges.github.io/stability-badges/dist/deprecated.svg)](http://github.com/badges/stability-badges) 5 | 6 | # Deprecation notice 7 | 8 | Please consider the use of https://github.com/Esri/arcgis-js-api. Slurp was a stop gap while esri got their act together and published the jsapi to somewhere that makes slurp unnecessary. Thanks for all of the contributions and support along the way. This package will be around for legacy purposes only and will not get further updates unless there is a good reason to do so. 9 | 10 | # esri-slurp may the slource™ be with you! 11 | 12 | > Download and unwind esri js api amd modules and css to create a local package for builds, testing, and continuous integration. The best way to get the slource™. 13 | 14 | ## Getting Started 15 | This is a Grunt plugin for [esrislurp](https://github.com/steveoh/esrislurp). 16 | 17 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 18 | 19 | ```shell 20 | npm install grunt-esri-slurp --save-dev 21 | ``` 22 | 23 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: 24 | 25 | ```js 26 | grunt.loadNpmTasks('grunt-esri-slurp'); 27 | ``` 28 | 29 | ## The "esri_slurp" task 30 | 31 | ### Overview 32 | In your project's Gruntfile, add a section named `esri_slurp` to the data object passed into `grunt.initConfig()`. 33 | 34 | ```js 35 | module.exports = function (grunt) { 36 | grunt.initConfig({ 37 | esri_slurp: { 38 | options: { 39 | version: '3.13' 40 | }, 41 | dev: { 42 | options: { 43 | beautify: true 44 | }, 45 | dest: 'src/esri' 46 | }, 47 | travis: { 48 | dest: 'src/esri' 49 | } 50 | } 51 | }); 52 | 53 | grunt.loadNpmTasks('grunt-esri-slurp'); 54 | 55 | grunt.registerTask('slurp', ['esri_slurp:dev']); 56 | grunt.registerTask('travis', ['esri_slurp:travis']); 57 | }; 58 | ``` 59 | 60 | ### Options 61 | 62 | #### options.version 63 | Type: `String` 64 | Default value: `null` 65 | 66 | A string value representing the version of the esri js api to download. 67 | 68 | #### options.beautify 69 | Type: `Boolean` 70 | Default value: `false` 71 | 72 | A boolean value to make the js and css code beautiful. 73 | 74 | ### Files 75 | 76 | #### files.dest 77 | Type: `String` 78 | Default value: `null` 79 | 80 | A string value letting grunt know where to put the downloaded files. 81 | 82 | ## Examples 83 | 84 | For examples for working with `grunt-esri-slurp` please browse the [AGRC JavaScript BoilerPlate](https://github.com/agrc/AGRCJavaScriptProjectBoilerPlate) project as well as [@TomWayson](https://github.com/tomwayson)'s simple [slurp example](https://github.com/tomwayson/esri-slurp-example). 85 | 86 | ## Release History 87 | **2.0.2** Update `esrislurp` to fix 3.14 dojo build errors. 88 | 89 | **2.0.1** Update `esrislurp` to include 3.14 esri modules. 90 | 91 | **2.0.0** Update `esrislurp` and remove module creation functionality. 92 | 93 | **1.4.7** Update `esrislurp` and other dependencies. 94 | 95 | **1.4.6** Update `esrislurp`. 96 | 97 | **1.4.5** Prune dependencies and update `esrislurp`. 98 | 99 | **1.4.4** Update `esrislurp`. 100 | 101 | **1.4.3** Update `esrislurp` `3.13` modules again. 102 | 103 | **1.4.2** Update `esrislurp` `3.13` modules. 104 | 105 | **1.4.1** Update dependencies. `esrislurp` now has `3.13` modules. 106 | 107 | **1.3.0** Added esri js api `3.12` modules. Create modules grunt task improvements. 108 | 109 | **1.2.0** Core logic extracted into [esrislurp](https://www.npmjs.com/package/esrislurp) 110 | 111 | **1.1.0** Added esri js api `3.11` modules 112 | 113 | **1.0.0** changed `packageLocation` -> `dest` and removed default value. This follows the grunt conventions and makes slurp work with other plugins like `grunt-if-missing`. Removed the default value for the `version` property. Added css beautification. 114 | 115 | **0.6.0** esri_slurp is now a [multi-task](http://gruntjs.com/api/grunt.task#grunt.task.registermultitask) in order to have target level options. 116 | 117 | **0.5.0** Added js-beautify option. esriModuleBuilder task now works on windows. `3.10` module list now in plugin. 118 | 119 | **0.4.0**: Added progress bar and task to build module list. Stored 3.8 and 3.9 modules by default. Anything earlier and you'll have to run it yourself. 120 | 121 | **0.3.0**: Fixed async code and should now run on multiple os's. 122 | 123 | **0.2.0**: Split up the defines so packages can be required again. 124 | 125 | **0.1.0**: Can download modules to a specified location. 126 | 127 | ## License 128 | Copyright (c) 2014 steveoh. Licensed under the MIT license. 129 | -------------------------------------------------------------------------------- /grunt-esri-slurp.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [{ 3 | "folder_exclude_patterns": [ 4 | "node_modules", 5 | "src" 6 | ], 7 | "file_exclude_patterns": [ 8 | "*.sublime-workspace" 9 | ], 10 | "path": "/" 11 | }] 12 | } 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-esri-slurp", 3 | "version": "2.0.2", 4 | "description": "grunt plugin to get the slource by downloading the esri js api amd modules and creating a package.", 5 | "homepage": "https://github.com/steveoh/grunt-esri-slurp", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/steveoh/grunt-esri-slurp.git" 9 | }, 10 | "author": { 11 | "name": "steveoh", 12 | "email": "sgourley@utah.gov" 13 | }, 14 | "keywords": [ 15 | "gruntplugin", 16 | "esri", 17 | "agrc" 18 | ], 19 | "main": "Gruntfile.js", 20 | "engines": { 21 | "node": ">= 0.8.0" 22 | }, 23 | "license": "MIT", 24 | "devDependencies": { 25 | "grunt": "~0.4", 26 | "grunt-bump": "^0.x", 27 | "grunt-contrib-clean": "^0.x", 28 | "grunt-contrib-jshint": "^0.11.1", 29 | "grunt-contrib-nodeunit": "^0.x", 30 | "grunt-debug": "0.0.3", 31 | "grunt-node-inspector": "^0.x", 32 | "jshint-stylish": "^2.x", 33 | "load-grunt-tasks": "^3.x" 34 | }, 35 | "dependencies": { 36 | "esrislurp": "1.2.3", 37 | "progress": "^1.x" 38 | }, 39 | "scripts": { 40 | "test": "grunt test" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tasks/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * grunt-esri-slurp 3 | * https://github.com/steveoh/grunt-esri-slurp 4 | * 5 | * Copyright (c) 2014 steveoh 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | var esrislurp = require('esrislurp'), 11 | ProgressBar = require('progress'); 12 | 13 | module.exports = function(grunt) { 14 | grunt.registerMultiTask('esri_slurp', 'download esri js api amd modules and create a package', function() { 15 | var options = this.options({ 16 | version: null, 17 | beautify: false 18 | }), 19 | done = this.async(); 20 | 21 | if (!options.version || !this.files[0].dest) { 22 | grunt.fail.warn('version option is required and the dest file property must be set on the target.'); 23 | } 24 | 25 | function onSuccess(data) { 26 | grunt.log.ok(); 27 | done(); 28 | } 29 | 30 | function onError(error) { 31 | grunt.log.error('Unable to slurp Esri JS API: ', error); 32 | done(false); 33 | } 34 | 35 | var bar; 36 | 37 | function onProgress(progress) { 38 | if (!bar) { 39 | bar = new ProgressBar('[:bar] :percent remaining: :etas elapsed: :elapseds', { 40 | total: progress.total, 41 | stream: process.stdout, 42 | width: 30 43 | }); 44 | } 45 | bar.tick(); 46 | } 47 | 48 | grunt.log.subhead('downloading and processing esri version ' + options.version); 49 | 50 | esrislurp(this.files[0].dest, options.version, options.beautify, onSuccess, onError, onProgress); 51 | }); 52 | }; 53 | -------------------------------------------------------------------------------- /test/esrislurp_test.js: -------------------------------------------------------------------------------- 1 | var path = require('path'), 2 | exec = require('child_process').exec, 3 | execOptions = { 4 | cwd: path.join(__dirname, '..') 5 | }; 6 | 7 | exports.tests = { 8 | dev: function(test) { 9 | test.expect(1); 10 | exec('grunt esri_slurp:dev', execOptions, function(error, stdout) { 11 | test.equal( 12 | stdout.indexOf('Done, without errors.') > -1, 13 | true, 14 | 'esri_slurp:dev works' 15 | ); 16 | test.done(); 17 | }); 18 | }, 19 | travis: function(test) { 20 | test.expect(1); 21 | exec('grunt esri_slurp:travis', execOptions, function(error, stdout) { 22 | test.equal( 23 | stdout.indexOf('Done, without errors.') > -1, 24 | true, 25 | 'esri_slurp:travis works' 26 | ); 27 | test.done(); 28 | }); 29 | } 30 | }; 31 | --------------------------------------------------------------------------------