Class: CypressOnRails::CommandExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/cypress_on_rails/command_executor.rb

Overview

loads and evals the command files

Class Method Summary collapse

Class Method Details

.configurationObject



29
30
31
# File 'lib/cypress_on_rails/command_executor.rb', line 29

def self.configuration
  CypressOnRails.configuration
end

.load(file, command_options = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/cypress_on_rails/command_executor.rb', line 6

def self.load(file,command_options = nil)
  load_cypress_helper
  file_data = File.read(file)
  eval file_data
rescue => e
  logger.error("fail to execute #{file}: #{e.message}")
  logger.error(e.backtrace.join("\n"))
  raise e
end

.load_cypress_helperObject



16
17
18
19
20
21
22
23
# File 'lib/cypress_on_rails/command_executor.rb', line 16

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

.loggerObject



25
26
27
# File 'lib/cypress_on_rails/command_executor.rb', line 25

def self.logger
  configuration.logger
end