commands: Add noChmod option to disable perm sync

Includes updates to docs.

Fixes #2749
This commit is contained in:
Cameron Moore 2016-11-29 22:52:52 -06:00 committed by Bjørn Erik Pedersen
parent a4b9abf0b3
commit 971d1baf13
6 changed files with 59 additions and 37 deletions

View file

@ -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().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("forceSyncStatic", "", false, "Copy all files when static is changed.")
cmd.Flags().BoolP("noTimes", "", false, "Don't sync modification time of files") 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") cmd.Flags().BoolVarP(&tpl.Logi18nWarnings, "i18n-warnings", "", false, "Print missing translations")
// Set bash-completion. // Set bash-completion.
@ -387,6 +388,7 @@ func initializeFlags(cmd *cobra.Command) {
"ignoreCache", "ignoreCache",
"forceSyncStatic", "forceSyncStatic",
"noTimes", "noTimes",
"noChmod",
} }
for _, key := range persFlagKeys { for _, key := range persFlagKeys {
@ -518,6 +520,7 @@ func copyStatic() error {
syncer := fsync.NewSyncer() syncer := fsync.NewSyncer()
syncer.NoTimes = viper.GetBool("noTimes") syncer.NoTimes = viper.GetBool("noTimes")
syncer.NoChmod = viper.GetBool("noChmod")
syncer.SrcFs = staticSourceFs syncer.SrcFs = staticSourceFs
syncer.DestFs = hugofs.Destination() syncer.DestFs = hugofs.Destination()
// Now that we are using a unionFs for the static directories // Now that we are using a unionFs for the static directories
@ -797,6 +800,7 @@ func NewWatcher(port int) error {
syncer := fsync.NewSyncer() syncer := fsync.NewSyncer()
syncer.NoTimes = viper.GetBool("noTimes") syncer.NoTimes = viper.GetBool("noTimes")
syncer.NoChmod = viper.GetBool("noChmod")
syncer.SrcFs = staticSourceFs syncer.SrcFs = staticSourceFs
syncer.DestFs = hugofs.Destination() syncer.DestFs = hugofs.Destination()

View file

@ -44,6 +44,7 @@ hugo
-l, --layoutDir string filesystem path to layout directory -l, --layoutDir string filesystem path to layout directory
--log Enable Logging --log Enable Logging
--logFile string Log File path (if set, logging enabled automatically) --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 --noTimes Don't sync modification time of files
--pluralizeListTitles Pluralize titles in lists using inflect (default true) --pluralizeListTitles Pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") --preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")

View file

@ -40,6 +40,7 @@ hugo benchmark
--ignoreCache Ignores the cache directory --ignoreCache Ignores the cache directory
-l, --layoutDir string filesystem path to layout directory -l, --layoutDir string filesystem path to layout directory
--memprofile string path/filename for the memory profile file --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 --noTimes Don't sync modification time of files
--pluralizeListTitles Pluralize titles in lists using inflect (default true) --pluralizeListTitles Pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") --preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")

View file

@ -52,6 +52,7 @@ hugo server
-l, --layoutDir string filesystem path to layout directory -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") --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 --memstats string log memory usage to this file
--noChmod Don't sync permission mode of files
--noTimes Don't sync modification time of files --noTimes Don't sync modification time of files
--pluralizeListTitles Pluralize titles in lists using inflect (default true) --pluralizeListTitles Pluralize titles in lists using inflect (default true)
-p, --port int port on which the server will listen (default 1313) -p, --port int port on which the server will listen (default 1313)

View file

@ -150,6 +150,8 @@ along with their current, default values:
# "yaml", "toml", "json" # "yaml", "toml", "json"
metaDataFormat: "toml" metaDataFormat: "toml"
newContentEditor: "" newContentEditor: ""
# Don't sync permission mode of files
noChmod: false
# Don't sync modification time of files # Don't sync modification time of files
noTimes: false noTimes: false
paginate: 10 paginate: 10

View file

@ -16,56 +16,69 @@ weight: 30
Make sure Hugo is in your `PATH` (or provide a path to it). Test this by: Make sure Hugo is in your `PATH` (or provide a path to it). Test this by:
{{< nohighlight >}}$ hugo help {{< 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: Usage:
hugo [flags] hugo [flags]
hugo [command] hugo [command]
Available Commands: Available Commands:
server Hugo runs its own webserver to render the files benchmark Benchmark Hugo by building a site a number of times.
version Print the version number of Hugo config Print the site configuration
config Print the site configuration convert Convert your content to different formats
check Check content in the source directory env Print Hugo version and environment info
benchmark Benchmark hugo by building a site a number of times gen A collection of several useful generators.
new Create new content for your site import Import your site from others.
undraft Undraft changes the content's draft status from 'True' to 'False' list Listing out various types of content
genautocomplete Generate shell autocompletion script for Hugo new Create new content for your site
gendoc Generate Markdown documentation for the Hugo CLI. server A high performance webserver
help Help about any command undraft Undraft changes the content's draft status from 'True' to 'False'
version Print the version number of Hugo
Flags: Flags:
-b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ -b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
-D, --buildDrafts=false: include content marked as draft -D, --buildDrafts include content marked as draft
-F, --buildFuture=false: include content with publishdate in the future -E, --buildExpired include expired content
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ -F, --buildFuture include content with publishdate in the future
--config="": config file (default is path/config.yaml|json|toml) --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
-d, --destination="": filesystem path to write files to --canonifyURLs if true, all relative URLs will be canonicalized using baseURL
--disableRSS=false: Do not build RSS files --cleanDestinationDir Remove files from destination not found in static directories
--disableSitemap=false: Do not build Sitemap file --config string config file (default is path/config.yaml|json|toml)
--editor="": edit new content with this editor, if provided -c, --contentDir string filesystem path to content directory
-h, --help=false: help for hugo -d, --destination string filesystem path to write files to
--ignoreCache=false: Ignores the cache directory --disable404 Do not render 404 page
--log=false: Enable Logging --disableRSS Do not build RSS files
--logFile="": Log File path (if set, logging enabled automatically) --disableSitemap Do not build Sitemap file
--noTimes=false: Don't sync modification time of files --enableGitInfo Add Git revision, date and author info to the pages
--pluralizeListTitles=true: Pluralize titles in lists using inflect --forceSyncStatic Copy all files when static is changed.
-s, --source="": filesystem path to read files relative from --i18n-warnings Print missing translations
--stepAnalysis=false: display memory and timing of different steps of the program --ignoreCache Ignores the cache directory
-t, --theme="": theme to use (located in /themes/THEMENAME/) -l, --layoutDir string filesystem path to layout directory
--uglyURLs=false: if true, use /filename.html instead of /filename/ --log Enable Logging
-v, --verbose=false: verbose output --logFile string Log File path (if set, logging enabled automatically)
--verboseLog=false: verbose logging --noChmod Don't sync permission mode of files
-w, --watch=false: watch filesystem for changes and recreate as needed --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: 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 >}} {{< /nohighlight >}}
## Common Usage Example ## Common Usage Example