neshmi / super_simple_cms

Super Simple CMS -- When you just want something simple.

This URL has Read+Write access

neshmi (author)
Thu Dec 11 13:52:17 -0800 2008
commit  1e6b757d6faeb8ae332674ee10b3d105fcaedb19
tree    c2eabe980b9b635db40ec1bc79ff91ee8bd3cec8
parent  ec3576799fcef403fcf406885b7257351df6515a
super_simple_cms / tasks / supersimple_cms_tasks.rake
100644 43 lines (39 sloc) 1.436 kb
1
2
3
4
5
6
7
8
9
10
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
41
42
43
namespace :super_simple_cms do
  PLUGIN_ROOT = File.dirname(__FILE__) + '/..'
  ASSET_FILES = Dir[PLUGIN_ROOT + '/assets/**/*'].select { |e| File.file?(e) }
  
  desc 'Installs required assets'
  task :install do
    #ENV['FORCE'] = true
    #Rake::Task[:update].invoke
    #force = ENV['FORCE'] || false
    verbose = true
    ASSET_FILES.each do |file|
      path = File.dirname(file) + '/'
      path.gsub!(PLUGIN_ROOT, RAILS_ROOT)
      path.gsub!('assets', 'public')
      destination = File.join(path, File.basename(file))
      puts " * Copying %-50s to %s" % [file.gsub(PLUGIN_ROOT, ''), destination.gsub(RAILS_ROOT, '')] if verbose
      FileUtils.mkpath(path) unless File.directory?(path)
      
      #puts File.mtime(file), File.mtime(destination)
      #if force || !FileUtils.identical?(file, destination)
      FileUtils.cp [file], path
      #end
    end
  end
  
  desc 'Removes assets for the plugin'
  task :remove do
    ASSET_FILES.each do |file|
      path = File.dirname(file) + '/'
      path.gsub!(PLUGIN_ROOT, RAILS_ROOT)
      path.gsub!('assets', 'public')
      path = File.join(path, File.basename(file))
      puts ' * Removing %s' % path.gsub(RAILS_ROOT, '') if verbose
      FileUtils.rm [path]
    end
  end
  
  desc "Updates group names to new naming convention"
  task :update do
    system("script/runner -e #{RAILS_ENV} SuperSimpleCms::Group.update")
    puts "Group names updated"
  end
end