From 971d1baf1393c07081607bd62a87da545d9cb34e Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Tue, 29 Nov 2016 22:52:52 -0600 Subject: [PATCH] commands: Add noChmod option to disable perm sync Includes updates to docs. Fixes #2749 --- commands/hugo.go | 4 ++ docs/content/commands/hugo.md | 1 + docs/content/commands/hugo_benchmark.md | 1 + docs/content/commands/hugo_server.md | 1 + docs/content/overview/configuration.md | 2 + docs/content/overview/usage.md | 87 ++++++++++++++----------- 6 files changed, 59 insertions(+), 37 deletions(-) diff --git a/commands/hugo.go b/commands/hugo.go index 72296fd32..f5f5ef462 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -229,6 +229,7 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) { cmd.Flags().Bool("preserveTaxonomyNames", false, `Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")`) cmd.Flags().BoolP("forceSyncStatic", "", false, "Copy all files when static is changed.") cmd.Flags().BoolP("noTimes", "", false, "Don't sync modification time of files") + cmd.Flags().BoolP("noChmod", "", false, "Don't sync permission mode of files") cmd.Flags().BoolVarP(&tpl.Logi18nWarnings, "i18n-warnings", "", false, "Print missing translations") // Set bash-completion. @@ -387,6 +388,7 @@ func initializeFlags(cmd *cobra.Command) { "ignoreCache", "forceSyncStatic", "noTimes", + "noChmod", } for _, key := range persFlagKeys { @@ -518,6 +520,7 @@ func copyStatic() error { syncer := fsync.NewSyncer() syncer.NoTimes = viper.GetBool("noTimes") + syncer.NoChmod = viper.GetBool("noChmod") syncer.SrcFs = staticSourceFs syncer.DestFs = hugofs.Destination() // Now that we are using a unionFs for the static directories @@ -797,6 +800,7 @@ func NewWatcher(port int) error { syncer := fsync.NewSyncer() syncer.NoTimes = viper.GetBool("noTimes") + syncer.NoChmod = viper.GetBool("noChmod") syncer.SrcFs = staticSourceFs syncer.DestFs = hugofs.Destination() diff --git a/docs/content/commands/hugo.md b/docs/content/commands/hugo.md index 8393679e7..ea367488b 100644 --- a/docs/content/commands/hugo.md +++ b/docs/content/commands/hugo.md @@ -44,6 +44,7 @@ hugo -l, --layoutDir string filesystem path to layout directory --log Enable Logging --logFile string Log File path (if set, logging enabled automatically) + --noChmod Don't sync permission mode of files --noTimes Don't sync modification time of files --pluralizeListTitles Pluralize titles in lists using inflect (default true) --preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") diff --git a/docs/content/commands/hugo_benchmark.md b/docs/content/commands/hugo_benchmark.md index d10405382..f5a9d0e7e 100644 --- a/docs/content/commands/hugo_benchmark.md +++ b/docs/content/commands/hugo_benchmark.md @@ -40,6 +40,7 @@ hugo benchmark --ignoreCache Ignores the cache directory -l, --layoutDir string filesystem path to layout directory --memprofile string path/filename for the memory profile file + --noChmod Don't sync permission mode of files --noTimes Don't sync modification time of files --pluralizeListTitles Pluralize titles in lists using inflect (default true) --preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") diff --git a/docs/content/commands/hugo_server.md b/docs/content/commands/hugo_server.md index 764c74513..8901398da 100644 --- a/docs/content/commands/hugo_server.md +++ b/docs/content/commands/hugo_server.md @@ -52,6 +52,7 @@ hugo server -l, --layoutDir string filesystem path to layout directory --meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms") --memstats string log memory usage to this file + --noChmod Don't sync permission mode of files --noTimes Don't sync modification time of files --pluralizeListTitles Pluralize titles in lists using inflect (default true) -p, --port int port on which the server will listen (default 1313) diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md index fb92621d5..12a0f6797 100644 --- a/docs/content/overview/configuration.md +++ b/docs/content/overview/configuration.md @@ -150,6 +150,8 @@ along with their current, default values: # "yaml", "toml", "json" metaDataFormat: "toml" newContentEditor: "" + # Don't sync permission mode of files + noChmod: false # Don't sync modification time of files noTimes: false paginate: 10 diff --git a/docs/content/overview/usage.md b/docs/content/overview/usage.md index 75a874eb3..35479aee6 100644 --- a/docs/content/overview/usage.md +++ b/docs/content/overview/usage.md @@ -16,56 +16,69 @@ weight: 30 Make sure Hugo is in your `PATH` (or provide a path to it). Test this by: {{< nohighlight >}}$ hugo help +hugo is the main command, used to build your Hugo site. -Hugo is a Fast and Flexible Static Site Generator built with love by spf13 and friends in Go. +Hugo is a Fast and Flexible Static Site Generator +built with love by spf13 and friends in Go. -Complete documentation is available at http://gohugo.io +Complete documentation is available at http://gohugo.io/. Usage: hugo [flags] hugo [command] Available Commands: - server Hugo runs its own webserver to render the files - version Print the version number of Hugo - config Print the site configuration - check Check content in the source directory - benchmark Benchmark hugo by building a site a number of times - new Create new content for your site - undraft Undraft changes the content's draft status from 'True' to 'False' - genautocomplete Generate shell autocompletion script for Hugo - gendoc Generate Markdown documentation for the Hugo CLI. - help Help about any command + benchmark Benchmark Hugo by building a site a number of times. + config Print the site configuration + convert Convert your content to different formats + env Print Hugo version and environment info + gen A collection of several useful generators. + import Import your site from others. + list Listing out various types of content + new Create new content for your site + server A high performance webserver + undraft Undraft changes the content's draft status from 'True' to 'False' + version Print the version number of Hugo Flags: - -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ - -D, --buildDrafts=false: include content marked as draft - -F, --buildFuture=false: include content with publishdate in the future - --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ - --config="": config file (default is path/config.yaml|json|toml) - -d, --destination="": filesystem path to write files to - --disableRSS=false: Do not build RSS files - --disableSitemap=false: Do not build Sitemap file - --editor="": edit new content with this editor, if provided - -h, --help=false: help for hugo - --ignoreCache=false: Ignores the cache directory - --log=false: Enable Logging - --logFile="": Log File path (if set, logging enabled automatically) - --noTimes=false: Don't sync modification time of files - --pluralizeListTitles=true: Pluralize titles in lists using inflect - -s, --source="": filesystem path to read files relative from - --stepAnalysis=false: display memory and timing of different steps of the program - -t, --theme="": theme to use (located in /themes/THEMENAME/) - --uglyURLs=false: if true, use /filename.html instead of /filename/ - -v, --verbose=false: verbose output - --verboseLog=false: verbose logging - -w, --watch=false: watch filesystem for changes and recreate as needed - + -b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/ + -D, --buildDrafts include content marked as draft + -E, --buildExpired include expired content + -F, --buildFuture include content with publishdate in the future + --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --canonifyURLs if true, all relative URLs will be canonicalized using baseURL + --cleanDestinationDir Remove files from destination not found in static directories + --config string config file (default is path/config.yaml|json|toml) + -c, --contentDir string filesystem path to content directory + -d, --destination string filesystem path to write files to + --disable404 Do not render 404 page + --disableRSS Do not build RSS files + --disableSitemap Do not build Sitemap file + --enableGitInfo Add Git revision, date and author info to the pages + --forceSyncStatic Copy all files when static is changed. + --i18n-warnings Print missing translations + --ignoreCache Ignores the cache directory + -l, --layoutDir string filesystem path to layout directory + --log Enable Logging + --logFile string Log File path (if set, logging enabled automatically) + --noChmod Don't sync permission mode of files + --noTimes Don't sync modification time of files + --pluralizeListTitles Pluralize titles in lists using inflect (default true) + --preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") + --quiet build in quiet mode + --renderToMemory render to memory (only useful for benchmark testing) + -s, --source string filesystem path to read files relative from + --stepAnalysis display memory and timing of different steps of the program + -t, --theme string theme to use (located in /themes/THEMENAME/) + --uglyURLs if true, use /filename.html instead of /filename/ + -v, --verbose verbose output + --verboseLog verbose logging + -w, --watch watch filesystem for changes and recreate as needed Additional help topics: - hugo convert Convert will modify your content to different formats hugo list Listing out various types of content + hugo check Contains some verification checks -Use "hugo help [command]" for more information about a command. +Use "hugo [command] --help" for more information about a command. {{< /nohighlight >}} ## Common Usage Example