func (f *factory) loadBuilderFactory() biinstancestate.BuilderFactory { if f.stateBuilderFactory != nil { return f.stateBuilderFactory } erbRenderer := bitemplateerb.NewERBRenderer(f.fs, f.loadCMDRunner(), f.logger) jobRenderer := bitemplate.NewJobRenderer(erbRenderer, f.fs, f.logger) jobListRenderer := bitemplate.NewJobListRenderer(jobRenderer, f.logger) sha1Calculator := bicrypto.NewSha1Calculator(f.fs) renderedJobListCompressor := bitemplate.NewRenderedJobListCompressor( f.fs, f.loadCompressor(), sha1Calculator, f.logger, ) f.stateBuilderFactory = biinstancestate.NewBuilderFactory( f.loadCompiledPackageRepo(), f.loadReleaseJobResolver(), jobListRenderer, renderedJobListCompressor, f.logger, ) return f.stateBuilderFactory }
func (c *installerFactoryContext) JobRenderer() JobRenderer { erbRenderer := bierbrenderer.NewERBRenderer(c.fs, c.runner, c.logger) jobRenderer := bitemplate.NewJobRenderer(erbRenderer, c.fs, c.logger) jobListRenderer := bitemplate.NewJobListRenderer(jobRenderer, c.logger) return NewJobRenderer( jobListRenderer, c.extractor, c.Blobstore(), ) }
Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(generatedJSON, &generatedContext) Expect(err).ToNot(HaveOccurred()) }) It("it has a network context section with empty IP", func() { Expect(generatedContext.NetworkContexts["default"].IP).To(Equal("")) }) var erbRenderer erbrenderer.ERBRenderer getValueFor := func(key string) string { logger := boshlog.NewLogger(boshlog.LevelNone) fs := boshsys.NewOsFileSystem(logger) commandRunner := boshsys.NewExecCmdRunner(logger) erbRenderer = erbrenderer.NewERBRenderer(fs, commandRunner, logger) srcFile, err := ioutil.TempFile("", "source.txt.erb") Expect(err).ToNot(HaveOccurred()) defer os.Remove(srcFile.Name()) erbContents := fmt.Sprintf("<%%= p('%s') %%>", key) _, err = srcFile.WriteString(erbContents) Expect(err).ToNot(HaveOccurred()) destFile, err := fs.TempFile("dest.txt") Expect(err).ToNot(HaveOccurred()) err = destFile.Close() Expect(err).ToNot(HaveOccurred()) defer os.Remove(destFile.Name())