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
activeadmin-0.6.0 lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.64 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.63 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.62 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.61 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.60 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.59 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.58 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.57 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.56 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.50 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
lalala-4.0.0.dev.46 vendor/deps/active_admin/lib/generators/active_admin/assets/assets_generator.rb
activeadmin-0.5.1 lib/generators/active_admin/assets/assets_generator.rb
activeadmin-0.5.0 lib/generators/active_admin/assets/assets_generator.rb
activeadmin-0.5.0.pre1 lib/generators/active_admin/assets/assets_generator.rb
activeadmin-0.5.0.pre lib/generators/active_admin/assets/assets_generator.rb