Sha256: 766f36535d1f69d2305726f738efbcbafbe77887c3c2436729bf1c585ca17d70

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

require 'webdrone/version'
require 'webdrone/error'
require 'webdrone/browser'
require 'webdrone/open'
require 'webdrone/shot'
require 'webdrone/find'
require 'webdrone/clic'
require 'webdrone/exec'
require 'webdrone/mark'
require 'webdrone/form'
require 'webdrone/xlsx'
require 'webdrone/conf'
require 'webdrone/ctxt'
require 'webdrone/wait'
require 'webdrone/text'
require 'webdrone/vrfy'
require 'webdrone/html'
require 'os'
require 'selenium-webdriver'
require 'xpath'
require 'rubyXL'
require 'irb'
require 'fileutils'
require 'binding_of_caller'
require 'pathname'
require 'pry'

module Webdrone
  def self.create(*args)
    a0 = Webdrone::Browser.new *args
    if block_given?
      begin
        yield a0
      rescue => exception
        Webdrone.report_error(a0, exception)
      ensure
        a0.quit
      end
    else
      a0
    end
  end

  def self.irb_console(binding = nil)
    return if IRB.CurrentContext and not binding
    binding = Kernel.binding.of_caller(1) if binding == nil
    IRB.start_session(binding)
  end

  def self.pry_console(binding = nil)
    binding = Kernel.binding_of_caller(1) unless binding
    binding.pry    
  end
end

module IRB
  def self.start_session(binding)
    unless $a0_irb_setup_done
      IRB.setup(nil)
      $a0_irb_setup_done = true
    end

    workspace = WorkSpace.new(binding)

    if @CONF[:SCRIPT]
      irb = Irb.new(workspace, @CONF[:SCRIPT])
    else
      irb = Irb.new(workspace)
    end

    @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
    @CONF[:MAIN_CONTEXT] = irb.context

    trap("SIGINT") do
      irb.signal_handle
    end

    begin
      catch(:IRB_EXIT) do
        irb.eval_input
      end
    ensure
      IRB.irb_at_exit
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webdrone-1.0.6 lib/webdrone.rb