Skip to content

Commit

Permalink
move creating dir to helper
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabeef committed Nov 8, 2019
1 parent 7b2f316 commit 9b4bf17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ def self.run(params)
results_bucket = params[:firebase_test_lab_results_bucket] == nil ? "#{params[:project_id]}_test_results" : params[:firebase_test_lab_results_bucket]
results_dir = "firebase_test_result_#{DateTime.now.strftime('%Y-%m-%d-%H:%M:%S')}"

# Create the log file
dirname = File.dirname(params[:console_log_file_name])
unless File.directory?(dirname)
FileUtils.mkdir_p(dirname)
end

# Set target project
Helper.config(params[:project_id])
# Activate service account
Expand All @@ -32,7 +26,7 @@ def self.run(params)
"--results-bucket #{results_bucket} "\
"--results-dir #{results_dir} "\
"#{params[:extra_options]} "\
"--format=json 1>#{params[:console_log_file_name]}"
"--format=json 1>#{Helper.if_need_dir(params[:console_log_file_name])}"
)

# Sample data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ def self.is_failure(outcome)
outcome == FAILED || outcome == INCONCLUSIVE
end

def self.if_need_dir(path)
dirname = File.dirname(params[:console_log_file_name])
unless File.directory?(dirname)
UI.message("Crate directory: #{dirname}")
FileUtils.mkdir_p(dirname)
end
path
end

def self.format_device_name(axis_value)
# Sample Nexus6P-23-ja_JP-portrait
array = axis_value.split("-")
Expand Down

0 comments on commit 9b4bf17

Please sign in to comment.