Sha256: 8dc82a83d7e41e31f50b4b8081b0926de2dd34159280292d15a281b2d4f06151

Contents?: true

Size: 1.74 KB

Versions: 29

Compression:

Stored size: 1.74 KB

Contents

module Fastlane
  class LaneList
    # Print out the result of `generate`
    def self.output(path)
      puts generate(path)

      puts "Execute using `fastlane [lane_name]`".yellow
    end

    def self.generate(path)
      ff = Fastlane::FastFile.new(path)
      output = ""

      all_keys = ff.runner.lanes.keys.reject(&:nil?)
      all_keys.unshift(nil) # because we want root elements on top. always! They have key nil

      all_keys.each do |platform|
        next if (ff.runner.lanes[platform] || []).count == 0

        plat_text = platform
        plat_text = "general" if platform.to_s.empty?
        output += "\n--------- #{plat_text}---------\n".yellow

        value = ff.runner.lanes[platform]
        next unless value

        value.each do |lane_name, lane|
          next if lane.is_private

          output += "----- fastlane #{lane.pretty_name}".green
          if lane.description.count > 0
            output += "\n" + lane.description.join("\n") + "\n\n"
          else
            output += "\n\n"
          end
        end
      end

      output
    end

    def self.output_json(path)
      puts JSON.pretty_generate(self.generate_json(path))
    end

    # Returns a hash
    def self.generate_json(path)
      ff = Fastlane::FastFile.new(path)
      output = {}

      all_keys = ff.runner.lanes.keys

      all_keys.each do |platform|
        next if (ff.runner.lanes[platform] || []).count == 0

        output[platform] ||= {}

        value = ff.runner.lanes[platform]
        next unless value

        value.each do |lane_name, lane|
          next if lane.is_private

          output[platform][lane_name] = {
            description: lane.description.join("\n")
          }
        end
      end

      return output
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
fastlane-1.94.1 lib/fastlane/lane_list.rb
fastlane-1.94.0 lib/fastlane/lane_list.rb
fastlane-1.93.1 lib/fastlane/lane_list.rb
fastlane-1.93.0 lib/fastlane/lane_list.rb
fastlane-1.92.0 lib/fastlane/lane_list.rb
fastlane-1.92.0.beta2 lib/fastlane/lane_list.rb
fastlane-1.92.0.beta1 lib/fastlane/lane_list.rb
fastlane-1.91.0 lib/fastlane/lane_list.rb
fastlane-1.90.0 lib/fastlane/lane_list.rb
fastlane-1.89.0 lib/fastlane/lane_list.rb
fastlane-1.88.0 lib/fastlane/lane_list.rb
fastlane-1.87.1 lib/fastlane/lane_list.rb
fastlane-1.87.0 lib/fastlane/lane_list.rb
fastlane-1.86.1 lib/fastlane/lane_list.rb
fastlane-1.86.0 lib/fastlane/lane_list.rb
fastlane-1.85.0 lib/fastlane/lane_list.rb
fastlane-1.84.0 lib/fastlane/lane_list.rb
fastlane-1.83.0 lib/fastlane/lane_list.rb
fastlane-1.82.0 lib/fastlane/lane_list.rb
fastlane-1.81.0 lib/fastlane/lane_list.rb