fastlane/lib/fastlane/fast_file.rb in fastlane-2.62.0.beta.20171016010004 vs fastlane/lib/fastlane/fast_file.rb in fastlane-2.62.0.beta.20171017010003
- old
+ new
@@ -148,14 +148,10 @@
#####################################################
# @!group Other things
#####################################################
- def collector
- runner.collector
- end
-
# Is the given key a platform block or a lane?
def is_platform_block?(key)
UI.crash!('No key given') unless key
return false if self.runner.lanes.fetch(nil, {}).fetch(key.to_sym, nil)
@@ -215,12 +211,17 @@
# First check if there are local actions to import in the same directory as the Fastfile
actions_path = File.join(File.expand_path("..", path), 'actions')
Fastlane::Actions.load_external_actions(actions_path) if File.directory?(actions_path)
- collector.did_launch_action(:import)
- parse(File.read(path), path)
+ action_launched('import')
+
+ return_value = parse(File.read(path), path)
+
+ action_completed('import', status: FastlaneCore::ActionCompletionStatus::SUCCESS)
+
+ return return_value
end
# @param url [String] The git URL to clone the repository from
# @param branch [String] The branch to checkout in the repository
# @param path [String] The path to the Fastfile
@@ -228,11 +229,11 @@
UI.user_error!("Please pass a path to the `import_from_git` action") if url.to_s.length == 0
Actions.execute_action('import_from_git') do
require 'tmpdir'
- collector.did_launch_action(:import_from_git)
+ action_launched('import_from_git')
# Checkout the repo
repo_name = url.split("/").last
Dir.mktmpdir("fl_clone") do |tmp_path|
@@ -256,11 +257,15 @@
Actions.sh("cd '#{clone_folder}' && git checkout #{branch} '#{actions_folder}'")
rescue
# We don't care about a failure here, as local actions are optional
end
- import(File.join(clone_folder, path))
+ return_value = import(File.join(clone_folder, path))
+
+ action_completed('import_from_git', status: FastlaneCore::ActionCompletionStatus::SUCCESS)
+
+ return return_value
end
end
end
#####################################################
@@ -270,23 +275,38 @@
# Speak out loud
def say(value)
# Overwrite this, since there is already a 'say' method defined in the Ruby standard library
value ||= yield
Actions.execute_action('say') do
- collector.did_launch_action(:say)
- Fastlane::Actions::SayAction.run([value])
+ action_launched('say')
+ return_value = Fastlane::Actions::SayAction.run([value])
+ action_completed('say', status: FastlaneCore::ActionCompletionStatus::SUCCESS)
+ return return_value
end
end
def puts(value)
# Overwrite this, since there is already a 'puts' method defined in the Ruby standard library
value ||= yield if block_given?
- collector.did_launch_action(:puts)
- Fastlane::Actions::PutsAction.run([value])
+
+ action_launched('puts')
+ return_value = Fastlane::Actions::PutsAction.run([value])
+ action_completed('puts', status: FastlaneCore::ActionCompletionStatus::SUCCESS)
+ return return_value
end
def test(params = {})
# Overwrite this, since there is already a 'test' method defined in the Ruby standard library
self.runner.try_switch_to_lane(:test, [params])
+ end
+
+ def action_launched(action_name)
+ action_launch_context = FastlaneCore::ActionLaunchContext.context_for_action_name(action_name, args: ARGV)
+ FastlaneCore.session.action_launched(launch_context: action_launch_context)
+ end
+
+ def action_completed(action_name, status: nil)
+ completion_context = FastlaneCore::ActionCompletionContext.context_for_action_name(action_name, args: ARGV, status: status)
+ FastlaneCore.session.action_completed(completion_context: completion_context)
end
end
end