Sha256: b0d8df74a4736a8f40b8533d04cb33e355c5ad3c5b67aa019071a19ed1c5485f

Contents?: true

Size: 1.82 KB

Versions: 14

Compression:

Stored size: 1.82 KB

Contents

module Fastlane
  class LaneManager
    def self.cruise_lanes(lanes, env=nil)
      Actions.lane_context[Actions::SharedValues::ENVIRONMENT] = env
      raise 'lanes must be an array' unless lanes.is_a?(Array)

      ff = Fastlane::FastFile.new(File.join(Fastlane::FastlaneFolder.path, 'Fastfile'))

      if lanes.count == 0
        raise "Please pass the name of the lane you want to drive. Available lanes: #{ff.runner.available_lanes.join(', ')}".red
      end

      # Making sure the default '.env' and '.env.default' get loaded
      env_file = File.join(Fastlane::FastlaneFolder.path || "", '.env')
      env_default_file = File.join(Fastlane::FastlaneFolder.path || "", '.env.default')
      Dotenv.load(env_file, env_default_file)

      # Loads .env file for the environment passed in through options
      if env
        env_file = File.join(Fastlane::FastlaneFolder.path || "", ".env.#{env}")
        Helper.log.info "Loading from '#{env_file}'".green
        Dotenv.overload(env_file)
      end

      start = Time.now
      e = nil
      begin
        lanes.each do |key|
          ff.runner.execute(key)
        end
      rescue => ex
        if Actions.lane_context.count > 0
          Helper.log.info 'Variable Dump:'.yellow
          Helper.log.info Actions.lane_context
        end
        Helper.log.fatal ex
        e = ex
      end

      # Finished with all the lanes
      Fastlane::JUnitGenerator.generate(Fastlane::Actions.executed_actions)

      duration = ((Time.now - start) / 60.0).round

      unless e
        if duration > 5
          Helper.log.info "fastlane.tools just saved you #{duration} minutes! 🎉".green
        else
          Helper.log.info 'fastlane.tools finished successfully 🎉'.green
        end
      else
        Helper.log.fatal 'fastlane finished with errors'.red
        raise e
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fastlane-0.6.1 lib/fastlane/lane_manager.rb
fastlane-0.6.0 lib/fastlane/lane_manager.rb
fastlane-0.5.0 lib/fastlane/lane_manager.rb
fastlane-0.4.2 lib/fastlane/lane_manager.rb
fastlane-0.4.1 lib/fastlane/lane_manager.rb
fastlane-0.4.0 lib/fastlane/lane_manager.rb
fastlane-0.3.0 lib/fastlane/lane_manager.rb
fastlane-0.2.1 lib/fastlane/lane_manager.rb
fastlane-0.2.0 lib/fastlane/lane_manager.rb
fastlane-0.1.19 lib/fastlane/lane_manager.rb
fastlane-0.1.18 lib/fastlane/lane_manager.rb
fastlane-0.1.17 lib/fastlane/lane_manager.rb
fastlane-0.1.16 lib/fastlane/lane_manager.rb
fastlane-0.1.15 lib/fastlane/lane_manager.rb