class WRKFLO::WrkFlo

Constants

DEFAULT_STEP_PATHS

Attributes

direction[RW]
profile[RW]
profile_source[RW]

Public Class Methods

new(options) click to toggle source
# File lib/wrkflo/wrkflo.rb, line 11
def initialize options
  @profile_source = options[:profile]
  Profile.load(@profile_source)
  load_step_definitions
  @direction = options[:backward] ? :backward : :forward
end

Public Instance Methods

[](project) click to toggle source

Get a specific project out of the profile. If the profile does not define the given project, return nil.

# File lib/wrkflo/wrkflo.rb, line 40
def [] project
  Project.new(project) if Profile.projects[project]
end
load_step_definitions() click to toggle source

Load all step definitions from various default and configured paths.

# File lib/wrkflo/wrkflo.rb, line 19
def load_step_definitions
  # For the default directories, try to scan them if they exist.
  DEFAULT_STEP_PATHS.each do |path|
    if Dir.exists?(path)
      Dir[File.join(path, '*')].each{ |step_file| require step_file }
    end
  end

  # For configured paths, try to require each entry and error out if one is
  # not available.
  configured_step_paths.each do |path|
    if Dir.exists?(path)
      Dir[File.join(path, '*')].each{ |step_file| require step_file }
    else
      require path
    end
  end
end

Private Instance Methods

configured_step_paths() click to toggle source
# File lib/wrkflo/wrkflo.rb, line 47
def configured_step_paths
  Profile.options['step_definitions'] || []
end