Class: Attractor::SinatraReporter

Inherits:
BaseReporter show all
Defined in:
lib/attractor/reporters/sinatra_reporter.rb

Overview

serving the HTML locally

Instance Attribute Summary

Attributes inherited from BaseReporter

#file_prefix, #types, #values

Instance Method Summary collapse

Methods inherited from BaseReporter

#initialize, #render, #suggestions

Constructor Details

This class inherits a constructor from Attractor::BaseReporter

Instance Method Details

#reportObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/attractor/reporters/sinatra_reporter.rb', line 46

def report
  super

  app = AttractorApp.new(self)

  puts "Serving attractor at http://localhost:7890"

  if @open_browser
    Launchy.open("http://localhost:7890") if @open_browser
    puts "Opening browser window..."
  end

  Rack::Handler::WEBrick.run app, Port: 7890
end

#watchObject



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/attractor/reporters/sinatra_reporter.rb', line 61

def watch
  @suggestions = @suggester.suggest

  app = AttractorApp.new(self)

  puts "Serving attractor at http://localhost:7890"
  if @open_browser
    Launchy.open("http://localhost:7890")
    puts "Opening browser window..."
  end

  Rack::Handler::WEBrick.run Rack::LiveReload.new(app), Port: 7890
end