Sha256: ab4b91753db0749e0265ecc77703c3a23a09a152a722fab88e23b4758fdcaa5a

Contents?: true

Size: 1.9 KB

Versions: 102

Compression:

Stored size: 1.9 KB

Contents

module Fastlane
  module Actions
    class SpaceshipStatsAction < Action
      def self.run(params)
        require 'fastlane_core/print_table'
        require 'spaceship'

        rows = []
        Spaceship::StatsMiddleware.service_stats.each do |service, count|
          rows << [service.name, service.auth_type, service.url, count]
        end

        puts("")
        puts(Terminal::Table.new(
               title: "Spaceship Stats",
               headings: ["Service", "Auth Type", "URL", "Number of requests"],
               rows: FastlaneCore::PrintTable.transform_output(rows)
        ))
        puts("")

        if params[:print_request_logs]
          log_rows = []
          Spaceship::StatsMiddleware.request_logs.each do |request_log|
            log_rows << [request_log.auth_type, request_log.url]
          end

          puts("")
          puts(Terminal::Table.new(
                 title: "Spaceship Request Log",
                 headings: ["Auth Type", "URL"],
                 rows: FastlaneCore::PrintTable.transform_output(log_rows)
          ))
          puts("")
        end
      end

      def self.url_name(url_prefix)
        Spaceship::StatsMiddleware::URL_PREFIXES[url_prefix]
      end

      def self.description
        "Print out Spaceship stats from this session (number of request to each domain)"
      end

      def self.is_supported?(platform)
        true
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :print_request_logs,
                                       description: "Print all URLs requested",
                                       type: Boolean,
                                       default_value: false)
        ]
      end

      def self.example_code
        [
          'spaceship_stats'
        ]
      end

      def self.category
        :misc
      end

      def self.author
        "joshdholtz"
      end
    end
  end
end

Version data entries

102 entries across 102 versions & 4 rubygems

Version Path
fastlane-2.225.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.224.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.223.1 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.223.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.222.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.221.1 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.221.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.220.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.219.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.218.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-security-patched-2.216.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.217.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.216.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.215.1 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.215.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-mercafacil-2.214.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.214.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.213.0 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane-2.212.2 fastlane/lib/fastlane/actions/spaceship_stats.rb
fastlane_pricing_fix-2.212.1 fastlane/lib/fastlane/actions/spaceship_stats.rb