Sha256: 09a37a35701eeb950c7df747598f397e0c4bae332b280206a7260ab1d9c1e7a3

Contents?: true

Size: 1.93 KB

Versions: 17

Compression:

Stored size: 1.93 KB

Contents

require 'rake'
require 'rake/tasklib'

namespace :comatose do
  #
  # Customization Tasks
  #
  namespace :admin do

    desc "Create Comatose views, layouts, and public files..."
    task :customize do
      puts "Copying public files..."
      plugin_dir = File.join(File.dirname(__FILE__), '../../..')
      FileUtils.cp( 
        Dir[File.join(plugin_dir, 'resources', 'public', 'stylesheets', '*.css')], 
        File.join(RAILS_ROOT, 'public', 'stylesheets'),
        :verbose => true
      )
      FileUtils.cp( 
        Dir[File.join(plugin_dir, 'resources', 'public', 'javascripts', '*.js')], 
        File.join(RAILS_ROOT, 'public', 'javascripts'),
        :verbose => true
      )
      puts "Copying application views..."
      FileUtils.mkdir_p(File.join(RAILS_ROOT, 'app', 'views', 'comatose_admin'))
      FileUtils.cp( 
        Dir[File.join(plugin_dir, 'views', 'comatose_admin', '*.html.erb')], 
        File.join(RAILS_ROOT, 'app', 'views', 'comatose_admin'),
        :verbose => true
      )
      puts "Copying application layout..."
      FileUtils.cp( 
        File.join(plugin_dir, 'views', 'layouts', 'comatose_admin_customize.html.erb'), 
        File.join(RAILS_ROOT, 'app', 'views', 'layouts', 'comatose_admin.html.erb'),
        :verbose => true
      )
      puts "Finished."
    end


    desc "Removes the customized files... It doesn't ask for any confirmation, nor is it Subversion-safe -- so be warned!"
    task :teardown do
      puts "Removing public files..."
      FileUtils.rm(
        File.join(RAILS_ROOT, 'public', 'stylesheets', 'comatose_admin.css')
      )
      FileUtils.rm(
        File.join(RAILS_ROOT, 'public', 'javascripts', 'comatose_admin.js')
      )
    
      puts "Removing application views..."
      FileUtils.rm_rf(
        File.join(RAILS_ROOT, 'app', 'views', 'comatose_admin')
      )
      FileUtils.rm(
        File.join(RAILS_ROOT, 'app', 'views', 'layouts', 'comatose_admin.html.erb')
      )
    end
  end
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
aslakjo-aslakjo-comatose-2.0.5.1 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.2 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.3 lib/comatose/tasks/admin.rb
darthapo-comatose-2.0.3 lib/comatose/tasks/admin.rb
darthapo-comatose-2.0.4 lib/comatose/tasks/admin.rb
darthapo-comatose-2.0.5 lib/comatose/tasks/admin.rb
jcnetdev-comatose-2.0.1 lib/comatose/tasks/admin.rb
staugaard-comatose-2.0.2 lib/comatose/tasks/admin.rb
staugaard-comatose-2.0.3 lib/comatose/tasks/admin.rb
comatose-2.0.5 lib/comatose/tasks/admin.rb
comatose-2.0.1 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.12 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.11 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.10 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.9 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.8 lib/comatose/tasks/admin.rb
aslakjo-comatose-2.0.5.7 lib/comatose/tasks/admin.rb