Sha256: e39b917f65d886b5d4055a6a5d3c74a373a2d2087536ea740e20d63d2badf879

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

require 'rails/generators'

module Strap
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      source_root File.expand_path("../templates", __FILE__)
      desc "This generator installs Bootstrap to Asset Pipeline"
      
      def add_bootstrap
        files = %w"stylesheets/bootstrap-theme.css stylesheets/bootstrap.css javascripts/bootstrap.js"

        files.each do |file|
          copy_file file.split("/")[1], "app/assets/#{file}"
        end
      end

      def update_app_layout
        unless open('app/views/layouts/application.html.erb') { |f| f.grep(/<div class="container">/) }.size > 0
          gsub_file 'app/views/layouts/application.html.erb', '<%= yield %>', '<div class="container"><%= yield %></div>'
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strappy-0.0.02 lib/generators/strap/install/install_generator.rb