Sha256: 7f87f8b57e7a132364941c4002e2f1c2355ba235748d3df968e2cceb2a069823
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require_relative 'config_command' module WhirledPeas module Command class Record < ConfigCommand def self.description 'Record animation to a file' end def start super require 'highline' require 'whirled_peas/animator/renderer_consumer' require 'whirled_peas/animator/producer' require 'whirled_peas/device/output_file' width, height = HighLine.new.terminal.terminal_size consumer = Animator::RendererConsumer.new( WhirledPeas.config.template_factory, Device::OutputFile.new(out_file), width, height ) Animator::Producer.produce(consumer) do |producer| config.application.start(producer) end end private attr_reader :out_file def validate! super return unless @error_text.nil? out_file = args.shift if out_file.nil? @error_text = "#{command_name} requires an output file" elsif !out_file.end_with?('.wpz') if out_file.split('/').last =~ /\./ extra = ", found: .#{out_file.split('.').last}" end @error_text = "Expecting output file with .wpz extension#{extra}" else @out_file = out_file[0] == '/' ? out_file : File.join(Dir.pwd, out_file) end end def options_usage [*super, '<output file>'].join(' ') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whirled_peas-0.13.0 | lib/whirled_peas/command/record.rb |
whirled_peas-0.12.0 | lib/whirled_peas/command/record.rb |