Class: Codeball::Commands::Pack

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

Overview

Pack files into a codeball for clipboard transfer.

Instance Method Summary collapse

Instance Method Details

#run(*files) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/codeball/commands/pack.rb', line 24

def run(*files)
  readable, unreadable = validate_files(files)
  ball = Ball.new
  readable.each do |path|
    entry = Entry.from_file(path)
    ball.add_entry(entry) if entry
  end

  warn_skipped(unreadable, ball)
  puts ball.serialize

  exit 1 if unreadable.any? || !ball.all_text?
end