Class: Uncool::App

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ App

Returns a new instance of App.



10
11
12
13
# File 'lib/uncool/app.rb', line 10

def initialize(options={})
  @options    = options
  @namespaces = options[:namespaces]
end

Instance Attribute Details

#namespacesObject (readonly) Also known as: targets

Returns the value of attribute namespaces.



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

def namespaces
  @namespaces
end

#optionsObject (readonly)

Returns the value of attribute options.



22
23
24
# File 'lib/uncool/app.rb', line 22

def options
  @options
end

Instance Method Details

#analysisObject



35
36
37
# File 'lib/uncool/app.rb', line 35

def analysis
  @analysis ||= Analysis.new(trace, options)
end

#generate(scripts) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/uncool/app.rb', line 57

def generate(scripts)
  require 'uncool/generator/ko'
  require 'uncool/generator/qed'
  require 'uncool/generator/lemon'

  generator = (
    case options[:framework]
    when :ko
      GeneratorKO.new(options)
    when :qed
      GeneratorQED.new(options)
    when :rspec
      #GeneratorRSpec.new(options)
    when :cuke, :cucumber
      #GeneratorCucumber.new(options)
    else
      GeneratorLemon.new(options)
    end
  )

  scripts.each{ |script| require(script) }

  generator.generate
end

#log(logdir = nil) ⇒ Object

This is the main method for activating hte trace and recording the results.



46
47
48
49
50
51
52
53
54
# File 'lib/uncool/app.rb', line 46

def log(logdir=nil)
  logdir = logdir || options[:output]
  trace.setup
  at_exit {
    trace.deactivate
    logdir ? report.save(logdir) : report.display
  }
  trace.activate
end

#reportObject



40
41
42
# File 'lib/uncool/app.rb', line 40

def report
  @report ||= Report.new(analysis, options)
end

#traceObject



30
31
32
# File 'lib/uncool/app.rb', line 30

def trace
  @trace ||= Trace.new(targets, options)
end