class MFXcode::Plugins::Delfileref

Delete files references in the Xcode project

Public Instance Methods

help() click to toggle source
# File lib/mfxcode/plugins/delfileref.rb, line 27
  def help
    {:short => 'delete files references in the Xcode project',
     :long => <<"END" }
Usage: delfileref project_path file [file file ...]

Delete files references in the project at the given path.
END
  end
run(args) click to toggle source
# File lib/mfxcode/plugins/delfileref.rb, line 36
def run(args)
  if args.count >= 2

    project_path = args.shift

    project = Xcodeproj::Project.open(project_path)

    filesToDeleteIfReferenced = args.to_a

    project.files.select { |f| filesToDeleteIfReferenced.include? f.name}.each {|f| f.remove_from_project}

    project.save(project_path)

  else
     puts "Too few arguments"
     puts help[:long]
     
     exit 1
  end

end