Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks #62

Closed
nporteschaikin opened this issue Mar 26, 2015 · 8 comments · Fixed by #64
Closed

Tasks #62

nporteschaikin opened this issue Mar 26, 2015 · 8 comments · Fixed by #64
Assignees
Milestone

Comments

@nporteschaikin
Copy link
Contributor

Here's my idea for "tasks" (e.g. generators):

  • An optional folder in a template called tasks.

  • On init, if the folder exists, drop a .sproutrc file in the target with the name of the template.

  • The tasks folder contains js files (the name of the task == the filename). Each JS file exports a function with an options argument (passed as separate args to the CLI) and a utils argument:

    module.exports = function (options, utils) {
      // do some ish
    }
  • To run a task, run sprout run <task> in the target directory:

    $ sprout run aTask

    sprout finds the template by the name in .sproutrc (if it can't be found, lists all your templates with readline/inquirer and lets you select/update .sproutrc).

@nporteschaikin
Copy link
Contributor Author

cc/ @kylemac @joshrowley

@nporteschaikin nporteschaikin added this to the 0.2.1 milestone Mar 26, 2015
@nporteschaikin nporteschaikin self-assigned this Mar 26, 2015
@joshrowley
Copy link
Contributor

sounds good to me. why .sproutrc and not just .sprout. also, how do you envision data being stored in that dotfile, is it just the template name, should we also give the template the ability to store other info in there?

@nporteschaikin
Copy link
Contributor Author

@joshrowley:

  • I like appending rc to make it clear it's a configuration file.
  • I think we may want to eventually store more information in there. I'll probably store it as json; for now, it'll only have a name key.

@kylemac
Copy link
Contributor

kylemac commented Mar 26, 2015

to clarify, tasks is the same thing as our generators concept, right? if so, i'm not sure i like the name tasks. also, we would need to pass options to the function as well. like if i ran $ sprout run model user

@nporteschaikin
Copy link
Contributor Author

Let's call 'em generators. And yes, each task should be passed an args argument. Updated above.

@kylemac
Copy link
Contributor

kylemac commented Mar 26, 2015

is there any other info that we need accessed by the generators, like target?

@nporteschaikin
Copy link
Contributor Author

@kylemac utils will give it everything it needs, like it does with the hooks.

@kylemac
Copy link
Contributor

kylemac commented Mar 26, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants