My goal is to copy the set of files specified by the template to the destination directory. Files in the source directory may have sub-folders.
I tried:
cp_r(Dir.glob('**/*.html'), @target_dir):
and
cp_r(FileList['**/*.html'], @target_dir):
but does not work.
it only works when I do something like:
cp_r(Dir['.'], @target_dir):
But I only need to copy the * .html files.
I need what
cp --parents
Team executes
Any tips using existing Ruby / Rake methods?
UPDATE It seems that it is easier to do with Ant, it is not possible using the Ruby / Rake stack - maybe I will need to learn something else. I do not want to write my own code to make it work in Ruby. I just thought of Ruby / Rake as a suitable solution for this.
UPDATE 2 Here's how I do it with Ant
<target name="buildeweb" description="Builds web site" depends="clean"> <mkdir dir="${build.dir.web}" /> <copy todir="${build.dir.web}" verbose="true"> <fileset dir="${source.dir.web}"> <include name="**/*.html" /> <include name="**/*.htm" /> </fileset> </copy> <chmod perm="a+x"> <fileset dir="${build.dir.web}"> <include name="**/*.html" /> <include name="**/*.htm" /> </fileset> </chmod> </target>
Vladimir
source share