Sha256: dc7f6439f9e2ad22290ebc8f99cd3a198a3f36ee0f87639dde39e176d111839f

Contents?: true

Size: 708 Bytes

Versions: 23

Compression:

Stored size: 708 Bytes

Contents

require 'rails/generators'

module Bootswatch
  module Generators
    class LayoutGenerator < ::Rails::Generators::NamedBase
      argument :name, type: :string, default: "application",
               desc: 'The theme name for this bootswatch view layout'

      # needed for thor templates
      source_root File.expand_path("../templates", __FILE__)

      def theme_name
        file_name
      end

      def generate_layout
        app = ::Rails.application
        ext = app.config.generators.options[:rails][:template_engine] || :erb
        template "layout.html.#{ext}", "app/views/layouts/#{theme_name}.html.#{ext}", {theme_name: theme_name, app_name: application_name}
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
twitter-bootswatch-rails-3.3.4.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.3.2.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.2.0.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.1.1 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.1.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.0.4 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.0.3 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.0.1 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.1.0.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.0.3.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.0.2.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.0.1.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.0.0.2 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-3.0.0.0 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.8 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.7 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.6 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.5 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.4 lib/generators/bootswatch/layout/layout_generator.rb
twitter-bootswatch-rails-2.3.2.3 lib/generators/bootswatch/layout/layout_generator.rb