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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/fastlane/lane_manager.rb', line 3
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
loop do
Helper.log.error "You must provide a lane to drive. Available lanes:"
available = ff.runner.available_lanes
available.each_with_index do |lane, index|
puts "#{index + 1}) #{lane}"
end
i = gets.strip.to_i - 1
if i >= 0 and (available[i] rescue nil)
lanes = [available[i]]
Helper.log.info "Driving the lane #{lanes.first}. Next time launch fastlane using `fastlane #{lanes.first}`".green
break
end
Helper.log.error "Invalid input. Please enter the number of the lane you want to use".red
end
end
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)
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
thread = ff.did_finish
Fastlane::JUnitGenerator.generate(Fastlane::Actions.executed_actions)
duration = ((Time.now - start) / 60.0).round
unless e
thread.join
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
thread.join
Helper.log.fatal 'fastlane finished with errors'.red
raise e
end
end
|