Sha256: b94aa692294bd126476db52ed513920acc1b9b562f6743840346573bca9b9ede

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      SNAPSHOT_SCREENSHOTS_PATH = :SNAPSHOT_SCREENSHOTS_PATH
    end

    class SnapshotAction < Action
      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

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

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

      def self.author
        "KrauseFx"
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastlane-0.11.0 lib/fastlane/actions/snapshot.rb