Skip to content

Commit 0c13574

Browse files
committed
Ruby file and extracted temporary filenames match
The embeded template evaluation ruby code had been extracted to disk as `erb_render.rb`, this commit changes that to a (more) conventional `erb_render.rb`, and updates the name of the Ruby file `go:embed`'d into the binary to match this naming.
1 parent 431fdbd commit 0c13574

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

templatescompiler/erbrenderer/erb_renderer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
boshsys "github.com/cloudfoundry/bosh-utils/system"
1111
)
1212

13-
//go:embed template_evaluation_context.rb
13+
//go:embed erb_renderer.rb
1414
var templateEvaluationContextRb string
1515

1616
type ERBRenderer interface {
@@ -59,7 +59,7 @@ func (r erbRenderer) Render(srcPath, dstPath string, context TemplateEvaluationC
5959
}
6060
}()
6161

62-
rendererScriptPath := filepath.Join(tmpDir, "erb_render.rb")
62+
rendererScriptPath := filepath.Join(tmpDir, "erb_renderer.rb")
6363
err = r.writeRendererScript(rendererScriptPath)
6464
if err != nil {
6565
return err
File renamed without changes.

templatescompiler/erbrenderer/erb_renderer_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ property3: default_value3
119119

120120
Describe("error handling within Ruby", func() {
121121
var (
122-
// see template_evaluation_context.rb
122+
// see erb_renderer.rb
123123
rubyExceptionPrefixTemplate = "Error filling in template '%s' "
124124
)
125125

@@ -152,7 +152,8 @@ property3: default_value3
152152
It("returns an error with a known ruby exception", func() {
153153
err := erbRenderer.Render(erbTemplateFilepath, renderedTemplatePath, &testTemplateEvaluationContext{})
154154
Expect(err).To(HaveOccurred())
155-
Expect(err.Error()).To(ContainSubstring("undefined method `recursive_merge!'"))
155+
Expect(err.Error()).To(ContainSubstring("NoMethodError"))
156+
Expect(err.Error()).To(ContainSubstring("recursive_merge!"))
156157
Expect(err.Error()).To(ContainSubstring(fmt.Sprintf(rubyExceptionPrefixTemplate, erbTemplateFilepath)))
157158
})
158159
})
@@ -245,7 +246,7 @@ property3: default_value3
245246
Expect(fakeRunner.RunComplexCommandCallCount()).To(Equal(1))
246247
command := fakeRunner.RunComplexCommandArgsForCall(0)
247248
Expect(command.Name).To(Equal("ruby"))
248-
Expect(command.Args[0]).To(MatchRegexp("/erb_render\\.rb$"))
249+
Expect(command.Args[0]).To(MatchRegexp("/erb_renderer\\.rb$"))
249250
Expect(command.Args[1]).To(MatchRegexp("/erb-context\\.json$"))
250251
Expect(command.Args[2]).To(Equal(erbTemplateFilepath))
251252
Expect(command.Args[3]).To(Equal(renderedTemplatePath))

0 commit comments

Comments
 (0)