Class: Fastlane::FastFile
- Inherits:
-
Object
- Object
- Fastlane::FastFile
show all
- Defined in:
- lib/fastlane/fast_file.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path = nil) ⇒ Object
Returns The runner which can be executed to trigger the given actions.
6
7
8
9
10
11
12
13
14
|
# File 'lib/fastlane/fast_file.rb', line 6
def initialize(path = nil)
if (path || '').length > 0
raise "Could not find Fastfile at path '#{path}'".red unless File.exists?path
@path = path
content = File.read(path)
parse(content)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/fastlane/fast_file.rb', line 64
def method_missing(method_sym, *arguments, &block)
class_name = method_sym.to_s.classify + "Action"
class_ref = nil
begin
class_ref = Fastlane::Actions.const_get(class_name)
rescue NameError => ex
raise "Could not find method '#{method_sym}'. Check out the README for more details: https://github.com/KrauseFx/fastlane".red
end
if class_ref and class_ref.respond_to?(:run)
Helper.log.info "Step: #{method_sym.to_s}".green
Dir.chdir("..") do Actions.execute_action(method_sym) do
class_ref.run(arguments)
end
end
else
raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red
end
end
|
Instance Attribute Details
#runner ⇒ Object
Returns the value of attribute runner.
3
4
5
|
# File 'lib/fastlane/fast_file.rb', line 3
def runner
@runner
end
|
Instance Method Details
#actions_path(path) ⇒ Object
51
52
53
54
55
|
# File 'lib/fastlane/fast_file.rb', line 51
def actions_path(path)
raise "Path '#{path}' not found!".red unless File.directory?path
Actions.load_external_actions(path)
end
|
#after_all(&block) ⇒ Object
34
35
36
|
# File 'lib/fastlane/fast_file.rb', line 34
def after_all(&block)
@runner.set_after_all(block)
end
|
#before_all(&block) ⇒ Object
30
31
32
|
# File 'lib/fastlane/fast_file.rb', line 30
def before_all(&block)
@runner.set_before_all(block)
end
|
#error(&block) ⇒ Object
38
39
40
|
# File 'lib/fastlane/fast_file.rb', line 38
def error(&block)
@runner.set_error(block)
end
|
#lane(key, &block) ⇒ Object
26
27
28
|
# File 'lib/fastlane/fast_file.rb', line 26
def lane(key, &block)
@runner.set_block(key, block)
end
|
#parse(data) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/fastlane/fast_file.rb', line 16
def parse(data)
@runner = Runner.new
Dir.chdir(Fastlane::FastlaneFolder.path || Dir.pwd) do eval(data) end
return self
end
|