Sha256: 11dd36baed4f79cd91b35e3fd29ced6bc7cef139e96fedf6c1289f2110da086c

Contents?: true

Size: 1.07 KB

Versions: 26

Compression:

Stored size: 1.07 KB

Contents

module Starter
  class StyleGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)

    argument :theme_name, :type => :string#, :default => 'default'

    class_option :layout, :type => :boolean, :default => true, :desc => "Generate a new application layout."
    class_option :navbar, :type => :boolean, :default => true, :desc => "Generate a model-based navbar."
    argument :layout_file, :type => :string, :default => 'application', :desc => "Layout filename"

    def generate_layout
      if bootswatch_theme?
        log :insert, "Bootswatch theme '#{theme_name}'"
      else
        log :insert, 'Bootstrap CSS framework'
      end
      log :insert, 'FontAwesome support'
      template "layout.html.erb", "app/views/layouts/#{layout_file}.html.erb" if options[:layout]
    end

  protected

    def bootswatch_theme?
      if theme_name.present?
        (theme_name.downcase != 'default') && (theme_name.downcase != 'd')
      end
    end

    def app_tables
      ActiveRecord::Base.connection.tables - ['schema_migrations']
    end

  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
ez-1.3.0 lib/generators/ez/style/style_generator.rb
ez-1.2.0 lib/generators/ez/style/style_generator.rb
ez-1.1.3 lib/generators/ez/style/style_generator.rb
ez-1.1.2 lib/generators/ez/style/style_generator.rb
ez-1.1.1 lib/generators/ez/style/style_generator.rb
ez-1.1.0 lib/generators/ez/style/style_generator.rb
ez-1.0.0 lib/generators/ez/style/style_generator.rb
ez-0.9.9 lib/generators/ez/style/style_generator.rb
ez-0.9.7 lib/generators/ez/style/style_generator.rb
ez-0.9.6 lib/generators/ez/style/style_generator.rb
ez-0.9.5 lib/generators/ez/style/style_generator.rb
ez-0.9.1 lib/generators/ez/style/style_generator.rb
ez-0.9.0 lib/generators/ez/style/style_generator.rb
ez-0.8.7 lib/generators/ez/style/style_generator.rb
ez-0.8.6 lib/generators/ez/style/style_generator.rb
ez-0.7.0 lib/generators/ez/style/style_generator.rb
ez-0.6.5 lib/generators/ez/style/style_generator.rb
ez-0.6.4 lib/generators/ez/style/style_generator.rb
ez-0.6.3 lib/generators/ez/style/style_generator.rb
ez-0.6.2 lib/generators/ez/style/style_generator.rb