paulanthonywilson-iphone_testify 0.1.02 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -14,4 +14,8 @@
14
14
  * added .gitignore
15
15
  * detects more failure conditions in growl message: segmentation faults, more build errors
16
16
  * moved bulk of Rake into separate file
17
- * changed tasks to auto:test, an auto:test:all
17
+ * changed tasks to auto:test, an auto:test:all
18
+
19
+ == 0.1.10
20
+
21
+ * ./autoiphonetest.rb no longer goes through rake
@@ -2,7 +2,7 @@
2
2
  module IphoneTestify
3
3
  GEMDIR = File.expand_path(File.dirname(__FILE__) + "/..")
4
4
  # :stopdoc:
5
- VERSION = '0.1.02'
5
+ VERSION = '0.1.10'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
@@ -1,36 +1,10 @@
1
- IPHONE_SDK_VERSION = '2.2.1' unless Object::const_defined?("IPHONE_SDK_VERSION")
2
-
3
- puts "SDK Version: #{IPHONE_SDK_VERSION}"
4
-
1
+ require File.dirname(__FILE__) + '/autotest'
5
2
 
6
3
  BUILD_STATUS_FILE=".built"
7
4
 
8
- class String
9
- attr_accessor :colour
10
- RESET="\e[00;m"
11
-
12
- def coloured(colour = nil)
13
- colour||=@colour
14
- "#{colour_code(colour)}#{self}#{RESET}"
15
- end
16
-
17
- private
18
- def colour_code colour
19
- case colour
20
- when :red : "\e[01;31m"
21
- when :green : "\e[01;32m"
22
- end
23
- end
24
- end
25
5
 
26
6
  file BUILD_STATUS_FILE => Dir.glob("Classes/*.[hm]") + Dir.glob("UnitTests/*.m") do
27
- failure_line = AutoTest::test
28
- if failure_line
29
- notice = ['Fail', failure_line.chomp]
30
- else
31
- notice = ['Pass']
32
- end
33
- AutoTest::growl *notice
7
+ notice = AutoTest::test_and_report
34
8
  File.open(BUILD_STATUS_FILE, 'w') {|f| f.write(notice * ": ")}
35
9
  end
36
10
 
@@ -50,27 +24,3 @@ end
50
24
 
51
25
 
52
26
 
53
- module AutoTest
54
- def self.test
55
- output = `xcodebuild -target "Unit Test" -configuration Debug -sdk iphonesimulator#{IPHONE_SDK_VERSION} 2>&1`
56
- failure_line = nil
57
- output.each do |line|
58
- if line =~ /error:|^Executed.*(\d+) failures|Undefined symbols|PurpleSystemEventPort|FAILED|Segmentation fault/
59
- if $1.nil? || $1.to_i > 0
60
- failure_line||= line
61
- line.colour = :red
62
- else
63
- line.colour = :green
64
- end
65
- end
66
- print line.coloured unless line =~/Merge mismatch|setenv/
67
- end
68
- failure_line
69
- end
70
-
71
- def self.growl title, msg =""
72
- img = "~/.autotest_images/#{title.downcase}.png"
73
- `growlnotify -H localhost -n autotest --image #{img} -p 0 -m #{msg.inspect} #{title}`
74
- end
75
-
76
- end
@@ -1,16 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require File.dirname(__FILE__) + '/autotest'
4
+
3
5
  require 'rubygems'
4
- require 'osx_watchfolder'
6
+
7
+ gem 'paulanthonywilson-osx_watchfolder'
5
8
  gem 'rake'
6
9
 
10
+ require 'osx_watchfolder'
7
11
 
8
12
  ARGV.clear
13
+ ARGV << 'auto:test:all'
14
+
15
+
16
+ AutoTest::test_and_report
9
17
 
10
- fork do
11
- ARGV << 'test_all'
12
- load 'rake'
13
- end
14
18
  OsxWatchfolder::FolderWatcher.new("Classes", "UnitTests") do
15
- fork{load 'rake'}
19
+ AutoTest::test_and_report
16
20
  end.start
@@ -0,0 +1,58 @@
1
+ class String
2
+ attr_accessor :colour
3
+ RESET="\e[00;m"
4
+
5
+ def coloured(colour = nil)
6
+ colour||=@colour
7
+ "#{colour_code(colour)}#{self}#{RESET}"
8
+ end
9
+
10
+ private
11
+ def colour_code colour
12
+ case colour
13
+ when :red : "\e[01;31m"
14
+ when :green : "\e[01;32m"
15
+ end
16
+ end
17
+ end
18
+
19
+ module AutoTest
20
+ def self.test_and_report
21
+ failure_line = test
22
+ report failure_line
23
+ end
24
+
25
+ def self.report failure_line
26
+ if failure_line
27
+ notice = ['Fail', failure_line.chomp]
28
+ else
29
+ notice = ['Pass']
30
+ end
31
+ AutoTest::growl *notice
32
+ notice
33
+ end
34
+
35
+ def self.test
36
+ puts "Build: #{Time::now}"
37
+ output = `xcodebuild -target "Unit Test" -configuration Debug -sdk iphonesimulator2.1 2>&1`
38
+ failure_line = nil
39
+ output.each do |line|
40
+ if line =~ /error:|^Executed.*(\d+) failures|Undefined symbols|PurpleSystemEventPort|FAILED|Segmentation fault/
41
+ if $1.nil? || $1.to_i > 0
42
+ failure_line||= line
43
+ line.colour = :red
44
+ else
45
+ line.colour = :green
46
+ end
47
+ end
48
+ print line.coloured unless line =~/Merge mismatch|setenv/
49
+ end
50
+ failure_line
51
+ end
52
+
53
+ def self.growl title, msg =""
54
+ img = "~/.autotest_images/#{title.downcase}.png"
55
+ `growlnotify -H localhost -n autotest --image #{img} -p 0 -m #{msg.inspect} #{title}`
56
+ end
57
+
58
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paulanthonywilson-iphone_testify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.02
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Wilson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-13 00:00:00 -07:00
12
+ date: 2009-04-20 00:00:00 -07:00
13
13
  default_executable: iphone_testify
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,7 @@ files:
64
64
  - skeleton/Rakefile
65
65
  - skeleton/UnitTests/put_unit_tests_here.txt
66
66
  - skeleton/autoiphonetest.rb
67
+ - skeleton/autotest.rb
67
68
  - skeleton/autotest_images/fail.png
68
69
  - skeleton/autotest_images/pass.png
69
70
  - skeleton/gitignore