Sha256: 4bd01f3dba820edaf187bab94aa187338b0958645eea58e143e7d8c8a134bc4e

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

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

      source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
      desc "This generator installs Bootstrap to Asset Pipeline"

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

        css_manifest = 'app/assets/stylesheets/application.css'
        if File.exist?(File.join(destination_root, css_manifest))
          insert_into_file css_manifest, " *= stub twbs-variables\n *= require twbs\n", before: " *= require_tree .\n"
        else
          copy_file 'application.css', css_manifest
        end
      end

      def copy_bootstrap
        copy_file 'twbs.js.coffee', 'app/assets/javascripts/twbs.js.coffee'
        copy_file 'twbs-variables.css.scss', 'app/assets/stylesheets/twbs-variables.css.scss'
        copy_file 'twbs.css.scss', 'app/assets/stylesheets/twbs.css.scss'
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
twbs_sass_rails-2.0.2 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-2.0.0 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-1.0.1 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-1.0.0 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.9.2 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.9.1 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.9.0 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.8.2 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.8.1 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.7.2 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.7.1 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.7.0 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.6.4 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.6.3 lib/generators/twbs_sass_rails/install/install_generator.rb
twbs_sass_rails-0.6.2 lib/generators/twbs_sass_rails/install/install_generator.rb