Sha256: b0d28050b54a6bf3ba815251f1e21fd4d3f3c338817039820adb4d4384ddc8bb

Contents?: true

Size: 1.32 KB

Versions: 37

Compression:

Stored size: 1.32 KB

Contents

require_relative "../files.rb"

class Array
  def sum ary
    ary.each do |one_element|
      self.push one_element
    end
    return self
  end
end


DOC_DATA = Hash.new

Dir.glob(File.join(File.dirname(__FILE__),"..","lib","procemon","**","*.{rb,ru}")).uniq.each do |one_file_path|

  comment = Array.new
  comment.push String.new

  File.open(File.expand_path(one_file_path)).read.split("\n").each do |one_line_per_file|

    if one_line_per_file =~ /\W* #/
      comment.push one_line_per_file.gsub(/\W*#/,"#")
    end

    if one_file_path == String.new
      comment.clear
    end

    if one_line_per_file =~ /\W*def\W/

      if DOC_DATA[one_file_path.split(File::Separator).last.split('.')[0]].nil?
        DOC_DATA[one_file_path.split(File::Separator).last.split('.')[0]]= Array.new
      end

      DOC_DATA[one_file_path.split(File::Separator).last.split('.')[0]].sum comment

      comment.clear
      comment.push String.new


      DOC_DATA[one_file_path.split(File::Separator).last.split('.')[0]].push one_line_per_file.gsub(/\W*def\W/,"")

    end

  end

end


END_DATA= Array.new
DOC_DATA.each do |key,value|
  END_DATA.push "\n\nin #{key.to_s.capitalize}"
  value.each do |one_element|
    END_DATA.push one_element
  end
end

File.new(File.expand_path(File.join(File.dirname(__FILE__),"test.txt")),"w").write END_DATA.join("\n")

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
procemon-0.4.2 scripts/doc_gen.rb
procemon-0.4.1 scripts/doc_gen.rb
procemon-0.4.0 scripts/doc_gen.rb
procemon-0.3.4 scripts/doc_gen.rb
procemon-0.3.3 scripts/doc_gen.rb
procemon-0.3.2 scripts/doc_gen.rb
procemon-0.3.1 scripts/doc_gen.rb
procemon-0.2.0 scripts/doc_gen.rb
procemon-0.1.5 scripts/doc_gen.rb
procemon-0.1.4 scripts/doc_gen.rb
procemon-0.1.3 scripts/doc_gen.rb
procemon-0.1.1 scripts/doc_gen.rb
procemon-0.0.9 scripts/doc_gen.rb
procemon-0.0.8 scripts/doc_gen.rb
procemon-0.0.7 scripts/doc_gen.rb
procemon-0.0.6 scripts/doc_gen.rb
procemon-0.0.5 scripts/doc_gen.rb