class Xcodeproj::Command
def initialize(argv)
def initialize(argv) super unless self.ansi_output? String.send(:define_method, :colorize) { |string, _| string } end end
def open_project!(*paths)
def open_project!(*paths) if paths.empty? [xcodeproj] else paths.map { |path| Project.open(path) } end end
def xcodeproj
def xcodeproj @xcodeproj ||= Project.open(xcodeproj_path) end
def xcodeproj_path
def xcodeproj_path unless @xcodeproj_path projects = Dir.glob('*.xcodeproj') if projects.size == 1 xcodeproj_path = projects.first elsif projects.size > 1 raise Informative, 'There are more than one Xcode project documents ' \ 'in the current working directory. Please specify ' \ 'which to use with the `--project` option.' else raise Informative, 'No Xcode project document found in the current ' \ 'working directory. Please specify which to use ' \ 'with the `--project` option.' end @xcodeproj_path = Pathname.new(xcodeproj_path).expand_path end @xcodeproj_path end
def xcodeproj_path=(path)
def xcodeproj_path=(path) @xcodeproj_path = path && Pathname.new(path).expand_path end