17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'frameit/lib/frameit/runner.rb', line 17
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
if screenshots.count > 0
screenshots.each do |full_path|
next if full_path.include?("_framed.png")
next if full_path.include?(".itmsp/")
next if full_path.include?("device_frames/")
device = full_path.rpartition('/').last.partition('-').first
if device.downcase.include?("watch")
UI.error("Apple Watch screenshots are not framed: '#{full_path}'")
next
end
Helper.show_loading_indicator("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
|