Skip to content

Commit

Permalink
improve project path validation (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
shams-ahmed committed Mar 19, 2021
1 parent 6423131 commit 5406d63
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ workflows:
envs:
- MY_STEPLIB_REPO_FORK_GIT_URL: https://github.com/shams-ahmed/bitrise-steplib.git
- STEP_ID_IN_STEPLIB: add-trace-sdk
- STEP_GIT_VERION_TAG_TO_SHARE: 1.2.2
- STEP_GIT_VERION_TAG_TO_SHARE: 1.2.3
- STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/bitrise-step-add-trace-sdk.git
before_run:
- audit-this-step
Expand All @@ -56,6 +56,13 @@ workflows:
- _common
- _test_project_pod
- _test_project_build
test_project_badPath:
envs:
- TEST_REPO: https://github.com/bitrise-io/iOS-Sample.git
- BITRISE_PROJECT_PATH: "./Users/shamsahmed/bitrise-step-link-apm-sdk-ios/_tmp/iOS-Sample/iOS Sample.xcodeproj"
- BITRISE_SCHEME: "iOS Sample"
after_run:
- _common

test_project_custom_workspace:
envs:
Expand Down
12 changes: 12 additions & 0 deletions step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@
puts "Starting step with path: #{project_path}, scheme: #{scheme}, trace version: #{lib_version}"
puts

if File.exist?(tmpf.path) == false
puts "Downloaded file does not exist at: #{tmpf.path}"
end

fileLocation = "#{File.dirname(project_path)}/#{tmpf.original_filename}"

puts "Moving downloaded file to: #{fileLocation}"

if Dir.exist?(fileLocation) == false
puts "File location path is malformed: #{fileLocation}"
puts "Make sure path is a relative path with the full root"
end

FileUtils.mv(tmpf.path, fileLocation)

# Unzip file
Expand Down
2 changes: 1 addition & 1 deletion step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inputs:
title: "Project (or Workspace) path"
summary: ""
description: |-
A `.xcodeproj` or `.xcworkspace` path.
A `.xcodeproj` or `.xcworkspace` path. Must be a relative path
is_required: true
- scheme: $BITRISE_SCHEME
opts:
Expand Down

0 comments on commit 5406d63

Please sign in to comment.