Sha256: 8577f20109f0d84284f0e8dbd2d3990b4fde726ccfb1928e51022f9f4c0d026e

Contents?: true

Size: 1.28 KB

Versions: 56

Compression:

Stored size: 1.28 KB

Contents

module ActiveAdmin
  module Generators
    class AssetsGenerator < Rails::Generators::Base

      class_option :bourbon, :type => :boolean, :default => true,
                   :desc => "Generate Bourbon scss files if using Rails 3.0.x"

      class_option :jquery, :type => :boolean, :default => true,
                   :desc => "Generate jQuery js files if using Rails 3.0.x"

      def self.source_root
        @_active_admin_source_root ||= File.expand_path("../templates", __FILE__)
      end

      def install_assets
        require 'rails'
        require 'active_admin'

        if ActiveAdmin.use_asset_pipeline?
          template '3.1/active_admin.js', 'app/assets/javascripts/active_admin.js'
          template '3.1/active_admin.css.scss', 'app/assets/stylesheets/active_admin.css.scss'
        else
          template '3.0/active_admin.js', 'public/javascripts/active_admin.js'
          directory '../../../../../app/assets/images/active_admin', 'public/images/active_admin'
          generate "jquery:install --ui" if options.jquery?
          install_bourbon if options.bourbon?
        end
      end

      private

      def install_bourbon
        rake "bourbon:install"
        create_file "public/stylesheets/sass/_bourbon.scss", '@import "bourbon/bourbon"'
      end

    end
  end
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.94 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.92 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.90 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.84 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.80 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.79 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.78 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.77 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.74 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.73 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.72 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.71 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.66 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.65 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb