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

Inherits:
Pod::Command::IPC show all
Includes:
ProjectDirectory
Defined in:
lib/cocoapods/command/ipc/repl.rb

Constant Summary collapse

END_OF_OUTPUT_SIGNAL =
"\n\r".freeze

Instance Method Summary collapse

Methods inherited from Pod::Command::IPC

#output_pipe

Methods inherited from Pod::Command

#ensure_master_spec_repo_exists!, ensure_not_root_or_allowed!, git_version, #initialize, #installer_for_config, options, report_error, run, #verify_lockfile_exists!, verify_minimum_git_version!, #verify_podfile_exists!, verify_xcode_license_approved!

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



38
39
40
41
42
43
44
45
46
47
# File 'lib/cocoapods/command/ipc/repl.rb', line 38

def execute_repl_command(repl_command)
  unless 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



32
33
34
35
36
# File 'lib/cocoapods/command/ipc/repl.rb', line 32

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


23
24
25
# File 'lib/cocoapods/command/ipc/repl.rb', line 23

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

#runObject



17
18
19
20
21
# File 'lib/cocoapods/command/ipc/repl.rb', line 17

def run
  print_version
  signal_end_of_output
  listen
end

#signal_end_of_outputObject



27
28
29
30
# File 'lib/cocoapods/command/ipc/repl.rb', line 27

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