Sha256: 10441f46fda02fd7153724625e84d8eb230ac712f5a14522a07e6b215393b96e
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
require 'fileutils' require 'forwardable' require File.expand_path('test_server_files', File.dirname(__FILE__)) class ExampleServer extend Forwardable include FileUtils include TestServerFiles def initialize(args = nil) command = [ File.expand_path('../../examples/example.rb', File.dirname(__FILE__)), args, ].join(' ') @io = IO.popen(command, 'r+') @output = read_output end def stop @io.close end def host @output[/Host: (.*)$/, 1] end def port @output[/Port: (.*)$/, 1].to_i end def user @output[/User: (.*)$/, 1] end def password @output[/Pass: (.*)$/, 1] end private def read_output output = '' loop do line = @io.gets break if line.nil? output << line break if line =~ /FTP server started/ end output end def temp_dir @output[/Directory: (.*)$/, 1] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ftpd-0.3.2 | features/support/example_server.rb |
ftpd-0.3.1 | features/support/example_server.rb |