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.4.27 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.4 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.26 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.3 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.25 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.2 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.24 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.1 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.23 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.22 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.0 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.21 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.5.0.beta.1 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.20 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.19 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.18 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.17 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.16 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.15 lib/generators/workarea/style_guide/style_guide_generator.rb
workarea-core-3.4.14 lib/generators/workarea/style_guide/style_guide_generator.rb