class SLTProjectHelper

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# 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
options() click to toggle source
Calls superclass method
# File lib/slt_xcodeproj_helper.rb, line 14
def self.options
  [
      ['--path', 'project path'],
      ['--target', 'target path'],
      ['--key', 'build option name'],
      ['--value', 'build option value']
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# 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!() click to toggle source
Calls superclass method
# 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