Sha256: 21b234e7a9016e6d1190fb35d90edcff3e90934f7e35d2384738bd2663e3d0fc

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

require 'find'
 
module TextileToolbar
  class Assets
    @source = File.expand_path(File.join(File.dirname(__FILE__), '..', 'files'))
    @destination = RAILS_ROOT
    class << self 
      attr_accessor :source, :destination
    end
    
    def self.install
      paths = []
      Find.find(source) do |path|
        Find.prune if path =~ /\/\..+/
        Find.prune if path =~ /CVS/
        paths << path
      end
      paths.each do |path| 
        dest_path = path.gsub(source, destination)
        if File.directory?(path)
          FileUtils.mkdir_p(dest_path) unless File.exists?(dest_path)
        else
          FileUtils.cp(path, dest_path)
        end
      end
    rescue Exception => e
      puts "Error trying to copy files: #{e.inspect}"
      raise e
    end
    
  end  
end
 
namespace :textile_toolbar do
  desc "Install files required by textile_toolbar"
  task :install_files do  
    TextileToolbar::Assets.install
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pelargir-textile_toolbar-0.5 tasks/textile_toolbar.rake