Class: Polytrix::Command::Generate::Dashboard

Inherits:
Thor::Group
  • Object
show all
Includes:
Helpers, Util::FileSystem, Thor::Actions
Defined in:
lib/polytrix/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, #implementors, #results, #status

Methods included from Util::String

included

Methods included from Util::String::ClassMethods

#ansi2html, #escape_html, #highlight, #slugify

Methods included from Util::FileSystem

#find_file, #relativize

Class Method Details

.source_rootObject



65
66
67
# File 'lib/polytrix/command/generators/dashboard.rb', line 65

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

Instance Method Details

#add_framework_to_source_rootObject



73
74
75
76
77
# File 'lib/polytrix/command/generators/dashboard.rb', line 73

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

#copy_assetsObject



94
95
96
# File 'lib/polytrix/command/generators/dashboard.rb', line 94

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

#copy_base_structureObject



98
99
100
# File 'lib/polytrix/command/generators/dashboard.rb', line 98

def copy_base_structure
  directory 'files', '.'
end

#create_results_jsonObject



102
103
104
# File 'lib/polytrix/command/generators/dashboard.rb', line 102

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

#create_spy_reportsObject



113
114
115
116
117
118
# File 'lib/polytrix/command/generators/dashboard.rb', line 113

def create_spy_reports
  reports = Polytrix::Spies.reports[:dashboard]
  reports.each do | report_class |
    invoke report_class, args, options
  end if reports
end

#create_test_reportsObject



106
107
108
109
110
111
# File 'lib/polytrix/command/generators/dashboard.rb', line 106

def create_test_reports
  Polytrix.manifest.challenges.values.each do |challenge|
    @challenge = challenge
    template 'templates/_test_report.html.tt', "details/#{challenge.slug}.html"
  end
end

#report_nameObject



69
70
71
# File 'lib/polytrix/command/generators/dashboard.rb', line 69

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

#set_destination_rootObject



79
80
81
# File 'lib/polytrix/command/generators/dashboard.rb', line 79

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

#setupObject

def load_helpers

framework_root = source_paths.first
Dir["#{report_name}/helpers/**/*.rb"].each do |helper|
  load helper
end

end



90
91
92
# File 'lib/polytrix/command/generators/dashboard.rb', line 90

def setup
  Polytrix.setup(options)
end