Sha256: 4ebea654aefc52d2ade24410a27e763242d928d82c9a30c1617f7ab01a613d65

Contents?: true

Size: 842 Bytes

Versions: 4

Compression:

Stored size: 842 Bytes

Contents

require 'cypress_on_rails/configuration'

module CypressOnRails
  # loads and evals the command files
  class CommandExecutor
    def self.load(file,command_options = nil)
      load_cypress_helper
      file_data = File.read(file)
      eval file_data, binding, file
    rescue => e
      logger.error("fail to execute #{file}: #{e.message}")
      logger.error(e.backtrace.join("\n"))
      raise e
    end

    def self.load_cypress_helper
      cypress_helper_file = "#{configuration.cypress_folder}/cypress_helper"
      if File.exist?("#{cypress_helper_file}.rb")
        Kernel.require cypress_helper_file
      else
        logger.warn "could not find #{cypress_helper_file}.rb"
      end
    end

    def self.logger
      configuration.logger
    end

    def self.configuration
      CypressOnRails.configuration
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cypress-on-rails-1.9.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.8.1 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.8.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.7.0 lib/cypress_on_rails/command_executor.rb