Sha256: f2f3bd5a0e483afd8b971923049ecefa3a34d306c507991dba8e24b24115af42

Contents?: true

Size: 831 Bytes

Versions: 6

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

module FakeFtp
  module ServerCommands
    class Wat
      def run(ctx, *)
        if ctx.active? && ctx.command_state[:active_connection].nil?
          ctx.respond_with('425 Ain\'t no data port!')
          return
        end

        data_client = if ctx.active?
                        ctx.command_state[:active_connection]
                      else
                        ctx.data_server.accept
                      end
        data_client.write(invisible_bike)
        data_client.close
        ctx.command_state[:active_connection] = nil
        '418 Pizza Party'
      end

      private def invisible_bike
        ::File.read(
          ::File.expand_path(
            '../../../../spec/fixtures/invisible_bike.jpg',
            __FILE__
          )
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.3.0/lib/fake_ftp/server_commands/wat.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.3.0/lib/fake_ftp/server_commands/wat.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.3.0/lib/fake_ftp/server_commands/wat.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.3.0/lib/fake_ftp/server_commands/wat.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.3.0/lib/fake_ftp/server_commands/wat.rb
fake_ftp-0.3.0 lib/fake_ftp/server_commands/wat.rb