template.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * grunt-init-amber
  3. * https://amber-lang.net/
  4. *
  5. * Copyright (c) 2013 Manfred Kroehnert, contributors
  6. * Licensed under the MIT license.
  7. */
  8. 'use strict';
  9. // Basic template description.
  10. exports.description = 'Create a web application based on Amber Smalltalk.';
  11. // Template-specific notes to be displayed before question prompts.
  12. exports.notes = ' _Project title_ should be a human-readable title.';
  13. // Template-specific notes to be displayed after question prompts.
  14. exports.after = 'You should now install project dependencies with _bower install_.' +
  15. ' Afterwards, start the development server with _./bower_components/amber/bin/amber serve_.' +
  16. ' Your application is then accessible via _http://localhost:4000/_';
  17. // Any existing file or directory matching this wildcard will cause a warning.
  18. exports.warnOn = '*';
  19. // The actual init template.
  20. exports.template = function(grunt, init, done) {
  21. init.process({type: 'amber'}, [
  22. // Prompt for these values.
  23. init.prompt('name', 'AmberApplication'),
  24. init.prompt('title'),
  25. init.prompt('description', 'Amber Application.'),
  26. {
  27. name: 'namespace',
  28. message: 'The namespace used to store your Amber Packages.',
  29. },
  30. {
  31. name: 'amber_version',
  32. default: '>= 0.12.4',
  33. message: 'The version of Amber to use. Must be >= 0.12.4',
  34. },
  35. init.prompt('version'),
  36. init.prompt('repository'),
  37. init.prompt('homepage'),
  38. init.prompt('bugs'),
  39. init.prompt('licenses', 'MIT'),
  40. init.prompt('author_name'),
  41. init.prompt('author_email'),
  42. init.prompt('author_url')
  43. ], function(err, props) {
  44. // A few additional properties.
  45. props.amberjson = props.name + '.amber.json';
  46. props.dependencies = {'amber': '~0.10.0'};
  47. props.keywords = ['Amber', 'Smalltalk'];
  48. //props.devDependencies = {'amber': '~0.10.0'};
  49. props.node_version = '>= 0.8.0';
  50. // Files to copy (and process).
  51. var files = init.filesToCopy(props);
  52. // Add properly-named license files.
  53. init.addLicenseFiles(files, props.licenses);
  54. // Actually copy (and process) files.
  55. init.copyAndProcess(files, props, {noProcess: 'libs/**'});
  56. // Generate package.json file, used by npm and grunt.
  57. //init.writePackageJSON('package.json', props);
  58. // generate bower.json file
  59. grunt.file.write('bower.json', JSON.stringify({
  60. "name": props.name,
  61. "description": props.description,
  62. "version": props.version,
  63. "authors": [
  64. {
  65. "name": props.author_name,
  66. "email": props.author_email
  67. }
  68. ],
  69. "homepage": props.homepage,
  70. "main": props.main,
  71. "keywords": props.keywords,
  72. "license": props.licenses,
  73. "private": false,
  74. "dependencies": {
  75. "amber": "~" + props.amber_version
  76. }
  77. }, null, 4));
  78. // All done!
  79. done();
  80. });
  81. };