示例#1
0
func run(c *cli.Context) {
	config, err := loadConfiguration(c)
	if err != nil {
		die("Couldn't load the inductor.json configuration file.", err)
	}
	opts, err := createRenderOpts(c, config)
	if err != nil {
		die(err)
	}
	outDir, err := outDir(c, config)
	if err != nil {
		die(err)
	}

	// find all templates
	cwd, err := os.Getwd()
	if err != nil {
		die(err)
	}
	templates := tpl.New(cwd, opts.OSName)

	// render all the templates to the output directory
	renderer := renderer.New(opts, outDir)
	err = renderer.Render(templates)
	if err != nil {
		die(err)
	}

	// copy over any non-templates to the output directory
	copier := cpy.New()
	err = copier.Copy(cwd, outDir)
	if err != nil {
		die(err)
	}
}
示例#2
0
		createTemplateFile(tmpDir, "nano/packer.json.provisioners.partial")
		createTemplateFile(tmpDir, "windowsxp/Autounattend.xml.template")
		createTemplateFile(tmpDir, "scripts/win-updates.ps1")
		createTemplateFile(tmpDir, "scripts/nano/SetupComplete.cmd")
		createTemplateFile(tmpDir, "inductor.json")
		createTemplateFile(tmpDir, "README.md")
		createTemplateFile(tmpDir, "Autounattend.xml.template")
		createTemplateFile(tmpDir, "Autounattend.xml.oobe.partial")
		createTemplateFile(tmpDir, "Autounattend.xml.disks.partial")
		createTemplateFile(tmpDir, "packer.json.template")
		createTemplateFile(tmpDir, "packer.json.builders.partial")
		createTemplateFile(tmpDir, "packer.json.provisioners.partial")
		createTemplateFile(tmpDir, "Vagrantfile.template")
	})
	JustBeforeEach(func() {
		templates = tpl.New(tmpDir, osName)
	})
	AfterEach(func() {
		os.RemoveAll(tmpDir)
	})

	Context("Windows2012r2", func() {
		BeforeEach(func() {
			osName = "windows2012r2"
		})
		Describe("Autounattend.xml.template root template", func() {
			var rootTemplate tpl.Templater
			JustBeforeEach(func() {
				rootTemplate = templates.FindTemplate(filepath.Join(tmpDir, "Autounattend.xml.template"))
			})
			It("should be found", func() {