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

Version Path
workarea-core-3.5.27 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.26 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.45 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.25 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.23 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.44 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.22 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.43 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.21 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.42 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.20 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.41 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.19 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.40 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.18 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.39 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.17 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.38 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.16 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.37 lib/generators/workarea/style_guide/style_guide_generator.rb