all repos — h3rald @ 298c41157dff4ff23b2468d5bec5de12c499a494

The sources of https://h3rald.com

Implemented rake-based simplified assets management.
h3rald h3rald@h3rald.com
Wed, 05 Aug 2009 13:31:10 +0200
commit

298c41157dff4ff23b2468d5bec5de12c499a494

parent

bdc5538e007cdcac1df6fea4f967c634728e64b7

A README.textile

@@ -0,0 +1,5 @@

+h2. Dependencies + +The following ruby gems are required to compile the site: +* nanoc +* extlib
M RakefileRakefile

@@ -1,5 +1,4 @@

-Dir['tasks/**/*.rake'].sort.each { |rakefile| load rakefile } +Dir['tasks/**/*.rake'].sort.each { |rakefile| load rakefile; puts rakefile } -task :default do - puts 'This is an example rake task.' +task :default => [:copy_files] do end
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