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

#initialize, options, parse, report_error, run, verify_git_version!

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



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

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



150
151
152
153
154
# File 'lib/cocoapods/command/inter_process_communication.rb', line 150

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


141
142
143
# File 'lib/cocoapods/command/inter_process_communication.rb', line 141

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

#runObject



135
136
137
138
139
# File 'lib/cocoapods/command/inter_process_communication.rb', line 135

def run
  print_version
  signal_end_of_output
  listen
end

#signal_end_of_outputObject



145
146
147
148
# File 'lib/cocoapods/command/inter_process_communication.rb', line 145

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