Sha256: 8adab820aa8bac355374ba24d294a61ee891817298fd8b92620357bae8a3513a

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module SeleniumConnect
  class Server
    attr_reader :configuration

    def initialize(configuration)
      @configuration = configuration
    end

    def start
      rake "start"
    end

    def stop
      rake "stop"
    end

    def restart
      rake "restart"
    end

    private

    def generate_rake_task
      "require 'selenium/rake/server_task'

       Selenium::Rake::ServerTask.new(:server) do |t|
         #{"t.version = :latest" unless configuration.jar}
         #{if configuration.jar then "t.jar = '#{configuration.jar}'" end}
         t.background
         t.log = '#{configuration.log ? configuration.log : "false"}'
         t.port = #{configuration.port ? configuration.port : "4444"}
       end"
    end

    def get_rake_file
      rake_file = File.join(File.dirname(File.expand_path(__FILE__)))
      file = File.open(rake_file<<"/rake.task", "w")
      file << generate_rake_task
      file.close
      return rake_file
    end

    def rake(task)
      system "rake -f #{get_rake_file} server:#{task}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
selenium-connect-1.3.0 lib/selenium-connect/server.rb