Module: GitReflow::Workflow

Included in:
GitReflow::Workflows::Core
Defined in:
lib/git_reflow/workflow.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.currentObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/git_reflow/workflow.rb', line 13

def self.current
  return @current unless @current.nil?
  # First look for a "Workflow" file in the current directory, then check
  # for a global Workflow file stored in git-reflow git config.
  loaded_local_workflow  = GitReflow::Workflows::Core.load_workflow "#{GitReflow.git_root_dir}/Workflow"
  loaded_global_workflow = false

  unless loaded_local_workflow
    loaded_global_workflow = GitReflow::Workflows::Core.load_workflow GitReflow::Config.get('reflow.workflow')
  end

  @current = GitReflow::Workflows::Core
end

.included(base) ⇒ Object



8
9
10
# File 'lib/git_reflow/workflow.rb', line 8

def self.included base
  base.extend ClassMethods
end

.reset!Object

This is primarily a helper method for tests. Due to the nature of how the tests load many different workflows, this helps start fresh and isolate the scenario at hand.



31
32
33
34
35
36
37
38
39
# File 'lib/git_reflow/workflow.rb', line 31

def self.reset!
  GitReflow.logger.debug "Resetting GitReflow workflow..."
  current.commands = {}
  current.callbacks = { before: {}, after: {}}
  @current = nil
  # We'll need to reload the core class again in order to clear previously
  # eval'd content in the context of the class
  load File.expand_path('../workflows/core.rb', __FILE__)
end