Sha256: 229b17c21f8cecf1aacf63a5d702370db3112549f9e1a3724a2852ceaa2b57ba

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'rails/generators'

module TwitterBootstrap
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      source_root File.expand_path("../templates", __FILE__)
      desc "This generator installs Bootstra, from Twitter to the Asset Pipeline"

      def add_assets
        if File.exist?('app/assets/javascripts/application.js')
          insert_into_file "app/assets/javascripts/application.js", "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
        else
          copy_file "application.js", "app/assets/javascripts/application.js"
        end
        if File.exist?('app/assets/stylesheets/application.css')
          insert_into_file "app/assets/stylesheets/application.css", " *= require twitter/bootstrap\n", :after => "require_self\n"
        else
          copy_file "application.css", "app/assets/stylesheets/application.css"
        end
      end

      def add_bootstrap
        copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
        copy_file "bootstrap.less", "app/assets/stylesheets/bootstrap.css.less"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter_bootstrap-2.0.0 lib/generators/twitter_bootstrap/install/install_generator.rb
twitter_bootstrap-0.0.8 lib/generators/twitter_bootstrap/install/install_generator.rb
twitter_bootstrap-0.0.7 lib/generators/twitter_bootstrap/install/install_generator.rb