Class: SLTProjectHelper
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- SLTProjectHelper
- Defined in:
- lib/slt_xcodeproj_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ SLTProjectHelper
constructor
A new instance of SLTProjectHelper.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ SLTProjectHelper
Returns a new instance of SLTProjectHelper.
23 24 25 26 27 28 29 |
# File 'lib/slt_xcodeproj_helper.rb', line 23 def initialize(argv) @path = argv.option('path','') @target = argv.option('target','') @key = argv.option('key','') @value = argv.option('value','') super end |
Class Method Details
.options ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/slt_xcodeproj_helper.rb', line 14 def self. [ ['--path', 'project path'], ['--target', 'target path'], ['--key', 'build option name'], ['--value', 'build option value'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/slt_xcodeproj_helper.rb', line 38 def run # read project project_path = @path project = Xcodeproj::Project.open(project_path) project.targets.each do |target| if target.name == @target target.build_configurations.each do |config| config.build_settings[@key] = @value end end end project.save end |
#validate! ⇒ Object
31 32 33 34 35 36 |
# File 'lib/slt_xcodeproj_helper.rb', line 31 def validate! super if @path.length == 0 || @target.length == 0 || @key.length == 0 || @value.length == 0 help! "para cannot be nil" end end |