Sha256: 67d500dc07c67e1977cdb3237b4e5622340dbe02d0b50691ab37480ba98015d4

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'rails/generators'

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

      def add_stylesheets
        if File.exist?('app/assets/stylesheets/application.css')
          insert_into_file "app/assets/stylesheets/application.css", " *= require bootstrap-responsive\n", :after => "require_self\n"
          insert_into_file "app/assets/stylesheets/application.css", " *= require bootstrap\n", :after => "require_self\n"
        else
          copy_file "application.css", "app/assets/stylesheets/application.css"
        end
      end

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flexi_generators-0.3.0 lib/generators/flexi/install/install_generator.rb