Skip to content
Browse files

better error detection; separated Rakefile; added .gitignore

  • Loading branch information...
1 parent 163561e commit 0410b9b2a851ce09816139e26dd0c2fe83a9eb42 Paul Wilson committed
Showing with 94 additions and 68 deletions.
  1. +1 −0 lib/iphone_testify/setup.rb
  2. +72 −0 skeleton/Autotest.rake
  3. +1 −68 skeleton/Rakefile
  4. +20 −0 skeleton/gitignore
View
1 lib/iphone_testify/setup.rb
@@ -7,6 +7,7 @@ module Setup
extend FileUtils
def self.setup
cp_r "#{SKELETONDIR}/.", "."
+ mv 'gitignore', '.gitignore', :force=>true
mkdir_p "UnitTests"
end
end
View
72 skeleton/Autotest.rake
@@ -0,0 +1,72 @@
+
+BUILD_STATUS_FILE=".built"
+
+class String
+ attr_accessor :colour
+ RESET="\e[00;m"
+
+ def coloured(colour = nil)
+ colour||=@colour
+ "#{colour_code(colour)}#{self}#{RESET}"
+ end
+
+ private
+ def colour_code colour
+ case colour
+ when :red : "\e[01;31m"
+ when :green : "\e[01;32m"
+ end
+ end
+end
+
+file BUILD_STATUS_FILE => Dir.glob("Classes/*.[hm]") + Dir.glob("UnitTests/*.m") do
+ failure_line = AutoTest::test
+ if failure_line
+ notice = ['Fail', failure_line.chomp]
+ else
+ notice = ['Pass']
+ end
+ AutoTest::growl *notice
+ File.open(BUILD_STATUS_FILE, 'w') {|f| f.write(notice * ": ")}
+end
+
+
+task 'auto:remove_built_file' do
+ FileUtils.rm_f(BUILD_STATUS_FILE)
+end
+
+desc "build and run the tests "
+task 'auto:test:all'=>['auto:remove_built_file', 'auto:test']
+
+desc "build and run the tests if changed"
+task 'auto:test'=>[BUILD_STATUS_FILE] do
+ out = File.open('.built') {|f| f.read}
+ print out.coloured(out =~ /Pass/ ? :green : :red) + "\n"
+end
+
+
+
+module AutoTest
+ def self.test
+ output = `xcodebuild -target "Unit Test" -configuration Debug -sdk iphonesimulator2.1 2>&1`
+ failure_line = nil
+ output.each do |line|
+ if line =~ /error:|^Executed.*(\d+) failures|Undefined symbols|PurpleSystemEventPort|FAILED|Segmentation fault/
+ if $1.nil? || $1.to_i > 0
+ failure_line||= line
+ line.colour = :red
+ else
+ line.colour = :green
+ end
+ end
+ print line.coloured unless line =~/Merge mismatch|setenv/
+ end
+ failure_line
+ end
+
+ def self.growl title, msg =""
+ img = "~/.autotest_images/#{title.downcase}.png"
+ `growlnotify -H localhost -n autotest --image #{img} -p 0 -m #{msg.inspect} #{title}`
+ end
+
+end
View
69 skeleton/Rakefile
@@ -1,68 +1 @@
-
-BUILD_STATUS_FILE=".built"
-
-class String
- attr_accessor :colour
- RESET="\e[00;m"
-
- def coloured(colour = nil)
- colour||=@colour
- "#{colour_code(colour)}#{self}#{RESET}"
- end
-
- private
- def colour_code colour
- case colour
- when :red : "\e[01;31m"
- when :green : "\e[01;32m"
- end
- end
-end
-
-file BUILD_STATUS_FILE => Dir.glob("Classes/*.[hm]") + Dir.glob("UnitTests/*.m") do
- failure_line = test
- if failure_line
- notice = ['Fail', failure_line.chomp]
- else
- notice = ['Pass']
- end
- growl *notice
- File.open(BUILD_STATUS_FILE, 'w') {|f| f.write(notice * ": ")}
-end
-
-task :remove_built_file do
- FileUtils.rm_f(BUILD_STATUS_FILE)
-end
-
-task :test_all=>[:remove_built_file, :test]
-
-task :test=>[BUILD_STATUS_FILE] do
- out = File.open('.built') {|f| f.read}
- print out.coloured(out =~ /Pass/ ? :green : :red) + "\n"
-end
-
-
-
-task :default => [:test]
-
-def test
- output = `xcodebuild -target "Unit Test" -configuration Debug -sdk iphonesimulator2.1`
- failure_line = nil
- output.each do |line|
- if line =~ /error:|^Executed.*(\d+) failures/
- if $1.nil? || $1.to_i > 0
- failure_line||= line
- line.colour = :red
- else
- line.colour = :green
- end
- end
- print line.coloured
- end
- failure_line
-end
-
-def growl title, msg =""
- img = "~/.autotest_images/#{title.downcase}.png"
- `growlnotify -H localhost -n autotest --image #{img} -p 0 -m #{msg.inspect} #{title}`
-end
+Load 'Autotest.rake'
View
20 skeleton/gitignore
@@ -0,0 +1,20 @@
+.built
+*tm_build_errors
+# xcode noise
+
+iphone/build/*
+*.pbxuser
+*.mode2v3
+*.mode1v3
+*.perspective
+*.perspectivev3
+
+
+# osx noise
+.DS_Store
+profile
+
+
+*.swp
+*~.nib
+

0 comments on commit 0410b9b

Please sign in to comment.
Something went wrong with that request. Please try again.