Sha256: 8389f67de3f6ac739ecb8c3332be5efd2edb427486ada2db050ec0ba0dcd6b24

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

require 'optparse'

require_relative 'bigfiles/file_with_lines'
require_relative 'bigfiles/option_parser'
require_relative 'bigfiles/inspector'
require 'source_finder/source_file_globber'
require 'source_finder/option_parser'

# 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_globber: SourceFinder::SourceFileGlobber.new,
                   inspector_class: Inspector,
                   option_parser_class: ::OptionParser,
                   source_finder_option_parser: SourceFinder::OptionParser.new,
                   bigfiles_option_parser:
                     ::BigFiles::OptionParser
                       .new(option_parser_class: option_parser_class,
                            io: io,
                            exiter: exiter,
                            source_finder_option_parser:
                              source_finder_option_parser),
                   config: bigfiles_option_parser.parse_options(args))
      @bigfiles_option_parser = bigfiles_option_parser
      @config = config
      @inspector = inspector_class.new(source_file_globber: source_file_globber,
                                       config: config,
                                       file_with_lines: file_with_lines,
                                       io: io)
    end

    def run
      if @config.help
        @bigfiles_option_parser.usage
      else
        @inspector.find_analyze_and_report_on_files
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bigfiles-0.2.1 lib/bigfiles.rb
bigfiles-0.2.0 lib/bigfiles.rb