Class: Pod::Command::IPC::Repl

Inherits:
Pod::Command::IPC show all
Defined in:
lib/cocoapods/command/inter_process_communication.rb

Overview

———————————————————————–#

Constant Summary collapse

END_OF_OUTPUT_SIGNAL =
"\n\r"

Instance Method Summary collapse

Methods inherited from Pod::Command::IPC

#output_pipe

Methods inherited from Pod::Command

#ensure_master_spec_repo_exists!, #initialize, options, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

This class inherits a constructor from Pod::Command

Instance Method Details

#execute_repl_command(repl_command) ⇒ Object



158
159
160
161
162
163
164
165
166
167
# File 'lib/cocoapods/command/inter_process_communication.rb', line 158

def execute_repl_command(repl_command)
  if (repl_command != "\n")
    repl_commands = repl_command.split
    subcommand = repl_commands.shift.capitalize
    arguments = repl_commands
    subcommand_class = Pod::Command::IPC.const_get(subcommand)
    subcommand_class.new(CLAide::ARGV.new(arguments)).run
    signal_end_of_output
  end
end

#listenObject



152
153
154
155
156
# File 'lib/cocoapods/command/inter_process_communication.rb', line 152

def listen
  while repl_command = STDIN.gets
    execute_repl_command(repl_command)
  end
end


143
144
145
# File 'lib/cocoapods/command/inter_process_communication.rb', line 143

def print_version
  output_pipe.puts "version: '#{Pod::VERSION}'"
end

#runObject



137
138
139
140
141
# File 'lib/cocoapods/command/inter_process_communication.rb', line 137

def run
  print_version
  signal_end_of_output
  listen
end

#signal_end_of_outputObject



147
148
149
150
# File 'lib/cocoapods/command/inter_process_communication.rb', line 147

def signal_end_of_output
  output_pipe.puts(END_OF_OUTPUT_SIGNAL)
  STDOUT.flush
end