Class: ActiveAdmin::Generators::AssetsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/active_admin/assets/assets_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/generators/active_admin/assets/assets_generator.rb', line 11

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

Instance Method Details

#install_assetsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/active_admin/assets/assets_generator.rb', line 15

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 '../../../../../app/assets/javascripts/active_admin/application.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