Sha256: 6d62f5c202da5f52eca1d71a4af57b834768d6a1fad7115055e1218cf831b53b

Contents?: true

Size: 1.51 KB

Versions: 242

Compression:

Stored size: 1.51 KB

Contents

require 'deliver'
require 'fastimage'

module Frameit
  class Runner
    def initialize
      downloader = FrameDownloader.new
      unless downloader.frames_exist?
        downloader.download_frames
      end
    end

    def run(path, color = nil)
      unless color
        color = Frameit::Color::BLACK
        color = Frameit::Color::SILVER if Frameit.config[:white] || Frameit.config[:silver]
        color = Frameit::Color::GOLD if Frameit.config[:gold]
        color = Frameit::Color::ROSE_GOLD if Frameit.config[:rose_gold]
      end

      screenshots = Dir.glob("#{path}/**/*.{png,PNG}").uniq # uniq because thanks to {png,PNG} there are duplicates

      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
          next if full_path.downcase.include? "watch" # we don't care about watches right now

          UI.message("Framing screenshot '#{full_path}'")

          begin
            screenshot = Screenshot.new(full_path, color)
            screenshot.frame!
          rescue => ex
            UI.error ex.to_s
            UI.error "Backtrace:\n\t#{ex.backtrace.join("\n\t")}" if FastlaneCore::Globals.verbose?
          end
        end
      else
        UI.error "Could not find screenshots in current directory: '#{File.expand_path(path)}'"
      end
    end
  end
end

Version data entries

242 entries across 242 versions & 1 rubygems

Version Path
fastlane-2.25.0.beta.20170330225747 frameit/lib/frameit/runner.rb
fastlane-2.24.0 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170330010023 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170329010023 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170328010037 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170327010009 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170326010023 frameit/lib/frameit/runner.rb
fastlane-2.24.0.beta.20170325010032 frameit/lib/frameit/runner.rb
fastlane-2.23.0 frameit/lib/frameit/runner.rb
fastlane-2.23.0.beta.20170322010036 frameit/lib/frameit/runner.rb
fastlane-2.22.0 frameit/lib/frameit/runner.rb
fastlane-2.22.0.beta.20170321010023 frameit/lib/frameit/runner.rb
fastlane-2.21.0 frameit/lib/frameit/runner.rb
fastlane-2.21.0.beta.20170320010043 frameit/lib/frameit/runner.rb
fastlane-2.21.0.beta.20170319010027 frameit/lib/frameit/runner.rb
fastlane-2.21.0.beta.20170318010107 frameit/lib/frameit/runner.rb
fastlane-2.21.0.beta.20170317010039 frameit/lib/frameit/runner.rb
fastlane-2.21.0.beta.20170316010039 frameit/lib/frameit/runner.rb
fastlane-2.20.0 frameit/lib/frameit/runner.rb
fastlane-2.20.0.beta.20170315010053 frameit/lib/frameit/runner.rb