class Pbind::Command

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/pbind/command.rb, line 46
def initialize(argv)
  super

  @project_path = argv.option('project')
end
options() click to toggle source
Calls superclass method
# File lib/pbind/command.rb, line 40
def self.options
  [
    ['--project=path/to/Project.xcodeproj', 'The path of the XcodeProject.']
  ].concat(super)
end
report_error(exception) click to toggle source
# File lib/pbind/command.rb, line 22
def self.report_error(exception)
  case exception
  when Interrupt
    puts ''
    puts '[!] Cancelled'.red
  when SystemExit
    raise
  else
    # if ENV['PBIND_ENV'] != 'development'
    #   puts UI::ErrorReport.report(exception)
    #   UI::ErrorReport.search_for_exceptions(exception)
    #   exit 1
    # else
      raise exception
    # end
  end
end

Public Instance Methods

run() click to toggle source
# File lib/pbind/command.rb, line 52
def run
  if !@changed
    UI.notice 'All are UP-TO-DATE.'
  end
end
verify_project_exists() click to toggle source
# File lib/pbind/command.rb, line 58
def verify_project_exists
  if @project_path == nil
    projects = Dir.glob("*.xcodeproj")
    num_project = projects.length

    help! 'No `*.xcodeproj\' found in the project directory.' if num_project == 0
    help! "Could not automatically select an Xcode project. Specify one in your arguments like so:\
    \n\n    --project=path/to/Project.xcodeproj" unless num_project == 1

    @project_path = projects[0]
  else
    help! 'The Xcode project should ends with `*.xcodeproj`.' unless @project_path.end_with?('.xcodeproj')
    absolute_path = File.absolute_path(@project_path)
    help! "Unable to find the Xcode project `#{absolute_path}`." unless File.exists?(absolute_path)
  end
end