Class: Fastlane::Actions::FrameitAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/frameit.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text

Class Method Details

.authorObject



45
46
47
# File 'lib/fastlane/actions/frameit.rb', line 45

def self.author
  "KrauseFx"
end

.available_optionsObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/actions/frameit.rb', line 34

def self.available_options
  require "frameit"
  require "frameit/options"
  FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options) + [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "FRAMEIT_SCREENSHOTS_PATH",
                                 description: "The path to the directory containing the screenshots",
                                  default_value: Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] || FastlaneFolder.path)
  ]
end

.categoryObject



56
57
58
# File 'lib/fastlane/actions/frameit.rb', line 56

def self.category
  :screenshots
end

.descriptionObject



23
24
25
# File 'lib/fastlane/actions/frameit.rb', line 23

def self.description
  "Adds device frames around the screenshots using frameit"
end

.detailsObject



27
28
29
30
31
32
# File 'lib/fastlane/actions/frameit.rb', line 27

def self.details
  [
    "Use [frameit](https://github.com/fastlane/fastlane/tree/master/frameit) to prepare perfect screenshots for the App Store, your website, QA",
    "or emails. You can add background and titles to the framed screenshots as well."
  ].join("\n")
end

.example_codeObject



49
50
51
52
53
54
# File 'lib/fastlane/actions/frameit.rb', line 49

def self.example_code
  [
    'frameit',
    'frameit :silver'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/fastlane/actions/frameit.rb', line 60

def self.is_supported?(platform)
  [:ios, :mac].include? platform
end

.run(config) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fastlane/actions/frameit.rb', line 4

def self.run(config)
  return if Helper.test?

  require 'frameit'

  begin
    FastlaneCore::UpdateChecker.start_looking_for_update('frameit') unless Helper.is_test?

    UI.message("Framing screenshots at path #{config[:path]}")

    Dir.chdir(config[:path]) do
      Frameit.config = config
      Frameit::Runner.new.run('.')
    end
  ensure
    FastlaneCore::UpdateChecker.show_update_status('frameit', Frameit::VERSION)
  end
end