class Minimart::Web::DashboardGenerator
Generate the main Minimart
HTML dashboard (index.html)
Attributes
cookbooks[R]
@return [Minimart::Web::Cookbooks] the cookbooks to generate HTML for.
template_content[R]
@return [String] The generated HTML content
web_directory[R]
@return [String] the directory to put any generated HTML in
Public Class Methods
new(opts = {})
click to toggle source
@param [Hash] opts @option opts [String] :web_directory The directory to put any generated HTML in @option opts [String] :cookbooks The cookbooks to generate HTML for
# File lib/minimart/web/dashboard_generator.rb, line 19 def initialize(opts = {}) @web_directory = opts[:web_directory] @cookbooks = opts[:cookbooks] end
Public Instance Methods
generate()
click to toggle source
Generate the dashboard!
# File lib/minimart/web/dashboard_generator.rb, line 25 def generate generate_template_content write_template_to_index_file end
Private Instance Methods
generate_template_content()
click to toggle source
# File lib/minimart/web/dashboard_generator.rb, line 32 def generate_template_content @template_content = render_in_base_layout { render_template('dashboard.erb') } end
index_file()
click to toggle source
# File lib/minimart/web/dashboard_generator.rb, line 40 def index_file File.join(web_directory, 'index.html') end
write_template_to_index_file()
click to toggle source
# File lib/minimart/web/dashboard_generator.rb, line 36 def write_template_to_index_file File.open(index_file, 'w+') { |f| f.write(template_content) } end