gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.08k stars 577 forks source link

Grifts generator #477

Closed paganotoni closed 7 years ago

paganotoni commented 7 years ago

It would be good to have a generator for grift tasks.

CLI:

$ buffalo g grift taskName

Would generate:

grifts/task_name.go

And contents of the grift task would be something like:


package grifts

import (
    . "github.com/markbates/grift/grift"
)

var _ = Desc("task_name", "TODO")
var _ = Add("task_name", func(c *Context) error {
    return nil
})

cc @markbates

markbates commented 7 years ago

I would also generate a Desc function as well.

package grifts

import (
    . "github.com/markbates/grift/grift"
)

var _ = Desc("task_name", "TODO")
var _ = Add("task_name", func(c *Context) error {
    return nil
})
markbates commented 7 years ago

Also, if the task name contains : we should use Namespace:

$ buffalo g grift a:b:c
package grifts

import (
    . "github.com/markbates/grift/grift"
)

var _ = Namespace("a", func() {
  Namespace("b", func() {
    Desc("c", "TODO")
    Add("c", func(c *Context) error {
    return nil
    })
  })
})
paganotoni commented 7 years ago

Nice!! i didn't know about namespaces in grift! thanks @markbates

markbates commented 7 years ago

@apaganobeleno that's because it only got merged in today! :) https://github.com/markbates/grift/pull/10

paganotoni commented 7 years ago

covered in #479