Hello, I was wondering whether the CopyHandler plugin works with hidden files like .htaccess? I have an .htaccess under src/ and another one under src/code/, but they won''t be copied to output/. My config.yaml is: File/CopyHandler: paths: [''**/*.css'', ''**/*.js'', ''**/*.jpg'', ''**/*.png'', ''**/*.gif'', ''**/.htaccess''] I''ve tried to replace **/.htaccess with **/htaccess and rename every .htaccess file to htaccess (note the missing dot), and it worked, so my best guess is that CopyHandler doesn''t work properly with hidden files. Any ideas? Thanks in advance. -- Aggelos Orfanakos, http://agorf.gr/
Hi, On 23.11.2007, at 16:15, Aggelos Orfanakos wrote:> I was wondering whether the CopyHandler plugin works with hidden files > like .htaccess? I have an .htaccess under src/ and another one under > src/code/, but they won''t be copied to output/. My config.yaml is: > > File/CopyHandler: > paths: [''**/*.css'', ''**/*.js'', ''**/*.jpg'', ''**/*.png'', ''**/ > *.gif'', ''**/.htaccess''] > > I''ve tried to replace **/.htaccess with **/htaccess and rename every > .htaccess file to htaccess (note the missing dot), and it worked, > so my > best guess is that CopyHandler doesn''t work properly with hidden > files.Your File/CopyHandler:paths parameter is correctly set, however, when creating the list of all files in the src/ directory, hidden files (ie. files with a leading dot) are ignored. So no matter which pattern you use for the CopyHandler, it won''t work. If you use verbosity level 1, you should get a line that looks like this: INFO -- Not using these files for File/CopyHandler as they do not exist or are excluded: #<Set: {"/private/tmp/testsite/src/.htaccess"}> Not using files with a leading dot is not really bug since I decided to it this way. However, your counter example with .htaccess proves me wrong :) A quick fix would be to change the line 286 of lib/webgen/plugins/ filehandlers/filehandler.rb from files = Dir.glob( File.join( param( ''srcDir'', ''Core/ Configuration'' ), pattern ), File::FNM_CASEFOLD ).to_set to files = Dir.glob( File.join( param( ''srcDir'', ''Core/ Configuration'' ), pattern ), File::FNM_CASEFOLD | File::FNM_DOTMATCH ).to_set However, this leads to some quirks (not from a user''s point of view, everything just works fine), so I will think of a better way of integrating this functionality. Bye, Thomas
On Fri, 23 Nov 2007 20:42:23 +0200 Thomas Leitner wrote:> However, this leads to some quirks (not from a user''s point of view, > everything just works fine), so I will think of a better way of > integrating this functionality.Thanks, this works with .htaccess files. :-) There''s a side-effect though: it also copies my .svn dirs, although I haven''t added anything about svn dirs in my config.yaml. So, it copies everything hidden? Thanks, Aggelos -- Aggelos Orfanakos, http://agorf.gr/
On 23.11.2007, at 20:34, Aggelos Orfanakos wrote:> On Fri, 23 Nov 2007 20:42:23 +0200 Thomas Leitner wrote: >> However, this leads to some quirks (not from a user''s point of view, >> everything just works fine), so I will think of a better way of >> integrating this functionality. > > Thanks, this works with .htaccess files. :-) > > There''s a side-effect though: it also copies my .svn dirs, although I > haven''t added anything about svn dirs in my config.yaml. So, it copies > everything hidden?It should only copy the .svn directory and only the files in it which are matched by one of the file handler plugin patterns. This is one of the quirks I referred to. Just add the following to you config.yaml: Core/FileHandler: ignorePaths: ["**/CVS{/**/**,/}", "**/.svn{/**/**,/}"] This makes the Core/FileHandler simply ignore all .svn directories and all their contents. -- Thomas