Class: Cukedep::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/cukedep/application.rb

Overview

Runner for the Cukedep application.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#proj_dirObject (readonly)

Returns the value of attribute proj_dir.



12
13
14
# File 'lib/cukedep/application.rb', line 12

def proj_dir
  @proj_dir
end

Instance Method Details

#run!(theCmdLineArgs) ⇒ Object

Entry point for the application object.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cukedep/application.rb', line 15

def run!(theCmdLineArgs)
  options = options_from(theCmdLineArgs)
  create_default_cfg if options[:setup]
  config = Config.load_cfg(Cukedep::YMLFilename)

  # Complain if no project dir is specified
  if config.proj_dir.nil? || config.proj_dir.empty?
    if options[:project]
      @proj_dir = options[:project]
    else
      msg_p1 = "No project dir specified in '#{Cukedep::YMLFilename}'"
      msg_p2 = ' nor via --project option.'
      raise StandardError, msg_p1 + msg_p2
    end
  else
    @proj_dir = config.proj_dir
  end

  feature_files = parse_features(config.feature_encoding)

  model = FeatureModel.new(feature_files)
  generate_files(model, config)

  return if options[:dryrun]

  rake_cmd = 'rake -f cukedep.rake'
  system(rake_cmd)
end