Class: Fastlane::Actions::SnapshotAction

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

Class Method Summary collapse

Methods inherited from Fastlane::Action

details, output, sh

Class Method Details

.authorObject



47
48
49
# File 'lib/fastlane/actions/snapshot.rb', line 47

def self.author
  "KrauseFx"
end

.available_optionsObject



40
41
42
43
44
45
# File 'lib/fastlane/actions/snapshot.rb', line 40

def self.available_options
  [
    ['noclean', 'Skips the clean process when building the app'],
    ['verbose', 'Print out the UI Automation output']
  ]
end

.descriptionObject



36
37
38
# File 'lib/fastlane/actions/snapshot.rb', line 36

def self.description
  "Generate new localised screenshots on multiple devices"
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/actions/snapshot.rb', line 8

def self.run(params)
  clean = true
  clean = false if params.include?(:noclean)
  $verbose = true if params.include?(:verbose)

  if Helper.test?
    Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] = Dir.pwd
    return clean
  end

  require 'snapshot'

  FastlaneCore::UpdateChecker.start_looking_for_update('snapshot')

  begin
    Dir.chdir(FastlaneFolder.path) do
      Snapshot::SnapshotConfig.shared_instance
      Snapshot::Runner.new.work(clean: clean)

      results_path = Snapshot::SnapshotConfig.shared_instance.screenshots_path

      Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] = File.expand_path(results_path) # absolute URL
    end
  ensure
    FastlaneCore::UpdateChecker.show_update_status('snapshot', Snapshot::VERSION)
  end
end