Class: XcodePristine::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode_pristine.rb

Constant Summary collapse

USAGE_MESSAGE =
<<-END_OUTPUT
Error: could not find any projects or workspaces to check from the arguments passed to xcpristine.

Usage:
  xcpristine <path 1> <path 2> ... <path N>

Where each path can be one of:

  an Xcode project
    the path to a .xcodeproj, eg. ./path/to/Example.xcodeproj
    (checks that project for build settings)

  an Xcode workspace
    the path to a .xcworkspace, eg. ./path/to/Example.xcworkspace
    (checks each top level Xcode project file in the workspace for build settings)

  a directory
    the path to a directory containing .xcodeproj or .xcworkspace files
    (if found, checks the workspace, otherwise, checks the project)
END_OUTPUT

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/xcode_pristine.rb', line 9

def self.run args
  finder = ProjectFinder.new args

  projects = finder.projects.map do |xcodeproj|
    Checker.new(xcodeproj)
  end

  if projects.empty?
    puts USAGE_MESSAGE
    return Status::USAGE
  end

  projects.each do |checker|
    puts "Project..."

    if checker.has_build_settings?
      indent = "  "
      puts checker.message indent
      puts "Project... Failed."
    else
      puts "Project... OK."
    end
  end

  if projects.any? { |checker| checker.has_build_settings? }
    return Status::SETTINGS
  else
    return Status::OK
  end
end