Class: ActiveadminJobs::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_javascriptsObject



2
3
4
5
6
7
# File 'lib/generators/activeadmin_jobs/install/install_generator.rb', line 2

def add_javascripts
  file_path = "app/assets/javascripts/active_admin.js.coffee"
  line_to_add = "#= require activeadmin_jobs/base\n"
  reference = "#= require active_admin/base\n"
  inject_into_file(file_path, line_to_add, after: reference)
end

#add_stylesheetsObject



9
10
11
12
13
14
15
16
17
# File 'lib/generators/activeadmin_jobs/install/install_generator.rb', line 9

def add_stylesheets
  file_path = 'app/assets/stylesheets/active_admin'
  line_to_add = "@import \"activeadmin_jobs/base\";\n"
  reference = "@import \"active_admin/base\";\n"
  inject_into_file("#{file_path}.scss", line_to_add, after: reference)

rescue Errno::ENOENT
  inject_into_file("#{file_path}.css.scss", line_to_add, after: reference)
end

#run_job_notifier_generatorObject



19
20
21
# File 'lib/generators/activeadmin_jobs/install/install_generator.rb', line 19

def run_job_notifier_generator
  generate("job_notifier:install")
end