Class: JasmineNodeRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/jasmine_node/jasmine_node_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(node, spec_dir, dir, filter, config) ⇒ JasmineNodeRunner

Returns a new instance of JasmineNodeRunner.


3
4
5
6
7
8
9
10
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 3

def initialize(node, spec_dir, dir, filter, config)
  @node = node
  @spec_dir = spec_dir
  @dir = dir
  @filter = filter
  @config = config
  @source_args = "";
end

Instance Method Details

#executeObject


16
17
18
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 16

def execute
  return `"#{@node}" "#{@spec_dir}/specs.js" --noColor #{@source_args} "#{@config.config_path}"  2>&1`
end

#is_configured?(all_files) ⇒ Boolean

Returns:

  • (Boolean)

20
21
22
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 20

def is_configured?(all_files)
  return all_files.include?(@config.config_path)
end

#nameObject


12
13
14
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 12

def name
  return 'Jasmine'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 24

def should_run?(modified_files)
  return !(modified_files.detect { |file| @filter.filter(file) }).nil? || modified_files.include?(@config.config_path)
end

#source_dir(source_dir) ⇒ Object


28
29
30
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 28

def source_dir(source_dir)
  @source_args = source_dir.nil? ? "" : "--source-directory \"#{source_dir}\""
end