Sha256: 3ef050e6670e39252f8188adfe1ae37ed0990c8ae7398cbe7ef4e4df4cfc2b54

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

#                                                                          
# File 'helpers.rb' created on 04 mag 2008 at 17:44:17.                    
#
# See 'dokkit.rb' or +LICENSE+ for licence information.                      
#                                                                          
# (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). 
#                                                                          

require 'ostruct'
require 'dokkit/environment/helpers/fileselection'
require 'dokkit/environment/helpers/extmap'

module Dokkit
  module Environment
    # Collect helper class that simplify the setup of
    # documentation environment.
    module Helper

      def configure(&blk)
        
        yield ostruct = OpenStruct.new        
        
        register :configuration do
          OpenStruct.new(default_configuration.merge(ostruct.marshal_dump))
        end
        
      end
      
      def select_document(&blk)
        
        yield new_fs = document_fs
                
        register :document_fs do
          FileSelection.new(configuration.document_dir) do |fs|
            fs.include(*new_fs.includes)
            fs.exclude(*new_fs.excludes)
          end
        end
        
      end

      def select_data(&blk)

        yield new_fs = data_fs

        register :data_fs do
          FileSelection.new(configuration.data_dir) do |fs|
            fs.include(*new_fs.includes)
            fs.exclude(*new_fs.excludes)
          end    
        end
        
      end

      def extend_document(glob, extension)
        FileSelection.new(configuration.document_dir).include(glob).files.each do |document_fn|
          @extmap[document_fn] = extension
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dokkit-0.5.0 lib/dokkit/environment/helpers.rb