示例#1
0
func NewContext(gen scaffolt.Generator, target string, log *logrus.Entry) scaffolt.Context {
	return &context{
		target:    target,
		generator: gen,
		m:         dict.NewMap(),
		l:         log,
	}
}
示例#2
0
func (self *task) Run(ctx scaffolt.Context) error {
	ctx.Set(self.desc.Name, dict.NewMap())
	ctx = &taskContext{ctx, self.desc.Name}

	if err := self.runHook(Before, ctx); err != nil {
		return err
	}
	self.l.Printf("Running questions")
	if err := self.questions.Run(ctx); err != nil {
		return err
	}
	self.l.Printf("Running files")
	if err := self.runFiles(ctx); err != nil {
		return err
	}

	if err := self.runHook(After, ctx); err != nil {
		return err
	}

	return nil
}