Sha256: 03ee52e3bdb6549faebad414740016cdb09cfefbfdc96fd20c366a6f833db5fb

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 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 flexi/bootstrap-responsive\n", :after => "require_self\n"
          insert_into_file "app/assets/stylesheets/application.css", " *= require flexi/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 flexi/bootstrap\n", :after => "jquery_ujs\n"
        else
          copy_file "application.js", "app/assets/javascripts/application.js"
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flexi_generators-0.3.3 lib/generators/flexi/install/install_generator.rb
flexi_generators-0.3.2 lib/generators/flexi/install/install_generator.rb
flexi_generators-0.3.1 lib/generators/flexi/install/install_generator.rb