Implemented rake-based simplified assets management.
h3rald h3rald@h3rald.com
Wed, 05 Aug 2009 13:31:10 +0200
31 files changed,
33 insertions(+),
6 deletions(-)
jump to
A
README.textile
@@ -0,0 +1,5 @@
+h2. Dependencies + +The following ruby gems are required to compile the site: +* nanoc +* extlib
A
tasks/copy_files.rake
@@ -0,0 +1,26 @@
+require 'extlib' +require 'pathname' +require 'fileutils' + + + +task :copy_files do + pwd = Pathname.new Dir.pwd + file_dirs = [Pathname.new(pwd/'files/images'), + Pathname.new(pwd/'files/js'), + Pathname.new(pwd/'files/css')] + file_dirs.each do |d| + d.find do |src| + if src.file? then + rel_path = src.relative_path_from(pwd/'files').to_s + dst = Pathname.new(pwd/"output/#{rel_path}") + if !dst.exist? || dst.exist? && !FileUtils.cmp(dst.to_s, src.to_s) then + dst.parent.mkpath + FileUtils.cp src.to_s, dst.to_s + puts "Copied '#{src}'." + end + end + end + end + +end
D
tasks/default.rake
@@ -1,3 +0,0 @@
-task :example do - puts 'This is an example rake task in tasks/default.rake.' -end