Class: ChiliPDFTasks

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/tasks/chili_pdf_tasks.rb

Instance Method Summary collapse

Constructor Details

#initializeChiliPDFTasks

Returns a new instance of ChiliPDFTasks.



5
6
7
# File 'lib/tasks/chili_pdf_tasks.rb', line 5

def initialize
  define
end

Instance Method Details

#defineObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tasks/chili_pdf_tasks.rb', line 9

def define
  namespace :chili_pdf do
    desc "Install ChiliPDF plugin (include assets, etc)"
    task :install => [:symlink_assets]

    desc "Uninstall ChiliPDF plugin (remove assets, etc)"
    task :uninstall => [:environment] do
      puts "Removing link to ChiliPDF assets (stylesheets, js, etc)..."
      remove_symlink asset_destination_dir

      puts post_uninstall_steps
    end

    task :symlink_assets => [:environment] do
      # HACK: Symlinks the files from plugindir/assets to the appropriate place in
      # the rails application
      puts "Symlinking assets (stylesheets, etc)..."
      add_symlink asset_source_dir, asset_destination_dir
    end
  end
end