Module: Ruboclean

Defined in:
lib/ruboclean.rb,
lib/ruboclean/logger.rb,
lib/ruboclean/runner.rb,
lib/ruboclean/grouper.rb,
lib/ruboclean/orderer.rb,
lib/ruboclean/version.rb,
lib/ruboclean/path_cleanup.rb,
lib/ruboclean/cli_arguments.rb,
lib/ruboclean/stream_writer.rb,
lib/ruboclean/runner/options.rb,
lib/ruboclean/to_yaml_converter.rb,
lib/ruboclean/runner/options/input.rb,
lib/ruboclean/runner/options/output.rb

Overview

Ruboclean entry point

Defined Under Namespace

Classes: CliArguments, Grouper, Logger, Orderer, PathCleanup, Runner, StreamWriter, ToYamlConverter

Constant Summary collapse

VERSION =
"0.7.1"

Class Method Summary collapse

Class Method Details

.post_execution_message(changed, verify) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ruboclean.rb', line 35

def self.post_execution_message(changed, verify)
  if changed
    if verify
      "needs clean.\n"
    else
      "done.\n"
    end
  else
    "already clean.\n"
  end
end

.run_from_cli!(args) ⇒ Object

rubocop:disable Metrics/MethodLength



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruboclean.rb', line 18

def self.run_from_cli!(args) # rubocop:disable Metrics/MethodLength
  if args.include?("--version")
    print Ruboclean::VERSION
  else
    runner = Runner.new(args)
    logger = Ruboclean::Logger.new(runner.verbose? ? :verbose : :none)

    logger.verbose "Using input path '#{runner.input_path}' ... "
    changed = runner.run!
    logger.verbose post_execution_message(changed, runner.verify?)

    exit !changed if runner.verify?
  end

  exit 0
end