Sha256: 5dda7fc21a31ee166bc5bcfd1fe72870a6f81cb4574d3b536d1c117da4b120f7

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'deliver'
require 'fastimage'

module Frameit
  class Runner
    def initialize
      converter = FrameConverter.new
      unless converter.frames_exist?
        # First run
        converter.run
      else
        # Just make sure, the PSD files are converted to PNG
        converter.convert_frames
      end
    end

    def run(path, color = Color::BLACK)
      screenshots = Dir.glob("#{path}/**/*.{png,PNG}")

      if screenshots.count > 0
        screenshots.each do |full_path|
          next if full_path.include?"_framed.png"
          next if full_path.include?".itmsp/" # a package file, we don't want to modify that
          next if full_path.include?"device_frames/" # these are the device frames the user is using
          
          begin
            screenshot = Screenshot.new(full_path, color)
            screenshot.frame!
          rescue => ex
            Helper.log.error ex
          end
        end
      else 
        Helper.log.error "Could not find screenshots"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frameit-2.0.1 lib/frameit/runner.rb
frameit-2.0.0 lib/frameit/runner.rb