Sha256: 974d0956b68dec5691d230a633702540eaa79505e75294d5cf0338798c47fd68

Contents?: true

Size: 820 Bytes

Versions: 12

Compression:

Stored size: 820 Bytes

Contents

module RevealCK
  module Builders
    # Copy a listing of files from one location to another
    class CopyFilesTask < CreationTask
      attr_reader :file_listing, :output_dir

      def initialize(args)
        @file_listing = retrieve(:file_listing, args)
        @output_dir = retrieve(:output_dir, args)
        super
      end

      def setup
        file_listing.files.each do |file|
          analyze_file(file) unless File.directory?(file)
        end
      end

      def analyze_file(file)
        src_dir = Regexp.escape(file_listing.dir)
        dest = file.pathmap("%{^#{src_dir}/,#{output_dir}/}p")
        copy_file(file, dest)
        dest_dir = dest.pathmap('%d')
        create_directory(dest_dir)
        things_to_create.add(dest_dir)
        things_to_create.add(dest)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.9.2 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.9.1 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.9.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.8.1 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.8.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.7.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.6.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.5.1 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.5.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.4.0 lib/reveal-ck/builders/copy_files_task.rb
reveal-ck-3.3.1 lib/reveal-ck/builders/copy_files_task.rb