earlgrey 0.0.6 → 0.0.7

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: 2d955002733c9d4df4ce57b6254331fc70e30a4c
4
- data.tar.gz: 32798a192534763c1c002a357aa1196023adb4d1
3
+ metadata.gz: f8e040a4f6afd93eb064bddc70db2fa458afb93c
4
+ data.tar.gz: c5061cec15c361849b1141eac4c365346f24d105
5
5
  SHA512:
6
- metadata.gz: 01d287d05b1ea8829ea4c1168ca97bd1139e9caa9f66392327a49435a156ece7ad1b7a0aacd2effb2e32cd2c4fa8499bbc27c64ae43b2fc7cab3426fccfd2c69
7
- data.tar.gz: 5595d536f1de746d356778fcc839b6fe61d5d3221e811f38706bd70d29ef0e19156fd6a3d344dc3f39aeedd6ba8cd5c96015a53f649af5506f912cb664a4a4fe
6
+ metadata.gz: 1e02d0cc69416a0e9c2d9ec36a71dd14f7bb378b82b933028e871a8d890e29efabaa28aa211e46d70fc4891878b8cb400802243a765959a7db32258edb464391
7
+ data.tar.gz: dba32b47751a5732d5fc8e3ae1ced9055d8ae657d862d59263621d8eb3873e5809cf1acdfc12b7ea345215a77b8dd1db635ce95c3bed29ed3f53287386f1b8c8
@@ -36,8 +36,7 @@ module EarlGrey
36
36
 
37
37
  # CLI will never use Cocoapod's `post_install do |installer|`
38
38
  podfile_installer = nil
39
- EarlGrey.swift = o[SWIFT]
40
- EarlGrey.carthage = o[CARTHAGE]
39
+ opts = { swift: o[SWIFT], carthage: o[CARTHAGE] }
41
40
 
42
41
  # Use target as the default Scheme name.
43
42
  o[SCHEME] ||= o[TARGET]
@@ -45,7 +44,7 @@ module EarlGrey
45
44
  o[PROJECT] ||= Dir.glob(File.join(Dir.pwd, '*.xcodeproj')).first
46
45
  raise 'No project found' unless o[PROJECT]
47
46
 
48
- EarlGrey.configure_for_earlgrey podfile_installer, o[PROJECT], o[TARGET], o[SCHEME]
47
+ EarlGrey.configure_for_earlgrey podfile_installer, o[PROJECT], o[TARGET], o[SCHEME], opts
49
48
  end
50
49
  end
51
50
  end
@@ -20,15 +20,16 @@ end
20
20
 
21
21
  module EarlGrey
22
22
  class << self
23
- attr_accessor :swift, :carthage
24
- attr_reader :project_name, :test_target, :test_target_name, :scheme_file, :user_project
23
+ attr_reader :project_name, :test_target, :test_target_name, :scheme_file,
24
+ :user_project, :swift, :carthage
25
25
 
26
26
  # Returns path to Xcode file, prepending current working dir if necessary.
27
27
  # @param xcode_file [String] xcode file path
28
28
  # @param ext [String] xcode file extension
29
29
  # @return [String] path to Xcode file
30
30
  def path_for(xcode_file, ext)
31
- return xcode_file if File.exist? xcode_file
31
+ ext_match = File.extname(xcode_file) == ext
32
+ return xcode_file if File.exist?(xcode_file) && ext_match
32
33
 
33
34
  path = File.join(Dir.pwd, File.basename(xcode_file, '.*') + ext)
34
35
  path ? path : nil
@@ -62,14 +63,10 @@ module EarlGrey
62
63
  puts strip(string).yellow
63
64
  end
64
65
 
65
- # Main entry point. Configures An Xcode project for use with EarlGrey.
66
- #
67
- # @param installer [Installer] Cococapods installer object or nil.
68
- # @param project_name [String] the xcodeproj file name
69
- # @param test_target_name [String] the test target name contained in xcodeproj
70
- # @param scheme_file [String] the scheme file name. defaults to project name when nil.
71
- # @return [nil]
72
- def configure_for_earlgrey(installer, project_name, test_target_name, scheme_file)
66
+ def set_defaults(installer, project_name, test_target_name, scheme_file, opts={})
67
+ @swift = opts.fetch(:swift, false)
68
+ @carthage = opts.fetch(:carthage, false)
69
+
73
70
  puts_blue "Checking and Updating #{project_name} for EarlGrey."
74
71
  pods_project = installer ? installer.pods_project : true
75
72
  project_file = path_for project_name, '.xcodeproj'
@@ -99,6 +96,17 @@ module EarlGrey
99
96
  Targets are: #{all_targets.map(&:name)}
100
97
  E
101
98
  end
99
+ end
100
+
101
+ # Main entry point. Configures An Xcode project for use with EarlGrey.
102
+ #
103
+ # @param installer [Installer] Cococapods installer object or nil.
104
+ # @param project_name [String] the xcodeproj file name
105
+ # @param test_target_name [String] the test target name contained in xcodeproj
106
+ # @param scheme_file [String] the scheme file name. defaults to project name when nil.
107
+ # @return [nil]
108
+ def configure_for_earlgrey(installer, project_name, test_target_name, scheme_file, opts={})
109
+ set_defaults(installer, project_name, test_target_name, scheme_file, opts)
102
110
 
103
111
  # Add a Test Action to the User Project Scheme.
104
112
  scheme = modify_scheme_for_actions
@@ -382,13 +390,15 @@ module EarlGrey
382
390
  test_target.frameworks_build_phase.add_file_reference framework_ref
383
391
  end
384
392
 
385
- # Add shell script phase
386
- shell_script_name = 'Carthage copy-frameworks Run Script'
387
- unless test_target.shell_script_build_phases.map(&:name).include?(shell_script_name)
388
- shell_script = test_target.new_shell_script_build_phase shell_script_name
389
- shell_script.shell_path = '/bin/bash'
390
- shell_script.shell_script = '/usr/local/bin/carthage copy-frameworks'
391
- shell_script.input_paths = ['$(SRCROOT)/Carthage/Build/iOS/EarlGrey.framework']
393
+ if carthage
394
+ # Add shell script phase
395
+ shell_script_name = 'Carthage copy-frameworks Run Script'
396
+ unless test_target.shell_script_build_phases.map(&:name).include?(shell_script_name)
397
+ shell_script = test_target.new_shell_script_build_phase shell_script_name
398
+ shell_script.shell_path = '/bin/bash'
399
+ shell_script.shell_script = '/usr/local/bin/carthage copy-frameworks'
400
+ shell_script.input_paths = ['$(SRCROOT)/Carthage/Build/iOS/EarlGrey.framework']
401
+ end
392
402
  end
393
403
 
394
404
  user_project.save
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module EarlGrey
17
- VERSION = '0.0.6'.freeze unless defined? ::EarlGrey::VERSION
17
+ VERSION = '0.0.7'.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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - khandpur