Method: Doc::Configurator::Paths#tasks

Defined in:
lib/doc/configurator/paths.rb

#tasksObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/doc/configurator/paths.rb', line 52

def tasks
  @path_pairs.map do |pair|
    path, unexpanded_path = pair
    unexpanded_path ||= path
    Dir.chdir(path) do
      paths = nil
      if @file_list
        file_list = FileList.new
        case @file_list
        when Proc
          @file_list.call(file_list)
        when Array
          @file_list.each do |rule|
            file_list.send(rule[0, 1] == '+' ? :include : :exclude, rule[1..-1])
          end
        end
      end

      main = nil
      if @main
        @main.each do |main|
          break if main = Dir[main].first
        end
      end

      builder({
        :title => @title ? @title[unexpanded_path].to_s : "path #{unexpanded_path}",
        :source_dir => path,
        :dir_name => "path.#{unexpanded_path.to_s.gsub('_', '').gsub('/', '_').gsub(/[^a-z0-9\-_]/i, '-')}.#{Digest::SHA1.hexdigest(path.to_s)}",
        :paths => file_list,
        :main => main,
      })
    end
  end
end