Class: ChiliPresentationsTasks

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

Constant Summary collapse

VALID_DJ_ACTIONS =
%w(start restart stop status)

Instance Method Summary collapse

Constructor Details

#initializeChiliPresentationsTasks

Returns a new instance of ChiliPresentationsTasks.



7
8
9
# File 'lib/tasks/chili_presentations_tasks.rb', line 7

def initialize
  define
end

Instance Method Details

#defineObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tasks/chili_presentations_tasks.rb', line 11

def define
  namespace :chili_presentations do
    desc "Install ChiliPresentations plugin (migrate database, include assets, etc)"
    task :install => [:migrate_db, :symlink_assets]

    desc "Uninstalls ChiliPresentations plugin (removes database modifications, removes assets, etc)"
    task :uninstall => [:environment] do
      puts "Removing ChiliPresentations database modifications..."
      migrate_db(:to_version => 0)

      puts "Removing link to ChiliPresentations assets (stylesheets, js, etc)..."
      remove_symlink asset_destination_dir
      puts post_uninstall_steps
    end

    task :migrate_db => :environment do
      puts "Migrating chili_presentations..."
      ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
      ActiveRecord::Migrator.migrate(gem_db_migrate_dir, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
      Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
    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