guard-ocunit 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9e3e4a66b277e0f15f809a0b545d34fdda13f57
4
- data.tar.gz: 787243eec56230d7b9375f828bfe29583dacb774
3
+ metadata.gz: f3693467e7c421fa2ae3e31ce689a2cb057e6ca5
4
+ data.tar.gz: 31d888a945ff841994b01a31ec27f760636532b3
5
5
  SHA512:
6
- metadata.gz: 28d7add451ce1979eb0473c9d1c4ae90da4cffce046c987747f5f202b26af89930477a50d2072e6c7eea2cfb9d3e0b4f706feb66462692bc56e5dd8939fcf5c3
7
- data.tar.gz: 45e13926518e42ece3652047ec416ec7fd8025e69d1ebfc722e2ecbf07ad13907574eef8cc8324e83b093dd17c2eab5e57c034218b9cb16971d8015b9db89dff
6
+ metadata.gz: 8d66ef2adb5f7d5d0996b6d9d84bcfbea4b1dbd0cd1e2648819f3b2be240bfb9d955ae7e854e967540fa617cdc662c1cc1ac477f877050633e233fe7935f81e0
7
+ data.tar.gz: 110c8ac5ff41a4ab3885fef1b0655cce6320d6b601d7f688e4ae8974b87325116a96ea270a2999da974431a87fc2f83ba1fa322413b49128c142d7cc36909146
data/README.md CHANGED
@@ -9,18 +9,20 @@ OCUnit guard allows to automatically launch tests when files are modified.
9
9
 
10
10
  Please be sure to have [Guard](https://github.com/guard/guard) and [ios-sim](https://github.com/phonegap/ios-sim) installed before continue. `guard-ocunit` uses `ios-sim` for running `application` tests from command line, for more info refer to the [SO](http://stackoverflow.com/questions/12557935/xcode-4-5-command-line-unit-testing) question.
11
11
 
12
- Install the gem:
12
+ * Install the gem:
13
13
 
14
- ```
14
+ ```bash
15
15
  $ gem install guard-ocunit
16
16
  ```
17
17
 
18
- Add guard definition to your Guardfile by running this command:
18
+ * Add guard definition to your Guardfile by running this command:
19
19
 
20
- ```
20
+ ```bash
21
21
  $ guard init ocunit
22
22
  ```
23
23
 
24
+ * Enable `Run` in the `Build` section of your test bundle’s scheme.
25
+
24
26
  ## Usage
25
27
 
26
28
  Please read [Guard usage doc](https://github.com/guard/guard#readme)
@@ -28,10 +28,10 @@ class Guard::OCUnit::Formatter < Array
28
28
  when /(started|Executed|finished)/
29
29
  @verbose ? line : ''
30
30
  when /^#{Date.today}/
31
- @verbose ? line.yellow : ''
31
+ line
32
32
  else
33
33
  @current_failure << line unless line.strip.empty?
34
- @verbose ? line : ''
34
+ @verbose ? line.yellow : ''
35
35
  end
36
36
  self
37
37
  end
@@ -48,9 +48,10 @@ class Guard::OCUnit::Formatter < Array
48
48
  end
49
49
 
50
50
  def dump_error_messages
51
+ puts "\n\n"
51
52
  return if @error_messages.empty?
52
53
 
53
- puts "\n\nFailures:\n"
54
+ puts "Failures:\n"
54
55
  puts @error_messages.join + "\n"
55
56
  end
56
57
 
@@ -119,7 +120,7 @@ private
119
120
 
120
121
  def failure_case(failure)
121
122
  components = failure.split(':')
122
- case_name = "\n#{@error_messages.size + 1}."
123
+ case_name = "\n #{@error_messages.size + 1}."
123
124
  case_name << components[3]
124
125
  end
125
126
 
@@ -17,7 +17,7 @@ module Guard
17
17
  def initialize(options = {})
18
18
  @options = {
19
19
  :test_bundle => nil,
20
- :derived_data => '/tmp/tests/',
20
+ :derived_data => nil,
21
21
  :workspace => nil,
22
22
  :scheme => nil,
23
23
  :project => nil,
@@ -42,11 +42,13 @@ module Guard
42
42
 
43
43
  def xcodebuild(options = {})
44
44
  options = @options.merge(options)
45
- path_variables(options)
45
+ update_build_path(nil, options)
46
46
 
47
47
  formatter = XcodeBuild::Formatters::ProgressFormatter.new
48
48
  reporter = XcodeBuild::Reporter.new(formatter)
49
49
  output_buffer = XcodeBuild::OutputTranslator.new(reporter)
50
+ path_handler = BuildPathHandler.new
51
+ reporter.direct_raw_output_to = path_handler
50
52
 
51
53
  arguments = []
52
54
  arguments << "-workspace #{options[:workspace]}" unless options[:workspace].to_s.empty?
@@ -57,18 +59,21 @@ module Guard
57
59
  arguments << "-alltargets" if options[:workspace].to_s.empty?
58
60
  arguments << "clean" if options[:clean]
59
61
  arguments << "build"
60
- arguments << "CONFIGURATION_BUILD_DIR=#{@built_products_dir}"
62
+ arguments << "CONFIGURATION_BUILD_DIR=#{@built_products_dir}" if @derived_data
61
63
  arguments << options[:build_variables] unless options[:build_variables].to_s.empty?
62
64
 
63
- XcodeBuild.run(arguments.compact.join(' '), output_buffer)
65
+ build_result = XcodeBuild.run(arguments.compact.join(' '), output_buffer)
66
+ update_build_path(path_handler.build_path, options)
67
+ build_result
64
68
  end
65
69
 
66
70
  private
67
71
 
68
- def path_variables(options)
72
+ def update_build_path(build_path, options)
69
73
  project_folder = options[:project] && File.dirname(options[:project])
70
74
  @derived_data = project_folder || options[:derived_data]
71
- @built_products_dir = File.join(@derived_data, 'build/')
75
+ joined_path = File.join(@derived_data, 'build/') if @derived_data
76
+ @built_products_dir = build_path || joined_path || '/tmp/tests/build/'
72
77
 
73
78
  scheme_name = options[:scheme]
74
79
  @test_bundle_path = File.join(@built_products_dir, "#{options[:test_bundle]}.octest")
@@ -126,5 +131,16 @@ module Guard
126
131
  command.compact.join(' ')
127
132
  end
128
133
  end
134
+
135
+ class BuildPathHandler
136
+
137
+ attr_reader :build_path
138
+
139
+ def <<(line)
140
+ match = line.match(/setenv BUILT_PRODUCTS_DIR (?<build_path>.*)/)
141
+ @build_path = match['build_path'] if match
142
+ end
143
+ end
144
+
129
145
  end
130
146
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module OCUnitVersion
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-ocunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Evstifeev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-14 00:00:00.000000000 Z
11
+ date: 2013-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard