Class: Guard::Middleman

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/middleman.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Middleman

Returns a new instance of Middleman.



7
8
9
10
11
12
13
# File 'lib/guard/middleman.rb', line 7

def initialize(watchers=[], options={})
  super
  # init stuff here, thx!
  @options = Thor::CoreExt::HashWithIndifferentAccess.new(
    {:bundler => File.exist?("#{Dir.pwd}/Gemfile")}.merge(options)
  )
end

Instance Method Details

#bundler?Boolean

Returns:

  • (Boolean)


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

def bundler?
  @options[:bundler]
end

#reloadObject

Called on Ctrl-Z signal This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…



39
40
41
# File 'lib/guard/middleman.rb', line 39

def reload
  true
end

#run_allObject

Called on Ctrl-\ signal This method should be principally used for long action like running all specs/tests/…



45
46
47
# File 'lib/guard/middleman.rb', line 45

def run_all
  system(build_command)
end

#run_on_change(paths) ⇒ Object

Called on file(s) modifications



50
51
52
# File 'lib/guard/middleman.rb', line 50

def run_on_change(paths)
  system(build_command)
end

#startObject

Called once when Guard starts Please override initialize method to init stuff



28
29
30
# File 'lib/guard/middleman.rb', line 28

def start
  true
end

#stopObject

Called on Ctrl-C signal (when Guard quits)



33
34
35
# File 'lib/guard/middleman.rb', line 33

def stop
  true
end