Class: Fastlane::Actions::CaptureAndroidScreenshotsAction

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

Direct Known Subclasses

ScreengrabAction

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, deprecated_notes, details, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject


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

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

.available_optionsObject


26
27
28
29
# File 'fastlane/lib/fastlane/actions/capture_android_screenshots.rb', line 26

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

.categoryObject


58
59
60
# File 'fastlane/lib/fastlane/actions/capture_android_screenshots.rb', line 58

def self.category
  :screenshots
end

.descriptionObject


22
23
24
# File 'fastlane/lib/fastlane/actions/capture_android_screenshots.rb', line 22

def self.description
  'Automated localized screenshots of your Android app (via _screengrab_)'
end

.example_codeObject


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

def self.example_code
  [
    'capture_android_screenshots',
    'screengrab # alias for "capture_android_screenshots"',
    'capture_android_screenshots(
      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:


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

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

.outputObject


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

def self.output
  [
    ['SCREENGRAB_OUTPUT_DIRECTORY', 'The path to the output directory']
  ]
end

.run(params) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'fastlane/lib/fastlane/actions/capture_android_screenshots.rb', line 8

def self.run(params)
  require 'screengrab'

  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
end