Class: GAConfiguration
- Inherits:
-
Object
- Object
- GAConfiguration
- Defined in:
- lib/ga_configuration.rb
Overview
Constant Summary collapse
- GAConfigurationScheme =
"scheme"
- GAConfigurationWorkspace =
"workspace"
- GAConfigurationTarget =
"target"
- GAConfigurationSuffix =
"suffix"
- GAConfigurationReporter =
"reporter"
- GAConfigurationXctoolPath =
"xctool"
- GAConfigurationProject =
"project"
- GAConfigurationDefaultReporter =
"pretty"
- GAConfigurationDefaultXctoolPath =
"xctool"
- GAConfigurationDefaultSuffix =
"Test"
Class Method Summary collapse
-
.sample ⇒ GAConfiguration
Creates a sample GAConfiguration instance to instruct the user.
Instance Method Summary collapse
-
#initialize(configuration = { GAConfigurationSuffix => "Test", GAConfigurationReporter => "pretty", GAConfigurationXctoolPath => "xctool" }) ⇒ GAConfiguration
constructor
Creates an instance with the given configuration, or uses a default one if not provided.
-
#merge(other) ⇒ Object
Merges two GAConfiguration instances.
-
#project ⇒ Object
The configured xcode project, if not using workspaces.
-
#reporter ⇒ Object
The configured xctool reporter.
-
#scheme ⇒ Object
The configured xcode scheme.
-
#suffix ⇒ Object
The configured suffix for tests files.
-
#target ⇒ Object
The configured xcode tests target.
-
#to_s ⇒ Object
Prints the configuration instance.
-
#workspace ⇒ Object
The configured xcode workspace, if not using projects.
-
#xctool_path ⇒ Object
The configured xctool executable path.
Constructor Details
#initialize(configuration = { GAConfigurationSuffix => "Test", GAConfigurationReporter => "pretty", GAConfigurationXctoolPath => "xctool" }) ⇒ GAConfiguration
by default the #suffix is implied as “Test”, the #reporter as “pretty” and the #xctool_path as “xctool”
Creates an instance with the given configuration, or uses a default one if not provided
86 87 88 89 90 91 92 93 94 |
# File 'lib/ga_configuration.rb', line 86 def initialize(configuration = { GAConfigurationSuffix => "Test", GAConfigurationReporter => "pretty", GAConfigurationXctoolPath => "xctool" }) @scheme = configuration[GAConfigurationScheme] @workspace = configuration[GAConfigurationWorkspace] @target = configuration[GAConfigurationTarget] @suffix = configuration[GAConfigurationSuffix] @reporter = configuration[GAConfigurationReporter] @xctool_path = configuration[GAConfigurationXctoolPath] @project = configuration[GAConfigurationProject] end |
Class Method Details
.sample ⇒ GAConfiguration
Creates a sample GAConfiguration instance to instruct the user
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ga_configuration.rb', line 69 def self.sample sample = GAConfiguration.new({ GAConfigurationWorkspace => 'MyProject', GAConfigurationScheme => 'MyProject-Dev', GAConfigurationTarget => 'MyProjectTests', GAConfigurationSuffix => GAConfigurationDefaultSuffix, GAConfigurationReporter => GAConfigurationDefaultReporter, GAConfigurationXctoolPath => GAConfigurationDefaultXctoolPath }) return sample end |
Instance Method Details
#merge(other) ⇒ Object
nil values will not overwrite valid values of self
Merges two GAConfiguration instances
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ga_configuration.rb', line 100 def merge(other) @scheme = other.scheme unless other.scheme.nil? @workspace = other.workspace unless other.workspace.nil? @target = other.target unless other.target.nil? @suffix = other.suffix unless other.suffix.nil? @reporter = other.reporter unless other.reporter.nil? @xctool_path = other.xctool_path unless other.xctool_path.nil? @project = other.project unless other.project.nil? return self end |
#project ⇒ Object
Returns the configured xcode project, if not using workspaces.
21 22 23 |
# File 'lib/ga_configuration.rb', line 21 def project @project end |
#reporter ⇒ Object
Returns the configured xctool reporter.
41 42 43 |
# File 'lib/ga_configuration.rb', line 41 def reporter @reporter end |
#scheme ⇒ Object
Returns the configured xcode scheme.
16 17 18 |
# File 'lib/ga_configuration.rb', line 16 def scheme @scheme end |
#suffix ⇒ Object
Returns the configured suffix for tests files.
31 32 33 |
# File 'lib/ga_configuration.rb', line 31 def suffix @suffix end |
#target ⇒ Object
Returns the configured xcode tests target.
36 37 38 |
# File 'lib/ga_configuration.rb', line 36 def target @target end |
#to_s ⇒ Object
Prints the configuration instance
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ga_configuration.rb', line 52 def to_s hashForOutput = { GAConfigurationScheme => @scheme, GAConfigurationWorkspace => @workspace, GAConfigurationTarget => @target, GAConfigurationSuffix => @suffix, GAConfigurationReporter => @reporter, GAConfigurationXctoolPath => @xctool_path, GAConfigurationProject => @project } return hashForOutput.to_s end |
#workspace ⇒ Object
Returns the configured xcode workspace, if not using projects.
26 27 28 |
# File 'lib/ga_configuration.rb', line 26 def workspace @workspace end |
#xctool_path ⇒ Object
Returns the configured xctool executable path.
46 47 48 |
# File 'lib/ga_configuration.rb', line 46 def xctool_path @xctool_path end |