earlgrey 0.1.1 → 0.1.3

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: 46aa3e8075a3c2e64532d02147f9c8af44011465
4
- data.tar.gz: ecd5085ef4ed240ee96472697cd9d6b49cf34008
3
+ metadata.gz: 9470ec4d55223545549f0cff7e10ab358d8432f2
4
+ data.tar.gz: 0ea808ef1fb028ad51e6ed111f87e8526fdb78b2
5
5
  SHA512:
6
- metadata.gz: 16593d96574caa5dfe4d6b7034010b2df5c237b27e42a55cc4e8dbcdc3fcd175def3ead2f28e04e6e9c792441938455606d9adf966cf1af03b816ca4fed57e97
7
- data.tar.gz: 1cad513f5e793f5737d91325164e90fd329de205abce70ffed1e6cbd1a1cfcb42e34e27361c54e73f6a4d4fb5f47430b068619e92bfd1cf00d0b71e16075c1d5
6
+ metadata.gz: 658d37923f9456953c0c925859ecc23de782b26b953e8442d15ab8722a6b4a11c7efd8e745823c6ab7027cebff7ff01ae7d9e88ef69abac564e28abff2aaab29
7
+ data.tar.gz: 6cb926fa4edbb13449a5908b0d5a1c3754563c4af2143310d6e0eabba416f59b6db37baae337d70ab12695c7a1b566b4a472eed58723e0e25a009cb2e459a241
@@ -126,7 +126,7 @@ module EarlGrey
126
126
  # Add header/framework search paths for carthage
127
127
  add_carthage_search_paths
128
128
 
129
- # Adds BridgingHeader.h, EarlGrey.swift and sets bridging header.
129
+ # Adds EarlGrey.swift
130
130
  copy_swift_files
131
131
 
132
132
  save_earlgrey_scheme_changes(scheme) unless scheme.nil?
@@ -334,11 +334,8 @@ module EarlGrey
334
334
  user_project.save
335
335
  end
336
336
 
337
- SWIFT_OBJC_BRIDGING_HEADER = 'SWIFT_OBJC_BRIDGING_HEADER'.freeze
338
-
339
- # Copies Swift bridging header and configures the test target's build configuration to use it.
340
337
  # Copies EarlGrey.swift and adds it to the project.
341
- # Adds EarlGrey.swift and BridgingHeader.h to project's test target group.
338
+ # Adds EarlGrey.swift to project's test target group.
342
339
  # Adds EarlGrey.swift to testing target's source build phase
343
340
  # Adds Link Binary With Libraries phase to test target for EarlGrey.framework
344
341
  # Adds shell script phase that runs Carthage copy-frameworks
@@ -346,31 +343,17 @@ module EarlGrey
346
343
  # No op if swift isn't true
347
344
  def copy_swift_files
348
345
  return unless swift
349
- bridge_path = '$(TARGET_NAME)/BridgingHeader.h'
350
-
351
- test_target.build_configurations.each do |config|
352
- settings = config.build_settings
353
- settings[SWIFT_OBJC_BRIDGING_HEADER] = bridge_path
354
- end
355
-
356
- user_project.save
357
346
 
358
347
  src_root = File.join(__dir__, 'files')
359
348
  dst_root = File.join(dir_path, test_target_name)
360
349
  raise "Missing target folder #{dst_root}" unless File.exist? dst_root
361
350
 
362
- src_header_name = 'BridgingHeader.h'
363
- src_header = File.join(src_root, src_header_name)
364
- raise 'Bundled header missing' unless File.exist? src_header
365
- dst_header = File.join(dst_root, src_header_name)
366
-
367
351
  src_swift_name = 'EarlGrey.swift'
368
352
  src_swift = File.join(src_root, "Swift-#{swift_version}", src_swift_name)
369
353
 
370
354
  raise 'Bundled swift missing' unless File.exist? src_swift
371
355
  dst_swift = File.join(dst_root, src_swift_name)
372
356
 
373
- FileUtils.copy src_header, dst_header
374
357
  FileUtils.copy src_swift, dst_swift
375
358
 
376
359
  project_test_targets = user_project.main_group.children
@@ -378,7 +361,7 @@ module EarlGrey
378
361
  raise "Test target group not found! #{test_target_group}" unless test_target_group
379
362
 
380
363
  # Add files to testing target group otherwise Xcode can't read them.
381
- new_files = [src_header_name, src_swift_name]
364
+ new_files = [src_swift_name]
382
365
  existing_files = test_target_group.children.map(&:display_name)
383
366
 
384
367
  new_files.each do |file|
@@ -14,6 +14,13 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
+ import EarlGrey
18
+ import Foundation
19
+
20
+ let greyFailureHandler =
21
+ NSThread.currentThread().threadDictionary
22
+ .valueForKey(kGREYFailureHandlerKey) as! GREYFailureHandler
23
+
17
24
  public func grey_allOfMatchers(args: AnyObject...) -> GREYMatcher! {
18
25
  return GREYAllOf(matchers: args)
19
26
  }
@@ -14,6 +14,9 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
+ import EarlGrey
18
+ import Foundation
19
+
17
20
  public func GREYAssert(_ expression: @autoclosure () -> Bool, reason: String) {
18
21
  GREYAssert(expression, reason, details: "Expected expression to be true")
19
22
  }
@@ -81,6 +84,8 @@ private func GREYAssert(_ expression: @autoclosure () -> Bool,
81
84
  private func GREYSetCurrentAsFailable() {
82
85
  let greyFailureHandlerSelector =
83
86
  #selector(GREYFailureHandler.setInvocationFile(_:andInvocationLine:))
87
+ let greyFailureHandler =
88
+ Thread.current.threadDictionary.value(forKey: kGREYFailureHandlerKey) as! GREYFailureHandler
84
89
  if greyFailureHandler.responds(to: greyFailureHandlerSelector) {
85
90
  greyFailureHandler.setInvocationFile!(#file, andInvocationLine:#line)
86
91
  }
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module EarlGrey
17
- VERSION = '0.1.1'.freeze unless defined? ::EarlGrey::VERSION
17
+ VERSION = '0.1.3'.freeze unless defined? ::EarlGrey::VERSION
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earlgrey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - khandpur
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-11-08 00:00:00.000000000 Z
13
+ date: 2016-12-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: colored
@@ -136,8 +136,6 @@ files:
136
136
  - lib/earlgrey/cli.rb
137
137
  - lib/earlgrey/configure_earlgrey.rb
138
138
  - lib/earlgrey/earlgrey.rb
139
- - lib/earlgrey/files/BridgingHeader.h
140
- - lib/earlgrey/files/Swift-2.2/EarlGrey.swift
141
139
  - lib/earlgrey/files/Swift-2.3/EarlGrey.swift
142
140
  - lib/earlgrey/files/Swift-3.0/EarlGrey.swift
143
141
  - lib/earlgrey/version.rb
@@ -161,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
159
  version: '0'
162
160
  requirements: []
163
161
  rubyforge_project:
164
- rubygems_version: 2.0.14.1
162
+ rubygems_version: 2.5.2
165
163
  signing_key:
166
164
  specification_version: 4
167
165
  summary: EarlGrey installer gem
@@ -1,16 +0,0 @@
1
- //
2
- // Copyright 2016 Google Inc.
3
- //
4
- // Licensed under the Apache License, Version 2.0 (the "License");
5
- // you may not use this file except in compliance with the License.
6
- // You may obtain a copy of the License at
7
- //
8
- // http://www.apache.org/licenses/LICENSE-2.0
9
- //
10
- // Unless required by applicable law or agreed to in writing, software
11
- // distributed under the License is distributed on an "AS IS" BASIS,
12
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- // See the License for the specific language governing permissions and
14
- // limitations under the License.
15
-
16
- #import <EarlGrey/EarlGrey.h>
@@ -1,111 +0,0 @@
1
- //
2
- // Copyright 2016 Google Inc.
3
- //
4
- // Licensed under the Apache License, Version 2.0 (the "License");
5
- // you may not use this file except in compliance with the License.
6
- // You may obtain a copy of the License at
7
- //
8
- // http://www.apache.org/licenses/LICENSE-2.0
9
- //
10
- // Unless required by applicable law or agreed to in writing, software
11
- // distributed under the License is distributed on an "AS IS" BASIS,
12
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- // See the License for the specific language governing permissions and
14
- // limitations under the License.
15
- //
16
-
17
- public func grey_allOfMatchers(args: AnyObject...) -> GREYMatcher! {
18
- return GREYAllOf(matchers: args)
19
- }
20
-
21
- public func grey_anyOfMatchers(args: AnyObject...) -> GREYMatcher! {
22
- return GREYAnyOf(matchers: args)
23
- }
24
-
25
- public func EarlGrey(file: String = #file, line: UInt = #line) -> EarlGreyImpl! {
26
- return EarlGreyImpl.invokedFromFile(file, lineNumber: line)
27
- }
28
-
29
- public func GREYAssert(@autoclosure expression: () -> BooleanType, reason: String) {
30
- GREYAssert(expression, reason, details: "Expected expression to be true")
31
- }
32
-
33
- public func GREYAssertTrue(@autoclosure expression: () -> BooleanType, reason: String) {
34
- GREYAssert(expression().boolValue,
35
- reason,
36
- details: "Expected the boolean expression to be true")
37
- }
38
-
39
- public func GREYAssertFalse(@autoclosure expression: () -> BooleanType, reason: String) {
40
- GREYAssert(!expression().boolValue,
41
- reason,
42
- details: "Expected the boolean expression to be false")
43
- }
44
-
45
- public func GREYAssertNotNil(@autoclosure expression: () -> Any?, reason: String) {
46
- GREYAssert(expression() != nil, reason, details: "Expected expression to be not nil")
47
- }
48
-
49
- public func GREYAssertNil(@autoclosure expression: () -> Any?, reason: String) {
50
- GREYAssert(expression() == nil, reason, details: "Expected expression to be nil")
51
- }
52
-
53
- public func GREYAssertEqual(@autoclosure left: () -> AnyObject?,
54
- @autoclosure _ right: () -> AnyObject?, reason: String) {
55
- GREYAssert(left() === right(), reason, details: "Expected left term to be equal to right term")
56
- }
57
-
58
- public func GREYAssertNotEqual(@autoclosure left: () -> AnyObject?,
59
- @autoclosure _ right: () -> AnyObject?, reason: String) {
60
- GREYAssert(left() !== right(), reason, details: "Expected left term to not be equal to right" +
61
- " term")
62
- }
63
-
64
- public func GREYAssertEqualObjects<T : Equatable>(@autoclosure left: () -> T?,
65
- @autoclosure _ right: () -> T?, reason: String) {
66
- GREYAssert(left() == right(), reason, details: "Expected object of the left term to be equal" +
67
- " to the object of the right term")
68
- }
69
-
70
- public func GREYAssertNotEqualObjects<T : Equatable>(@autoclosure left: () -> T?,
71
- @autoclosure _ right: () -> T?, reason: String) {
72
- GREYAssert(left() != right(), reason, details: "Expected object of the left term to not be" +
73
- " equal to the object of the right term")
74
- }
75
-
76
- public func GREYFail(reason: String) {
77
- greyFailureHandler.handleException(GREYFrameworkException(name: kGREYAssertionFailedException,
78
- reason: reason),
79
- details: "")
80
- }
81
-
82
- @available(*, deprecated=1.2.0, message="Please use GREYFAIL::withDetails instead.")
83
- public func GREYFail(reason: String, details: String) {
84
- greyFailureHandler.handleException(GREYFrameworkException(name: kGREYAssertionFailedException,
85
- reason: reason),
86
- details: details)
87
- }
88
-
89
- public func GREYFailWithDetails(reason: String, details: String) {
90
- greyFailureHandler.handleException(GREYFrameworkException(name: kGREYAssertionFailedException,
91
- reason: reason),
92
- details: details)
93
- }
94
-
95
- private func GREYAssert(@autoclosure expression: () -> BooleanType,
96
- _ reason: String, details: String) {
97
- GREYSetCurrentAsFailable()
98
- if !expression().boolValue {
99
- greyFailureHandler.handleException(GREYFrameworkException(name: kGREYAssertionFailedException,
100
- reason: reason),
101
- details: details)
102
- }
103
- }
104
-
105
- private func GREYSetCurrentAsFailable(file: String = #file, line: UInt = #line) {
106
- let greyFailureHandlerSelector =
107
- #selector(GREYFailureHandler.setInvocationFile(_:andInvocationLine:))
108
- if greyFailureHandler.respondsToSelector(greyFailureHandlerSelector) {
109
- greyFailureHandler.setInvocationFile!(file, andInvocationLine: line)
110
- }
111
- }