guard-ocunit 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cba6bfe95a4f901658a14c7111990bcac70fbd1a
4
- data.tar.gz: 6d15615d67f17e36627c0d9dd665cc84903f6225
3
+ metadata.gz: bb27a20f78e03695a7558322e272770c678afcf0
4
+ data.tar.gz: c214709b2ec4a90a684bbf5262c501194a4212f4
5
5
  SHA512:
6
- metadata.gz: c3f934c4046491b03dacb5bcfc32097f05930f052754187228b92d8f416d1a753d11de70c7a182fadae1527224d3c4800adbf223cd1454d9687ded0c9731909c
7
- data.tar.gz: e9302369a697fe5e5deb2c440eb4c111f5d736330aa2eba715333da8a702925db89dc728fdb6a930c17856035c09070740cdf3dd6030b67a3f485b4cf352812f
6
+ metadata.gz: ae983796219f21c93ab91528f9aba439f5fcf7afdf2a0f2224a1292124511338b01fbf4bdae0935e382fa7367e3d89ffba0f578b18f5b260db9f04723beb4874
7
+ data.tar.gz: bc01562eba557ff9f443e5a69b0aa408ed12ea069377e862bb94e2cfec5bfc9984f578d97fd00ec7b1d3252ea21ad9a19b100114e3df517f565ca6b956cc37ee
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Guard::OCUnit [![Build Status](https://secure.travis-ci.org/ap4y/guard-ocunit.png?branch=master)](http://travis-ci.org/ap4y/guard-ocunit)
2
2
 
3
- OCUnit guard allows to automatically launch tests when files are modified.
3
+ OCUnit guard allows to automatically launch `OCUnit` tests when files source files are modified.
4
4
 
5
5
  * Compatible with XCode 4.x
6
6
  * Tested with XCode 4.5.
@@ -9,18 +9,32 @@ 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
  ```
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
  ```
21
21
  $ guard init ocunit
22
22
  ```
23
23
 
24
+ * Change `Run Script` phase for test target to:
25
+
26
+ ```bash
27
+ if [ "$RUN_UNIT_TEST_WITH_IOS_SIM" = "YES" ]; then
28
+ test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
29
+ ios-sim launch "$(dirname "$TEST_HOST")" --setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle="$test_bundle_path" --setenv XCInjectBundleInto="$TEST_HOST" --args -SenTest All "$test_bundle_path"
30
+ echo "Finished running tests with ios-sim"
31
+ else
32
+ "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
33
+ fi
34
+ ```
35
+
36
+ * Enable `Run` in the `Build` section of your test bundle’s scheme. (See http://www.raingrove.com/2012/03/28/running-ocunit-and-specta-tests-from-command-line.html).
37
+
24
38
  ## Usage
25
39
 
26
40
  Please read [Guard usage doc](https://github.com/guard/guard#readme)
@@ -1,11 +1,6 @@
1
1
  require 'guard/ocunit'
2
2
  require 'colored'
3
3
 
4
- if RUBY_VERSION =~ /1.9/ #bug with output parsing
5
- Encoding.default_external = Encoding::UTF_8
6
- Encoding.default_internal = Encoding::UTF_8
7
- end
8
-
9
4
  class Guard::OCUnit::Formatter < Array
10
5
  attr_reader :passed, :failed, :start_time
11
6
 
@@ -25,7 +20,7 @@ class Guard::OCUnit::Formatter < Array
25
20
  @failed += 1
26
21
  line.red
27
22
  when /(error|otest)/
28
- line.red
23
+ line.split(':')[3..-1].join(' ').yellow
29
24
  else
30
25
  @verbose ? line : ''
31
26
  end
@@ -44,12 +44,9 @@ module Guard
44
44
  options = @options.merge(options)
45
45
  path_variables(options)
46
46
 
47
- # REVIEW: currently not all error messages are going to the output via
48
- # formatter, decided to disable it
49
-
50
- # formatter = XcodeBuild::Formatters::ProgressFormatter.new
51
- # reporter = XcodeBuild::Reporter.new(formatter)
52
- # output_buffer = XcodeBuild::OutputTranslator.new(reporter)
47
+ formatter = XcodeBuild::Formatters::ProgressFormatter.new
48
+ reporter = XcodeBuild::Reporter.new(formatter)
49
+ output_buffer = XcodeBuild::OutputTranslator.new(reporter)
53
50
 
54
51
  arguments = []
55
52
  arguments << "-workspace #{options[:workspace]}" unless options[:workspace].to_s.empty?
@@ -63,7 +60,7 @@ module Guard
63
60
  arguments << "CONFIGURATION_BUILD_DIR=#{@built_products_dir}"
64
61
  arguments << options[:build_variables] unless options[:build_variables].to_s.empty?
65
62
 
66
- XcodeBuild.run(arguments.compact.join(' '), STDOUT)
63
+ XcodeBuild.run(arguments.compact.join(' '), output_buffer)
67
64
  end
68
65
 
69
66
  private
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module OCUnitVersion
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
data/lib/guard/ocunit.rb CHANGED
@@ -33,7 +33,7 @@ module Guard
33
33
 
34
34
  def run_all
35
35
  options = @options[:run_all].merge(:message => 'Running all tests',
36
- :clean => true)
36
+ :clean => false)
37
37
  passed = @runner.run(['All'], options)
38
38
 
39
39
  unless @last_failed = !passed
@@ -45,6 +45,9 @@ module Guard
45
45
 
46
46
  def reload
47
47
  @failed_paths = []
48
+ options = @options[:run_all].merge(:message => 'Cleaning and running all tests',
49
+ :clean => true)
50
+ @runner.run(['All'], options)
48
51
  end
49
52
 
50
53
  def run_on_changes(paths)
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.0
4
+ version: 0.1.1
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-05 00:00:00.000000000 Z
11
+ date: 2013-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.1'
111
- description: Guard::OCUnit automatically runs your tests.
111
+ description: Guard::OCUnit automatically runs your OCUnit(SenTest) tests
112
112
  email:
113
113
  - lod@pisem.net
114
114
  executables: []