Class: ActiveadminSettings::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/activeadmin_settings/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_assetsObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/activeadmin_settings/install_generator.rb', line 22

def add_assets
  if File.exist?('app/assets/javascripts/active_admin.js')
    insert_into_file  "app/assets/javascripts/active_admin.js",
                      "//= require activeadmin_settings\n", :after => "base\n"
  else
    puts "It doesn't look like you've installed activeadmin: active_admin.js is missing.\nPlease install it and try again."
  end

  if File.exist?('app/assets/stylesheets/active_admin.css.scss')
    insert_into_file  "app/assets/stylesheets/active_admin.css.scss",
                      "//= require activeadmin_settings\n", :before => "// Active Admin CSS Styles\n"
  else
    puts "It doesn't look like you've installed activeadmin: active_admin.scss is missing.\nPlease install it and try again."
  end
end

#copy_filesObject



8
9
10
11
12
13
14
15
16
# File 'lib/generators/activeadmin_settings/install_generator.rb', line 8

def copy_files
  # admin
  puts "Installing admin:"
  copy_file "admin/settings.rb",    "app/admin/settings.rb"

  # config
  puts "Installing config:"
  copy_file "config/activeadmin_settings.yml", "config/activeadmin_settings.yml"
end

#mount_engineObject



18
19
20
# File 'lib/generators/activeadmin_settings/install_generator.rb', line 18

def mount_engine
  route "mount_activeadmin_settings()"
end