Skip to content

Commit

Permalink
get name from task
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Feb 19, 2017
1 parent 703c749 commit 011f3a3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def xcpretty(cmd, name)
name = name.gsub(/:/,"_")
def xcpretty(cmd, task)
name = task.name.gsub(/:/,"_")
if ENV['CI']
sh "set -o pipefail && #{cmd} | tee \"#{ENV['CIRCLE_ARTIFACTS']}/#{name}_raw.log\" | xcpretty --color --report junit --output \"#{ENV['CIRCLE_TEST_REPORTS']}/xcode/#{name}.xml\""
elsif `which xcpretty` && $?.success?
Expand All @@ -9,8 +9,8 @@ def xcpretty(cmd, name)
end
end

def plain(cmd, name)
name = name.gsub(/:/,"_")
def plain(cmd, task)
name = task.name.gsub(/:/,"_")
if ENV['CI']
sh "set -o pipefail && #{cmd} | tee \"#{ENV['CIRCLE_ARTIFACTS']}/#{name}_raw.log\""
else
Expand All @@ -20,31 +20,31 @@ end

namespace :spm do
desc 'Build using SPM'
task :build do
plain("swift build", "spm:build")
task :build do |task|
plain("swift build", task)
end

desc 'Run SPM Unit Tests'
task :test => :build do
plain("swift test", "spm:test")
task :test => :build do |task|
plain("swift test", task)
end
end

namespace :xcode do
desc 'Build using Xcode'
task :build do
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests build-for-testing", "xcode:build")
task :build do |task|
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests build-for-testing", task)
end

desc 'Run Xcode Unit Tests'
task :test => :build do
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests test-without-building", "xcode:test")
task :test => :build do |task|
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests test-without-building", task)
end
end

desc 'Lint the Pod'
task :lint do
plain("pod lib lint StencilSwiftKit.podspec --quick", "lint")
task :lint do |task|
plain("pod lib lint StencilSwiftKit.podspec --quick", task)
end

task :default => "xcode:test"

0 comments on commit 011f3a3

Please sign in to comment.