Sha256: d2065bd26bd629728c674dde190df53a2223139fcd5fa90aacc01805c4e2a834
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require_relative 'bigfiles/source_code_finder' require_relative 'bigfiles/file_with_lines' # Simple tool to find the largest source files in your project. module BigFiles # Simple tool to find the largest source files in your project. class BigFiles def initialize(args, io: Kernel, exiter: Kernel, file_with_lines: FileWithLines, source_file_finder: SourceCodeFinder.new) @args = args @io = io @exiter = exiter @file_with_lines = file_with_lines @source_file_finder = source_file_finder end def usage @io.puts "USAGE: bigfiles [-n <top n files>]\n" @exiter.exit 1 end def find_analyze_and_report_on_files file_list = @source_file_finder.find files_with_lines = file_list.map do |filename| @file_with_lines.new(filename) end files_with_lines.sort.reverse[0..2].each do |file| @io.puts "#{file.num_lines}: #{file.filename}" end end def run if @args[0] == '-h' usage else find_analyze_and_report_on_files end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bigfiles-0.0.2 | lib/bigfiles.rb |
bigfiles-0.0.1 | lib/bigfiles.rb |