Class: Cukehead::App

Inherits:
Object
  • Object
show all
Defined in:
lib/cukehead/app.rb

Overview

The Cukehead::App class is responsible for responding to command line arguments and providing the main functionality of the cukehead application.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



22
23
24
25
26
27
28
29
30
31
# File 'lib/cukehead/app.rb', line 22

def initialize
  @command = ''
  @features_path = File.join(Dir.getwd, 'features')
  @mindmap_filename = File.join(Dir.getwd, 'mm', 'cukehead-output.mm')
  @mindmap_template_filename = ''
  @feature_reader = nil
  @mindmap_reader = nil
  @do_overwrite = false
  @errors = []
end

Instance Attribute Details

#do_overwriteObject

Returns the value of attribute do_overwrite.



18
19
20
# File 'lib/cukehead/app.rb', line 18

def do_overwrite
  @do_overwrite
end

#errorsObject (readonly)

Returns the value of attribute errors.



19
20
21
# File 'lib/cukehead/app.rb', line 19

def errors
  @errors
end

#feature_readerObject (readonly)

Returns the value of attribute feature_reader.



20
21
22
# File 'lib/cukehead/app.rb', line 20

def feature_reader
  @feature_reader
end

#features_pathObject

Returns the value of attribute features_path.



15
16
17
# File 'lib/cukehead/app.rb', line 15

def features_path
  @features_path
end

#mindmap_filenameObject

Returns the value of attribute mindmap_filename.



16
17
18
# File 'lib/cukehead/app.rb', line 16

def mindmap_filename
  @mindmap_filename
end

#mindmap_template_filenameObject

Returns the value of attribute mindmap_template_filename.



17
18
19
# File 'lib/cukehead/app.rb', line 17

def mindmap_template_filename
  @mindmap_template_filename
end

Instance Method Details

#runObject

Main entry point for executing the cukehead application. Responsible for responding to the command line arguments.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cukehead/app.rb', line 37

def run
  get_options
  if @errors.empty?
    if @command == 'map'
      read_features
      write_mindmap
      show_errors
    elsif @command == 'cuke'
      read_mindmap
      write_features
      show_errors
    else
      show_help
    end
  else
    show_errors
  end
end