From 658e80e0db9f0dcc5af054a69fbe2f66934a64d1 Mon Sep 17 00:00:00 2001 From: Mike McNeil Date: Sat, 11 Jan 2014 23:04:09 -0600 Subject: [PATCH] Initial commit --- .gitignore | 15 +++++++++ CONTRIBUTING.md | 25 +++++++++++++++ FAQ.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.md | 20 ++++++++++++ README.md | 35 +++++++++++++++++++++ index.js | 41 +++++++++++++++++++++++++ package.json | 19 ++++++++++++ 7 files changed, 236 insertions(+) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 FAQ.md create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a72b52e --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a59da53 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# Contributing to `sails-generate-backend` + + +## Opening Issues + +Please observe the same conventions as you would opening issues in the main Sails repo. + +See [Opening Issues](https://github.com/balderdashy/sails/blob/master/CONTRIBUTING.md#opening-issues) for more information. + + + +## Submitting Pull Requests + +Please observe the same conventions as you would submitting pull requests to the Sails core. + +See [Submitting Pull Requests](https://github.com/balderdashy/sails/blob/master/CONTRIBUTING.md#submitting-pull-requests). + + + +## Need more help? + +Please see the [contribution guide](https://github.com/balderdashy/sails/blob/v0.10/CONTRIBUTING.md#contributing-to-a-generator) in the Sails repo for more general guidelines. + + +[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/8acf2fc2ca0aca8a3018e355ad776ed7 "githalytics.com")](http://githalytics.com/balderdashy/sails-generate-backend/CONTRIBUTING.md) \ No newline at end of file diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000..f102e05 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,81 @@ +# FAQ (Frequently Asked Questions) + + +### Which version should I use? + +The latest stable version in npm is always a safe bet. + +```sh +$ npm install sails-generate-backend +``` + +[![NPM](https://nodei.co/npm/.png?downloads=true&stars=true)](https://nodei.co/npm/sails-generate-backend/) + + + +### Where is the documentation? ++ Documentation for this module is in the README.md file. ++ [Docs for the latest stable npm release of Sails are on the website](http://sailsjs.org/#!documentation) + + + +### What is a generator? + +A generator is one of the three main types of Sails plugins. It allows you to extend or override a generator in the Sails command-line interface (i.e. when a user runs `sails new` and/or `sails generate`. + +Out of all the types of plugins, generators involve the fewest lines of code, and are probably the best way to get your hands dirty without getting buried. + + +### What kind of things can I do in a generator? + +Generators are mainly about creating files. There are built-in helpers for: + ++ creating folders ++ copying files ++ EJS template ++ running other generators + + + +### How do I get involved? + ++ [Contributing to this module](./CONTRIBUTING.md) ++ If you find a bug with this module, please submit an issue to the tracker in this repository. Better yet, send a pull request :) + + +### Where do I get help? + ++ [Ask a question on StackOverflow](http://stackoverflow.com/questions/tagged/sailsjs?sort=newest&days=30) ++ Get help from the [Google Group](https://groups.google.com/forum/#!forum/sailsjs) ++ Get help on IRC ([#sailsjs on freenode](http://irc.netsplit.de/channels/details.php?room=%23sailsjs&net=freenode)) ++ [Tweet @sailsjs](http://twitter.com/sailsjs) + + +### Why haven't I gotten a response to my feature request? + +When people see something working in practice, they're usually a lot more down to get on board with it! That's even more true in the open-source community, since most of us are not getting paid to do this (myself included). The best feature request is a pull request-- even if you can't do the whole thing yourself, if you blueprint your thoughts, it'll help everyone understand what's going on. + +### I want to make a sweeping change / add a major feature +It's always a good idea to contact the maintainer(s) of a module before doing a bunch of work. This is even more true when it affects how things work / breaks backwards compatibility. + +### The maintainer of this module won't merge my pull request. + +Most of the time, when PRs don't get merged, a scarcity of time is to blame. I can almost guarantee you it's nothing personal :) And I can only speak for myself here, but in most cases, when someone follows up on a PR that's been sitting for a little while on Twitter, I don't mind the reminder at all. + +The best thing about maintaining lots of small modules is that it's trivial to override any one of them on their own. If you need some changes merged, please feel empowered to fork this model and release your own version. + +If you feel that yours is the better approach, and should be the default, share it with the community via IRC, Twitter, Google Groups, etc. Also, feel free to let the core Sails/Waterline team know and we'll take it into consideration. + + + +### More questions? + +> If you have an unanswered question that isn't covered here, and that you feel would add value for the community, please feel free to send a PR adding it to this section. + + + + + + + +[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/8acf2fc2ca0aca8a3018e355ad776ed7 "githalytics.com")](http://githalytics.com/balderdashy/sails-generate-backend/FAQ.md) diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..f3db92e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 a Node.js/Sails.js Contributor & contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0475854 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# sails-generate-backend + +A generator for Sails.js. + + +## Usage + +#### On the command line + +```sh +sails generate sails-generate-backend +``` + +#### In a node script + +```javascript +var generate = require('sails-generate'); +var scope = {}; +generate(require('sails-generate-backend'), scope, function (err) { + if (err) throw err; + + // Log output available in `scope` for your enjoyment: + console.log(scope); +}); +``` + + +## Contributing to this generator + +See `CONTRIBUTING.md`. + +## License + +See `LICENSE.md`. + diff --git a/index.js b/index.js new file mode 100644 index 0000000..57051b6 --- /dev/null +++ b/index.js @@ -0,0 +1,41 @@ +/** + * sails-generate-backend + * + * Usage: + * `sails-generate-backend` + * + * @type {Object} + */ +module.exports = { + targets: { + './:arg0': { exec: function (scope, cb) { + scope.output.push('Running generator (sails-generate-backend) @ `'+scope.rootPath+'`...'); + cb(); + } } + } +}; + + +// Generator syntax: +// +// You can use params in your target paths: +// { +// './:someScopeVariable/somethingStatic/:somethingDynamicAgain': '...' +// } + +// Other directives: +// +// +// Generate a folder: (`folder`) +// './:arg0/controllers': { folder: {} } +// +// Copy a file : (`copy`) +// './:arg0/someTemplate.foo': { copy: path.resolve(__dirname, './someTemplate.foo') }, +// +// Render an EJS template: (`ejs`) +// (note: the template doesn't have to end in *.ejs) +// './:arg0/someTemplate.ejs': { ejs: path.resolve(__dirname, './someTemplate.ejs') }, +// +// Run another generator: +// './:arg0/controllers/:controllerName.js': 'controller' +// \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..99af4a5 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "sails-generate-backend", + "version": "0.0.0", + "description": "Generate a backend for Sails.", + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "keywords": [ + "backend", + "generator", + "sails", + "generate", + "plugin" + ], + "author": "a Node.js/Sails.js Contributor", + "license": "MIT", + "dependencies": {} +}