Module: Deathnote

Defined in:
lib/deathnote.rb,
lib/deathnote/version.rb

Defined Under Namespace

Classes: DeadCodes

Constant Summary collapse

VERSION =
'0.1.2'

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/deathnote.rb', line 10

def run(argv)
  options = parse_options(argv)
  backup_commit = cmd('git rev-parse --abbrev-ref HEAD')

  cmd("git checkout #{options[:past_commit]}")
  past_missing = DeadCodes.new(options.deep_clone).run

  cmd("git checkout #{options[:newer_commit]}")
  newer_missing = DeadCodes.new(options.deep_clone).run

  newer_missing.
    reject { |unused, _location| past_missing.has_key?(unused) }.
    each { |unused, location| puts "#{unused} #{location}" }
ensure
  cmd("git checkout #{backup_commit}")
end