require 'fileutils' puts "\n - Installing" cache_dir = "tmp/cache/gravatars" image_dir = "public/images/gravatars" # create caching directory if it does not already exist (or abort if privilege or path problems) puts "CREATING gravatar caching directory at '#{cache_dir}'" FileUtils.mkdir cache_dir unless File.exists?(cache_dir) # create symbolic link between public gravatar image directory and tmp cached gravatar directory puts "CREATING symbolic link (ln -s) to the gravatar cache #{image_dir}' -> '../../#{cache_dir}'" FileUtils.ln_s '../../'+cache_dir, image_dir, :force => true puts "\nDo you want to cache your gravatars now ? y or n\n" if gets.chomp == 'y' puts "\nOK, running rake task 'cache_gravatars' now ..." `rake cache_gravatars` end puts "\nINSTALL DONE - README ... here its comes ...\n" # show readme after installing puts IO.read(File.join(File.dirname(__FILE__), 'README'))