iut 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ pkg/*
7
7
  .rvmrc
8
8
  .gemrc
9
9
  xcuserdata
10
+ tmp
data/LICENCE.txt ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2012, ITO SOFT DESIGN Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright notice,
9
+ this list of conditions and the following disclaimer in the documentation
10
+ and/or other materials provided with the distribution.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ iut
2
+ ====================
3
+ ---------------------
4
+
5
+ iut command generates iUnitTest’s empyt test project.
6
+ [iUnitTest](https://github.com/katsuyoshi/iunittest) is an unit testing framework for iOS applications.
7
+ After Xcode 4 released, the format of template project was changed. The aim of this command is to make a iUnitTest test project easily.
8
+
9
+ Requirement
10
+ ---------------------
11
+ * Ruby 1.8.7 or later
12
+
13
+ Installation
14
+ ---------------------
15
+ % gem install iut
16
+
17
+ How to use
18
+ ---------------------
19
+ % iut MyTestProject
20
+
21
+ Then MyTestProject directory was generated in the current directory.
22
+ It’s includes iUnitTest’s test project for Xcode 4.
23
+
24
+ Licence
25
+ ---------------------
26
+ BSD Licence
27
+
data/iut.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = "iut"
15
15
 
16
- s.files = `git ls-files`.split("\n")
16
+ s.files = `git ls-files`.split("\n").find_all{|f| !(/^script/ =~ f)}
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
@@ -0,0 +1,4 @@
1
+ # -*- encoding:UTF-8 -*-
2
+ module Iut
3
+ TEMPLATE_VERSION = "de6ccdc"
4
+ end
data/lib/iut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding:UTF-8 -*-
2
2
  module Iut
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
data/lib/iut.rb CHANGED
@@ -3,9 +3,10 @@ $:.unshift(File.expand_path(File.dirname(__FILE__))) unless
3
3
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
4
4
 
5
5
  require "iut/version"
6
+ require "iut/template_version"
6
7
  require "iut/generator"
7
8
 
8
- Version = Iut::VERSION
9
+ Version = "#{Iut::VERSION} (template #{Iut::TEMPLATE_VERSION})"
9
10
 
10
11
  opt = OptionParser.new
11
12
  opt.banner = "Usage: #{$0} TEST_PROJECT_NAME"
@@ -48,7 +48,7 @@
48
48
  [super dealloc];
49
49
  }
50
50
 
51
- - (void)collectTestsForClass:(Class)klass
51
+ - (void)collectTestKeywordTestsForClass:(Class)klass
52
52
  {
53
53
  unsigned int count;
54
54
  NSRange range = NSMakeRange(0, [@"test" length]);
@@ -67,6 +67,31 @@
67
67
  free(methods);
68
68
  }
69
69
 
70
+ - (void)collectShouldKeywordTestsForClass:(Class)klass
71
+ {
72
+ unsigned int count;
73
+ Method *methods = class_copyMethodList(klass, &count);
74
+ Method *methodPtr = methods;
75
+ for (int i = 0; i < count; i++, methodPtr++) {
76
+ Method aMethod = *methodPtr;
77
+ NSString *selectorName = NSStringFromSelector(method_getName(aMethod));
78
+ NSRange ragne = [selectorName rangeOfString:@"Should"];
79
+ if (ragne.location != NSNotFound) {
80
+ // if already has selectorName, it will be overrided. Then ignore this methods.
81
+ if (![tests containsObject:selectorName]) {
82
+ [tests addObject:selectorName];
83
+ }
84
+ }
85
+ }
86
+ free(methods);
87
+ }
88
+
89
+ - (void)collectTestsForClass:(Class)klass
90
+ {
91
+ [self collectTestKeywordTestsForClass:klass];
92
+ [self collectShouldKeywordTestsForClass:klass];
93
+ }
94
+
70
95
  - (void)collectTests
71
96
  {
72
97
  Class rootClass = [IUTTest class];
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  # -*- coding:UTF-8 -*-
2
3
  require "fileutils"
3
4
 
@@ -10,9 +11,6 @@ FileUtils.mkdir_p dst_path
10
11
  Dir.chdir(dst_path) do
11
12
  unless File.exist? "iunittest"
12
13
  system "git clone git@github.com:katsuyoshi/iunittest.git"
13
- Dir.chdir "iunittest" do
14
- system "git checkout -b xcode4 origin/xcode4"
15
- end
16
14
  end
17
15
  src_path = "../iUnitTest/iunittest"
18
16
  dst_path = "iunittest/iUnitTest/iUnitTest"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000Z
12
+ date: 2012-01-19 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: ! 'After Xcode 4 released, the format of template project was changed.
15
15
  The aim of this command is to make a iUnitTest test project easily. '
@@ -22,11 +22,14 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - .gitignore
24
24
  - Gemfile
25
+ - LICENCE.txt
26
+ - README.md
25
27
  - Rakefile
26
28
  - bin/iut
27
29
  - iut.gemspec
28
30
  - lib/iut.rb
29
31
  - lib/iut/generator.rb
32
+ - lib/iut/template_version.rb
30
33
  - lib/iut/version.rb
31
34
  - template/project/iUnitTest/TEST_PROJECT.xcodeproj/project.pbxproj
32
35
  - template/project/iUnitTest/iUnitTest/Classes/.do_not_remove_this_directory