Class: Codeball::Commands::Unpack

Inherits:
CommandKit::Commands::Command
  • Object
show all
Includes:
CommandKit::Colors
Defined in:
lib/codeball/commands/unpack.rb

Overview

Extract files from a codeball.

Instance Method Summary collapse

Instance Method Details

#run(file = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/codeball/commands/unpack.rb', line 33

def run(file = nil)
  ball = Ball.parse(read_input(file))
  dest = build_destination

  ball.each_warning { |msg| warn colors.yellow("warning: #{msg}") }
  ball.each_entry { |entry| dest.write(entry) { |outcome| print_outcome(outcome) } }

  print_summary(dest.summary(malformed: ball.warning_count))
end