Class: Guard::Busted

Inherits:
Plugin
  • Object
show all
Includes:
BustedUtils
Defined in:
lib/guard/busted.rb

Overview

Plugin for ‘guard’ which starts ‘busted’ (lua unit testing framework) if a change is detected.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BustedUtils

#which

Constructor Details

#initialize(options = {}) ⇒ Busted

Initializes a Guard plugin.



18
19
20
21
22
23
# File 'lib/guard/busted.rb', line 18

def initialize(options = {})
  super

  @options = Guard::BustedOptions::DEFAULTS.merge(options)
  @runner = Guard::BustedRunner.new(@options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/guard/busted.rb', line 15

def options
  @options
end

#runnerObject (readonly)

Returns the value of attribute runner.



15
16
17
# File 'lib/guard/busted.rb', line 15

def runner
  @runner
end

Instance Method Details

#run_allObject

Called when just ‘enter` is pressed



32
33
34
# File 'lib/guard/busted.rb', line 32

def run_all
  @runner.run_all
end

#run_on_modifications(paths) ⇒ Object

Called on file(s) modifications that the Guard plugin watches.



37
38
39
# File 'lib/guard/busted.rb', line 37

def run_on_modifications(paths)
  @runner.run(paths)
end

#startObject

Called once when Guard starts.



26
27
28
29
# File 'lib/guard/busted.rb', line 26

def start
  check_if_busted_exist
  run_all if @options[:run_all_on_start]
end