Skip to content

Commit

Permalink
[deliver + frameit] Rename variables (fastlane#14460)
Browse files Browse the repository at this point in the history
* rename variable

* rename variable and add path to error
  • Loading branch information
janpio authored and Josh Holtz committed Mar 23, 2019
1 parent c2230ba commit 2d92fec
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions deliver/lib/deliver/upload_screenshots.rb
Original file line number Diff line number Diff line change
@@ -104,9 +104,9 @@ def collect_screenshots_for_languages(path, ignore_validation)
files = Dir.glob(File.join(lng_folder, "*.#{extensions}"), File::FNM_CASEFOLD).sort
next if files.count == 0

prefer_framed = Dir.glob(File.join(lng_folder, "*_framed.#{extensions}"), File::FNM_CASEFOLD).count > 0
framed_screenshots_found = Dir.glob(File.join(lng_folder, "*_framed.#{extensions}"), File::FNM_CASEFOLD).count > 0

UI.important("Framed screenshots are detected! 🖼 Non-framed screenshot files may be skipped. 🏃") if prefer_framed
UI.important("Framed screenshots are detected! 🖼 Non-framed screenshot files may be skipped. 🏃") if framed_screenshots_found

language_dir_name = File.basename(lng_folder)

@@ -120,7 +120,7 @@ def collect_screenshots_for_languages(path, ignore_validation)
is_framed = file_path.downcase.include?("_framed.")
is_watch = file_path.downcase.include?("watch")

if prefer_framed && !is_framed && !is_watch
if framed_screenshots_found && !is_framed && !is_watch
UI.important("🏃 Skipping screenshot file: #{file_path}")
next
end
11 changes: 5 additions & 6 deletions frameit/lib/frameit/offsets.rb
Original file line number Diff line number Diff line change
@@ -3,19 +3,18 @@

module Frameit
class Offsets
# Returns the image offset needed for a certain device type for a given orientation
# uses deliver to detect the screen size
# Returns the image offset needed for a certain device type
def self.image_offset(screenshot)
require 'json'

unless @offsets
unless @offsets_cache
offsets_json_path = File.join(FrameDownloader.new.templates_path, "offsets.json")
UI.user_error!("Could not find offsets.json file at path '#{offsets_json_path}'") unless File.exist?(offsets_json_path)
@offsets = JSON.parse(File.read(offsets_json_path))
@offsets_cache = JSON.parse(File.read(offsets_json_path))
end

offset_value = @offsets["portrait"][screenshot.device_name]
UI.error("Tried looking for offset information for 'portrait', #{screenshot.device_name}") unless offset_value
offset_value = @offsets_cache["portrait"][screenshot.device_name]
UI.error("Tried looking for offset information for 'portrait', #{screenshot.device_name} in '#{offsets_json_path}'") unless offset_value
return offset_value
end
end

0 comments on commit 2d92fec

Please sign in to comment.