Example #1
0
func deploy() {
	// fetch all go dependencies
	if nil != settings.Dependencies {
		golang.FetchDependencies(*settings.Dependencies)
	}

	if nil != settings.ClosureArtifacts {
		err := closure.Regenerate(filepath.Join(workingDir, *settings.StaticDir),
			func(base string) error {
				return closure.GenerateTemplates(base,
					filepath.Join(base, settings.ClosureArtifacts.ArtifactDir),
					settings.ClosureArtifacts.Templates)
			},
			func(base string) error {
				if nil != settings.ClosureArtifacts.CSS {
					closure.ProcessCSSMulti(base, "CLOSURE",
						*settings.ClosureArtifacts.CSS)
				}
				return nil
			}, func(base string) error {
				if nil != settings.ClosureArtifacts.JS {
					closure.JSCompileMulti(base, revision,
						*settings.ClosureArtifacts.JS)
				}
				return nil
			})
		if nil != err {
			log.Fatalf("Error processing closure files.\nError: %s", err)
		}
	}

	appengine.Deploy(workingDir)
}
Example #2
0
func regen() {
	if nil == settings.ClosureArtifacts {
		log.Printf("No closure artifacts found in settings.json, skipping...")
		return
	}

	// regenerate all the closure related files.
	err := closure.Regenerate(filepath.Join(workingDir, *settings.StaticDir),
		func(base string) error {
			dir := filepath.Join(base,
				settings.ClosureArtifacts.ArtifactDir)
			log.Printf("Deleting old artifacts '%s'", dir)
			if err := os.RemoveAll(dir); nil != err {
				log.Fatalf("Unable to delete old artifacts. Error: %s", err)
			}
			log.Printf("Creating new artifact directory '%s'", dir)
			if err := os.MkdirAll(dir, 0755); nil != err {
				log.Fatalf("Unable to create new artifacts directory. Error: %s",
					err)
			}
			return nil
		},
		func(base string) error {
			return closure.GenerateTemplates(base,
				filepath.Join(base, settings.ClosureArtifacts.ArtifactDir),
				settings.ClosureArtifacts.Templates)
		},
		func(base string) error {
			if nil != settings.ClosureArtifacts.CSS {
				closure.ProcessCSSMulti(base, "NONE",
					*settings.ClosureArtifacts.CSS)
			}
			return nil
		}, func(base string) error {
			return closure.GenerateDeps(base,
				settings.ClosureArtifacts.Dependencies)
		})
	if nil != err {
		log.Fatalf("Error processing closure files.\nError: %s", err)
	}
}