Class: Fastlane::Actions::ScreengrabAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Class Method Summary collapse

Methods inherited from Fastlane::Action

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

Class Method Details

.authorObject



37
38
39
# File 'lib/fastlane/actions/screengrab.rb', line 37

def self.author
  ['asfalcone', 'i2amsam', 'mfurtak']
end

.available_optionsObject



32
33
34
35
# File 'lib/fastlane/actions/screengrab.rb', line 32

def self.available_options
  require 'screengrab'
  Screengrab::Options.available_options
end

.categoryObject



57
58
59
# File 'lib/fastlane/actions/screengrab.rb', line 57

def self.category
  :screenshots
end

.descriptionObject



28
29
30
# File 'lib/fastlane/actions/screengrab.rb', line 28

def self.description
  'Automated localized screenshots of your Android app on every device'
end

.example_codeObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fastlane/actions/screengrab.rb', line 45

def self.example_code
  [
    'screengrab',
    'screengrab(
      locales: ["en-US", "fr-FR", "ja-JP"],
      clear_previous_screenshots: true,
      app_apk_path: "build/outputs/apk/example-debug.apk",
      tests_apk_path: "build/outputs/apk/example-debug-androidTest-unaligned.apk"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/fastlane/actions/screengrab.rb', line 41

def self.is_supported?(platform)
  platform == :android
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/actions/screengrab.rb', line 8

def self.run(params)
  require 'screengrab'

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

    Screengrab.config = params
    Screengrab.android_environment = Screengrab::AndroidEnvironment.new(params[:android_home],
                                                                        params[:build_tools_version])
    Screengrab::DependencyChecker.check(Screengrab.android_environment)
    Screengrab::Runner.new.run

    Actions.lane_context[SharedValues::SCREENGRAB_OUTPUT_DIRECTORY] = File.expand_path(params[:output_directory])

    true
  ensure
    FastlaneCore::UpdateChecker.show_update_status('screengrab', Screengrab::VERSION)
  end
end