Class: Omnitest::Command::Generate::Dashboard

Inherits:
Thor::Group
  • Object
show all
Includes:
Helpers, Omnitest::Core::FileSystem, Thor::Actions
Defined in:
lib/omnitest/command/generators/dashboard.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#as_json, #bootstrap_color, #projects, #results, #status, #to_utf

Class Method Details

.source_rootObject



83
84
85
# File 'lib/omnitest/command/generators/dashboard.rb', line 83

def self.source_root
  Omnitest::Reporters::GENERATORS_DIR
end

Instance Method Details

#add_framework_to_source_rootObject



91
92
93
94
95
# File 'lib/omnitest/command/generators/dashboard.rb', line 91

def add_framework_to_source_root
  source_paths.map do | path |
    path << "/#{report_name}"
  end
end

#copy_assetsObject



122
123
124
# File 'lib/omnitest/command/generators/dashboard.rb', line 122

def copy_assets
  directory Omnitest::Reporters::ASSETS_DIR, 'assets'
end

#copy_base_structureObject



126
127
128
129
# File 'lib/omnitest/command/generators/dashboard.rb', line 126

def copy_base_structure
  @active_tab = 'Dashboard'
  directory 'files', '.'
end

#create_results_jsonObject



131
132
133
# File 'lib/omnitest/command/generators/dashboard.rb', line 131

def create_results_json
  create_file 'matrix.json', as_json(results)
end

#create_spy_reportsObject



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/omnitest/command/generators/dashboard.rb', line 108

def create_spy_reports
  reports = Omnitest::Skeptic::Spies.reports[:dashboard]
  reports.each do | report_class |
    if report_class.respond_to? :tab_name
      @active_tab = report_class.tab_name
      @tabs[@active_tab] = report_class.tab_target
    else
      @active_tab = nil
    end
    report_class.tabs = @tabs
    invoke report_class, args, options
  end if reports
end

#create_test_reportsObject



135
136
137
138
139
140
141
142
143
144
# File 'lib/omnitest/command/generators/dashboard.rb', line 135

def create_test_reports
  template_file = find_in_source_paths('templates/_test_report.html.haml')
  template = Tilt.new(template_file)
  Omnitest.scenarios.each do |scenario|
    @scenario = scenario
    add_file "details/#{scenario.slug}.html" do
      template.render(self)
    end
  end
end

#report_nameObject



87
88
89
# File 'lib/omnitest/command/generators/dashboard.rb', line 87

def report_name
  @report_name ||= self.class.name.downcase.split('::').last
end

#set_destination_rootObject



97
98
99
# File 'lib/omnitest/command/generators/dashboard.rb', line 97

def set_destination_root
  self.destination_root = options[:destination]
end

#setupObject



101
102
103
104
105
106
# File 'lib/omnitest/command/generators/dashboard.rb', line 101

def setup
  @tabs = {}
  @tabs['Dashboard'] = 'dashboard.html'
  Omnitest.update_config!(options)
  Omnitest.setup
end