Module: ReloadDotKick

Defined in:
lib/kicker/recipes/dot_kick.rb

Overview

:nodoc

Class Method Summary collapse

Class Method Details

.call(files) ⇒ Object



8
9
10
# File 'lib/kicker/recipes/dot_kick.rb', line 8

def call(files)
  reset! if files.delete('.kick')
end

.load!Object



16
17
18
# File 'lib/kicker/recipes/dot_kick.rb', line 16

def load!
  load '.kick'
end

.remove_loaded_features!Object



33
34
35
36
37
# File 'lib/kicker/recipes/dot_kick.rb', line 33

def remove_loaded_features!
  ($LOADED_FEATURES - @features_before_dot_kick).each do |feat|
    $LOADED_FEATURES.delete(feat)
  end
end

.reset!Object



20
21
22
23
24
# File 'lib/kicker/recipes/dot_kick.rb', line 20

def reset!
  remove_loaded_features!
  reset_chains!
  load!
end

.reset_chains!Object



26
27
28
29
30
31
# File 'lib/kicker/recipes/dot_kick.rb', line 26

def reset_chains!
  Kicker.full_chain = nil

  chains = @chains_before_dot_kick.map { |c| c.dup }
  Kicker.pre_process_chain, Kicker.process_chain, Kicker.post_process_chain = *chains
end

.save_stateObject



3
4
5
6
# File 'lib/kicker/recipes/dot_kick.rb', line 3

def save_state
  @features_before_dot_kick = $LOADED_FEATURES.dup
  @chains_before_dot_kick = Kicker.full_chain.map { |c| c.dup }
end

.use?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/kicker/recipes/dot_kick.rb', line 12

def use?
  File.exist?('.kick')
end