Class: Swiftproj::ConfigureSchemeCommand
- Inherits:
-
Command
- Object
- Command
- Swiftproj::ConfigureSchemeCommand
show all
- Defined in:
- lib/swiftproj/commands/configure_scheme_command.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
#command_class, command_name, #get_command, help_message, #initialize, #parse_options
Class Method Details
.description ⇒ Object
5
6
7
|
# File 'lib/swiftproj/commands/configure_scheme_command.rb', line 5
def self.description()
return "Configures a scheme to have buildable targets only"
end
|
.options ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/swiftproj/commands/configure_scheme_command.rb', line 9
def self.options()
return {
"--project" => "A xcodeproj path (e.g. ReactorKit.xcodeproj)",
"--scheme" => "A scheme name",
"--buildable-targets" => "Names for buildable target, seprated by comma (e.g. URLNavigator,URLMatcher)",
}
end
|
Instance Method Details
#run(options) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/swiftproj/commands/configure_scheme_command.rb', line 17
def run(options)
project_path = options["--project"]
scheme_name = options["--scheme"]
buildable_target_names = options["--buildable-targets"]
if project_path.nil?
raise Swiftproj::MissingArgumentError.new("--project")
end
if scheme_name.nil?
raise Swiftproj::MissingArgumentError.new("--scheme")
end
if buildable_target_names.nil?
raise Swiftproj::MissingArgumentError.new("--buildable-targets")
end
path = "#{project_path}/xcshareddata/xcschemes/#{scheme_name}.xcscheme"
begin
scheme = @scheme_class.new(path)
rescue
raise Swiftproj::NoSuchFileError.new(project_path)
end
target_names = buildable_target_names.split(",")
@core.configure_scheme_with_buildable_targets(scheme, target_names)
end
|