Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Commit

Permalink
auto detect if we need xcpretty
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Feb 26, 2017
1 parent f4187cb commit 8efef22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions rakelib/lint.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ namespace :lint do
url = 'https://github.com/realm/SwiftLint/releases/download/0.16.1/SwiftLint.pkg'
tmppath = '/tmp/SwiftLint.pkg'

plain("curl -Lo #{tmppath} #{url}", task)
plain("sudo installer -pkg #{tmppath} -target /", task)
plain("curl -Lo #{tmppath} #{url} && sudo installer -pkg #{tmppath} -target /", task)
end
end

Expand Down
16 changes: 8 additions & 8 deletions rakelib/utils.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# run a command, pipe output through 'xcpretty' and store the output in CI artifacts
def xcpretty(cmd, task)
name = task.name.gsub(/:/,"_")
def xcpretty(cmd, task, subtask = '')
name = (task.name + (subtask.empty? ? '' : "_#{subtask}")).gsub(/:-/, "_")
xcpretty = `which xcpretty`

if ENV['CI']
Expand All @@ -13,8 +13,8 @@ def xcpretty(cmd, task)
end

# run a command and store the output in CI artifacts
def plain(cmd, task)
name = task.name.gsub(/:/,"_")
def plain(cmd, task, subtask = '')
name = (task.name + (subtask.empty? ? '' : "_#{subtask}")).gsub(/:/, "_")
if ENV['CI']
sh "set -o pipefail && #{cmd} | tee \"#{ENV['CIRCLE_ARTIFACTS']}/#{name}_raw.log\""
else
Expand All @@ -35,10 +35,10 @@ def version_select
%Q(DEVELOPER_DIR="#{latest_xcode_version}/Contents/Developer")
end

def xcrun(cmd, task, pretty=true)
if pretty
xcpretty("#{version_select} xcrun #{cmd}", task)
def xcrun(cmd, task, subtask = '')
if cmd.match('xcodebuild')
xcpretty("#{version_select} xcrun #{cmd}", task, subtask)
else
plain("#{version_select} xcrun #{cmd}", task)
plain("#{version_select} xcrun #{cmd}", task, subtask)
end
end

0 comments on commit 8efef22

Please sign in to comment.