Method: Frameit::Runner#create_config

Defined in:
frameit/lib/frameit/runner.rb

#create_config(screenshot_path) ⇒ Object

Loads the config (colors, background, texts, etc.) Don’t use this method to access the actual text and use ‘fetch_texts` instead



84
85
86
87
88
89
90
91
92
93
94
95
# File 'frameit/lib/frameit/runner.rb', line 84

def create_config(screenshot_path)
  # Screengrab pulls screenshots to a different folder location
  # frameit only handles two levels of folders, to not break
  # compatibility with Supply we look into a different path for Android
  # Issue https://github.com/fastlane/fastlane/issues/16289
  config_path = File.join(File.expand_path("..", screenshot_path), "Framefile.json")
  config_path = File.join(File.expand_path("../..", screenshot_path), "Framefile.json") unless File.exist?(config_path)
  config_path = File.join(File.expand_path("../../../..", screenshot_path), "Framefile.json") unless File.exist?(config_path)
  file = ConfigParser.new.load(config_path)
  return {} unless file # no config file at all
  file.fetch_value(screenshot_path)
end