a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /* jshint node:true */
  2. var path = require('path');
  3. var saucelabsBrowsers = require(path.resolve('test', 'saucelabs-browsers.js'));
  4. var sourceFiles = [
  5. 'Gruntfile.js',
  6. 'src/*.js',
  7. 'src/**/*.js',
  8. 'test/**/test.*.js'
  9. ];
  10. module.exports = exports = function(grunt) {
  11. 'use strict';
  12. var BANNER = '/*!\n' +
  13. ' localForage -- Offline Storage, Improved\n' +
  14. ' Version ' + grunt.file.readJSON('package.json').version + '\n' +
  15. ' https://mozilla.github.io/localForage\n' +
  16. ' (c) 2013-2016 Mozilla, Apache License 2.0\n' +
  17. '*/\n';
  18. var babelModuleIdProvider = function getModuleId(moduleName) {
  19. var files = {
  20. 'src/localforage': 'localforage',
  21. 'src/utils/serializer': 'localforageSerializer',
  22. 'src/drivers/indexeddb': 'asyncStorage',
  23. 'src/drivers/localstorage': 'localStorageWrapper',
  24. 'src/drivers/websql': 'webSQLStorage'
  25. };
  26. return files[moduleName] || moduleName.replace('src/', '');
  27. };
  28. grunt.initConfig({
  29. babel: {
  30. options: {
  31. babelrc: false,
  32. extends: path.resolve('.babelrc-umd'),
  33. moduleIds: true,
  34. getModuleId: babelModuleIdProvider
  35. },
  36. dist: {
  37. files: {
  38. 'build/es5src/localforage.js': 'src/localforage.js',
  39. 'build/es5src/utils/serializer.js': 'src/utils/serializer.js',
  40. 'build/es5src/drivers/indexeddb.js': 'src/drivers/indexeddb.js',
  41. 'build/es5src/drivers/localstorage.js': 'src/drivers/localstorage.js',
  42. 'build/es5src/drivers/websql.js': 'src/drivers/websql.js'
  43. }
  44. }
  45. },
  46. browserify: {
  47. package_bundling_test: {
  48. src: 'test/runner.browserify.js',
  49. dest: 'test/localforage.browserify.js'
  50. },
  51. main: {
  52. files: {
  53. 'dist/localforage.js': 'src/localforage.js'
  54. },
  55. options: {
  56. browserifyOptions: {
  57. standalone: 'localforage'
  58. },
  59. transform: ['rollupify', 'babelify'],
  60. plugin: ['bundle-collapser/plugin']
  61. }
  62. },
  63. no_promises: {
  64. files: {
  65. 'dist/localforage.nopromises.js': 'src/localforage.js'
  66. },
  67. options: {
  68. browserifyOptions: {
  69. standalone: 'localforage'
  70. },
  71. transform: ['rollupify', 'babelify'],
  72. plugin: ['bundle-collapser/plugin'],
  73. exclude: ['lie/polyfill']
  74. }
  75. }
  76. },
  77. run: {
  78. derequire: {
  79. exec: 'derequire ' +
  80. '< dist/localforage.js > dist/localforage.tmp ' +
  81. '&& ncp dist/localforage.tmp dist/localforage.js' +
  82. '&& rimraf dist/localforage.tmp'
  83. },
  84. derequire_no_promises: {
  85. exec: 'derequire ' +
  86. '< dist/localforage.nopromises.js > dist/localforage.nopromises.tmp ' +
  87. '&& ncp dist/localforage.nopromises.tmp dist/localforage.nopromises.js' +
  88. '&& rimraf dist/localforage.nopromises.tmp'
  89. }
  90. },
  91. concat: {
  92. options: {
  93. separator: ''
  94. },
  95. localforage: {
  96. // just to add the BANNER
  97. // without adding an extra grunt module
  98. files: {
  99. 'dist/localforage.js': [
  100. 'dist/localforage.js'
  101. ],
  102. 'dist/localforage.nopromises.js': [
  103. 'dist/localforage.nopromises.js'
  104. ]
  105. },
  106. options: {
  107. banner: BANNER
  108. }
  109. }
  110. },
  111. connect: {
  112. test: {
  113. options: {
  114. base: '.',
  115. hostname: '*',
  116. port: 9999,
  117. middleware: function(connect) {
  118. return [
  119. function(req, res, next) {
  120. res.setHeader('Access-Control-Allow-Origin',
  121. '*');
  122. res.setHeader('Access-Control-Allow-Methods',
  123. '*');
  124. return next();
  125. },
  126. connect.static(require('path').resolve('.'))
  127. ];
  128. }
  129. }
  130. }
  131. },
  132. es3_safe_recast: {
  133. dist: {
  134. files: [{
  135. src: ['dist/localforage.js'],
  136. dest: 'dist/localforage.js'
  137. }]
  138. },
  139. nopromises: {
  140. files: [{
  141. src: ['dist/localforage.nopromises.js'],
  142. dest: 'dist/localforage.nopromises.js'
  143. }]
  144. }
  145. },
  146. jscs: {
  147. source: sourceFiles
  148. },
  149. jshint: {
  150. options: {
  151. jshintrc: '.jshintrc'
  152. },
  153. source: sourceFiles
  154. },
  155. mocha: {
  156. unit: {
  157. options: {
  158. urls: [
  159. 'http://localhost:9999/test/test.main.html',
  160. 'http://localhost:9999/test/test.min.html',
  161. 'http://localhost:9999/test/test.callwhenready.html',
  162. 'http://localhost:9999/test/test.customdriver.html',
  163. 'http://localhost:9999/test/test.faultydriver.html',
  164. 'http://localhost:9999/test/test.nodriver.html',
  165. 'http://localhost:9999/test/test.browserify.html',
  166. 'http://localhost:9999/test/test.require.html',
  167. 'http://localhost:9999/test/test.webpack.html'
  168. ]
  169. }
  170. }
  171. },
  172. 'saucelabs-mocha': {
  173. all: {
  174. options: {
  175. username: process.env.SAUCE_USERNAME,
  176. key: process.env.SAUCE_ACCESS_KEY,
  177. urls: ['http://localhost:9999/test/test.main.html'],
  178. tunnelTimeout: 5,
  179. build: process.env.TRAVIS_JOB_ID,
  180. concurrency: 3,
  181. browsers: saucelabsBrowsers,
  182. testname: 'localForage Tests'
  183. }
  184. }
  185. },
  186. uglify: {
  187. localforage: {
  188. files: {
  189. 'dist/localforage.min.js': ['dist/localforage.js'],
  190. 'dist/localforage.nopromises.min.js': [
  191. 'dist/localforage.nopromises.js'
  192. ]
  193. },
  194. options: {
  195. banner: BANNER
  196. }
  197. }
  198. },
  199. watch: {
  200. build: {
  201. files: ['src/*.js', 'src/**/*.js'],
  202. tasks: ['build']
  203. },
  204. /*jshint scripturl:true */
  205. 'mocha:unit': {
  206. files: [
  207. 'dist/localforage.js',
  208. 'test/runner.js',
  209. 'test/test.*.*'
  210. ],
  211. tasks: [
  212. 'jshint',
  213. 'jscs',
  214. 'browserify:package_bundling_test',
  215. 'webpack:package_bundling_test',
  216. 'mocha:unit'
  217. ]
  218. }
  219. },
  220. webpack: {
  221. package_bundling_test: {
  222. entry: './test/runner.webpack.js',
  223. output: {
  224. path: 'test/',
  225. filename: 'localforage.webpack.js'
  226. }
  227. }
  228. }
  229. });
  230. require('load-grunt-tasks')(grunt);
  231. grunt.registerTask('default', ['build', 'connect', 'watch']);
  232. grunt.registerTask('build', ['browserify:main', 'browserify:no_promises',
  233. 'run:derequire', 'run:derequire_no_promises',
  234. 'concat', 'es3_safe_recast', 'uglify']);
  235. grunt.registerTask('serve', ['build', 'connect:test', 'watch']);
  236. // These are the test tasks we run regardless of Sauce Labs credentials.
  237. var testTasks = [
  238. 'build',
  239. 'babel',
  240. 'jshint',
  241. 'jscs',
  242. 'browserify:package_bundling_test',
  243. 'webpack:package_bundling_test',
  244. 'connect:test',
  245. 'mocha'
  246. ];
  247. grunt.registerTask('test:local', testTasks.slice());
  248. // Run tests using Sauce Labs if we are on Travis or have locally
  249. // available Sauce Labs credentials. Use `grunt test:local` to skip
  250. // Sauce Labs tests.
  251. // if (process.env.TRAVIS_JOB_ID ||
  252. // (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY)) {
  253. // testTasks.push('saucelabs-mocha');
  254. // }
  255. grunt.registerTask('test', testTasks);
  256. };