danlucraft / redcar

A cross-platform programmer's editor written in Ruby.

This URL has Read+Write access

redcar / Rakefile
100644 74 lines (59 sloc) 1.346 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# To create Rake tasks for your plugin, put them in plugins/my_plugin/Rakefile or
# plugins/my_plugin/tasks/my_tasks.rake.
 
require 'rubygems'
require 'fileutils'
 
if RUBY_PLATFORM =~ /mswin/
  begin
    require 'win32console'
  rescue LoadError
    ARGV << "--nocolour"
  end
end
 
GREEN_FG = "\033[1;32m"
RED_FG = "\033[1;31m"
RED_BG = "\033[1;37m\033[41m"
GREY_BG = "\033[40m"
BLUE_FG = "\033[1;34m"
CLEAR_COLOURS = "\033[0m"
 
def cputs(text, colours, opts={})
  colours.each {|colour| print colour }
  print text
  if opts[:no_newline]
    print CLEAR_COLOURS
  else
    puts CLEAR_COLOURS
  end
end
 
include FileUtils
 
cd(File.dirname(__FILE__))
 
def execute_and_check(command)
  puts %x{#{command}}
  $?.to_i == 0 ? true : raise
end
 
def execute(command)
  puts %x{#{command}}
  $?.to_i == 0 ? true : false
end
 
def plugin_names
  Dir["plugins/*"].map do |fn|
    name = fn.split("/").last
  end
end
 
Dir[File.join(File.dirname(__FILE__), *%w[plugins *])].each do |plugin_dir|
  rakefiles = [File.join(plugin_dir, "Rakefile")] +
    Dir[File.join(plugin_dir, "tasks", "*.rake")]
  rakefiles.each do |rakefile|
    if File.exist?(rakefile)
      load rakefile
    end
  end
end
 
task :clear_cache do
  sh "rm cache/*/*.dump"
end
 
desc "list all tasks"
task :list do
  Rake::Task.tasks.each do |task|
    puts "rake #{task.name}"
  end
end