Sha256: acc6d690dc02e6cbd54f54701c186f26200f9b399b849f3ee8c66b1e4431aa56

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

require 'cypress_on_rails/configuration'

module CypressOnRails
  # loads and evals the command files
  class CommandExecutor
    def self.perform(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

8 entries across 8 versions & 1 rubygems

Version Path
cypress-on-rails-1.14.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.13.1 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.13.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.12.1 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.12.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.11.0 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.10.1 lib/cypress_on_rails/command_executor.rb
cypress-on-rails-1.9.1 lib/cypress_on_rails/command_executor.rb