Exemple #1
0
func copyStatic() error {
	staticDir := helpers.AbsPathify(viper.GetString("StaticDir")) + "/"
	if _, err := os.Stat(staticDir); os.IsNotExist(err) {
		jww.ERROR.Println("Unable to find Static Directory:", viper.GetString("theme"), "in", staticDir)
		return nil
	}

	publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + "/"

	if themeSet() {
		themeDir := helpers.AbsPathify("themes/"+viper.GetString("theme")) + "/static/"
		if _, err := os.Stat(themeDir); os.IsNotExist(err) {
			jww.ERROR.Println("Unable to find static directory for theme :", viper.GetString("theme"), "in", themeDir)
			return nil
		}

		// Copy Static to Destination
		jww.INFO.Println("syncing from", themeDir, "to", publishDir)
		utils.CheckErr(fsync.Sync(publishDir, themeDir), fmt.Sprintf("Error copying static files of theme to %s", publishDir))
	}

	// Copy Static to Destination
	jww.INFO.Println("syncing from", staticDir, "to", publishDir)
	return fsync.Sync(publishDir, staticDir)
}
Exemple #2
0
func (c *SnapshotCommand) Run(k *kingpin.ParseContext) error {
	// Load up the cache configuration,
	caches, err := NewCache(c.File, c.Directory)
	if err != nil {
		Exit(err.Error())
	}

	for _, cs := range caches {
		// Check the cache directory exists.
		if !cs.DirectoryExists {
			fmt.Printf("Cannot find directory to snapshot: %s\n", cs.Directory)
			continue
		}

		// Remove the target directory.
		os.RemoveAll(cs.CachedDir)
		os.MkdirAll(cs.CachedDir, 0777)

		// Copy our cache into the new directory.
		err := fsync.Sync(cs.CachedDir, cs.Directory)
		if err != nil {
			fmt.Printf("Failed to snapshot %s from directory: %s\n", cs.Directory, err.Error())
		} else {
			fmt.Printf("Successfully snapshotted: %s\n", cs.Directory)
		}
	}

	return nil
}
Exemple #3
0
func copyStatic() error {
	staticDir := Config.GetAbsPath(Config.StaticDir + "/")
	if _, err := os.Stat(staticDir); os.IsNotExist(err) {
		return nil
	}

	// Copy Static to Destination
	return fsync.Sync(Config.GetAbsPath(Config.PublishDir+"/"), Config.GetAbsPath(Config.StaticDir+"/"))
}
Exemple #4
0
func copyStatic() error {
	staticDir := helpers.AbsPathify(viper.GetString("StaticDir")) + "/"
	if _, err := os.Stat(staticDir); os.IsNotExist(err) {
		return nil
	}

	publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + "/"
	// Copy Static to Destination
	jww.INFO.Println("syncing from", staticDir, "to", publishDir)
	return fsync.Sync(publishDir, staticDir)
}
Exemple #5
0
func copyStatic() error {
	// Copy Static to Destination
	return fsync.Sync(Config.GetAbsPath(Config.PublishDir+"/"), Config.GetAbsPath(Config.StaticDir+"/"))
}
Exemple #6
0
func copyStatic(config *hugolib.Config) error {
	// Copy Static to Destination
	return fsync.Sync(config.GetAbsPath(config.PublishDir+"/"), config.GetAbsPath(config.StaticDir+"/"))
}