Sha256: 34e5a1788ba594656ce4ef89b9cc993d7d7e96a22ac670ed0c36fbae1e293b55
Contents?: true
Size: 959 Bytes
Versions: 62
Compression:
Stored size: 959 Bytes
Contents
module Workarea module Generators class StyleGuideGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) desc File.read(File.expand_path('../USAGE', __FILE__)) argument :engine, type: :string, required: true argument :section, type: :string, required: true argument :name, type: :string, required: true def style_guide @engine = engine.downcase.gsub(/[\s-]/, '_') @section = section.downcase.gsub(/[\s-]/, '_') @name = name.downcase.gsub(/[\s_]/, '-') @slug = @name.gsub('-', '_') template 'style_guide_partial.html.haml.erb', style_guide_file_path end private def style_guide_file_path "#{engine_path}/style_guides/#{partial_path}.html.haml" end def engine_path "app/views/workarea/#{@engine}" end def partial_path "#{@section}/_#{@slug}" end end end end
Version data entries
62 entries across 62 versions & 1 rubygems