Sha256: 8241f9d74a8cc5e404f34a9c0a315403510235040f981a6e4bc6f8907bc7e174

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require 'rails/generators'

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

      def add_assets
        # copy js manifest
        js_manifest = 'app/assets/javascripts/bootstrap.js'

        if File.exist?(js_manifest)
          puts <<-EOM
          Notice:
            #{js_manifest} exist; skipping
          EOM
        else
          copy_file "bootstrap.js", "app/assets/javascripts/bootstrap.js"
        end

        # copy css manifests
        css_manifests = 'app/assets/stylesheets/bootstrap.css'

        if File.exist?(css_manifests)
          puts <<-EOM
          Notice:
            #{css_manifests} exist; skipping
          EOM
        else
          copy_file "bootstrap.css", "app/assets/stylesheets/bootstrap.css"
        end

        # copy fonts manifests
        fonts_manifests = 'app/assets/fonts'

        if File.directory?(fonts_manifests)
          puts <<-EOM
          Notice:
            #{fonts_manifests} exist; skipping
          EOM
        else
          directory "fonts", fonts_manifests, :recursive => true
        end

      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap_v3-0.1 lib/generators/bootstrap/install/install_generator.rb
bootstrap_v3-0.0.15 lib/generators/bootstrap/install/install_generator.rb
bootstrap_v3-0.0.14 lib/generators/bootstrap/install/install_generator.rb
bootstrap_v3-0.0.13 lib/generators/bootstrap/install/install_generator.rb