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 +4 -4
- data/lib/earlgrey/cli.rb +2 -3
- data/lib/earlgrey/configure_earlgrey.rb +28 -18
- data/lib/earlgrey/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8e040a4f6afd93eb064bddc70db2fa458afb93c
|
4
|
+
data.tar.gz: c5061cec15c361849b1141eac4c365346f24d105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e02d0cc69416a0e9c2d9ec36a71dd14f7bb378b82b933028e871a8d890e29efabaa28aa211e46d70fc4891878b8cb400802243a765959a7db32258edb464391
|
7
|
+
data.tar.gz: dba32b47751a5732d5fc8e3ae1ced9055d8ae657d862d59263621d8eb3873e5809cf1acdfc12b7ea345215a77b8dd1db635ce95c3bed29ed3f53287386f1b8c8
|
data/lib/earlgrey/cli.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
24
|
-
|
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
|
-
|
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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
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
|
data/lib/earlgrey/version.rb
CHANGED