Class: Pbind::Command

Inherits:
CLAide::Command
  • Object
show all
Defined in:
lib/pbind/command.rb,
lib/pbind/command/mock.rb,
lib/pbind/command/serv.rb,
lib/pbind/command/watch.rb

Direct Known Subclasses

Mock, Serv, Watch

Defined Under Namespace

Classes: Mock, Serv, Watch

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



44
45
46
47
48
# File 'lib/pbind/command.rb', line 44

def initialize(argv)
  super

  @project_path = argv.option('project')
end

Class Method Details

.optionsObject



38
39
40
41
42
# File 'lib/pbind/command.rb', line 38

def self.options
  [
    ['--project=path/to/Project.xcodeproj', 'The path of the XcodeProject.']
  ].concat(super)
end

.report_error(exception) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pbind/command.rb', line 20

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

Instance Method Details

#runObject



50
51
52
53
54
# File 'lib/pbind/command.rb', line 50

def run
  if !@changed
    UI.notice 'All are UP-TO-DATE.'
  end
end

#verify_project_existsObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pbind/command.rb', line 56

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