Exemple #1
0
func GoAddDep(dependency string) {
	ago.Import("github.com/droundy/goadmin/gomakefile")
	ago.Declare("var changed_files = make(map[string]bool)")
	ago.Declare("var this_file_changed = false")
	code := "this_file_changed, e = gomakefile.AddDep(" + strconv.Quote(dependency) + ")"
	code += fmt.Sprint("\n\tif this_file_changed { changed_files[`Makefile`] = true }")
	ago.Code(code)
}
Exemple #2
0
func (f *File) GoSet(which Field) {
	if which == 0 {
		return
	} // Nothing to set!
	ago.Import("github.com/droundy/goadmin/file")
	ago.Declare("var changed_files = make(map[string]bool)")
	ago.Declare("var file_changed = false")
	ago.Declare("var this_file_changed = false")
	ago.Declare("var myf file.File")
	code := "myf = file.File{file.StatData{" + strconv.Quote(f.Name) + ","
	code += fmt.Sprint(f.Uid, ",", f.Gid, ", 0", strconv.Itob(int(f.Perms), 8), ", file.IsFile},")
	if Contents&which != 0 {
		code += strconv.Quote(f.Contents) + "}"
	} else {
		code += `""}`
	}
	code += fmt.Sprint("\n\tthis_file_changed, e = myf.Set(", which, ")")
	code += fmt.Sprint("\n\tif e != nil { fmt.Println(`Trouble setting", f.Name, ":`,e); return }")
	code += fmt.Sprint("\n\tif this_file_changed { changed_files[`", f.Name, "`] = true }")
	code += fmt.Sprint("\n\tfile_changed = file_changed || this_file_changed")
	ago.Code(code)
}
Exemple #3
0
func (f *Directory) GoSet(which Field) {
	if which == 0 {
		return
	} // Nothing to set!
	ago.Import("github.com/droundy/goadmin/file")
	ago.Declare("var changed_files = make(map[string]bool)")
	ago.Declare("var file_changed = false")
	ago.Declare("var this_file_changed = false")
	ago.Declare("var myd file.Directory")
	code := "myd = file.Directory{file.StatData{" + strconv.Quote(f.Name) + ","
	code += fmt.Sprint(f.Uid, ",", f.Gid, ", 0", strconv.Itob(int(f.Perms), 8), ", file.IsFile},")
	code += `map[string]file.StatEntry{}}`
	code += fmt.Sprint("\n\tthis_file_changed, e = myd.Set(", which, ")")
	code += fmt.Sprint("\n\tif e != nil { return }")
	code += fmt.Sprint("\n\tif this_file_changed { changed_files[`", f.Name, "`] = true }")
	code += fmt.Sprint("\n\tfile_changed = file_changed || this_file_changed")
	ago.Code(code)
	if Contents&which != 0 {
		for _, x := range f.Contents {
			x.GoSet(which)
		}
	}
}