Class: Fastlane::LaneManager

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/lane_manager.rb

Class Method Summary collapse

Class Method Details

.cruise_lanes(lanes) ⇒ Object



3
4
5
6
7
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
35
36
37
38
39
40
41
# File 'lib/fastlane/lane_manager.rb', line 3

def self.cruise_lanes(lanes)
  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

  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