public
Description: Recess is a playful, RESTful Erlang web framework
Homepage:
Clone URL: git://github.com/jmhodges/recess.git
recess / Rakefile
100644 92 lines (67 sloc) 2.357 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
require 'rubygems'
 
begin
 
  require 'erlake'
rescue LoadError
 
  puts "You don't have the erlake gem. Run `rake setup` or install the erlake gem yourself."
end
 
GemDependencies = [
  {:name => "erlake", :version => ">=0.1.0"}
]
 
task :setup do
  puts "Checking for gems that need to be installed."
  gems = Gem::SourceIndex.from_installed_gems
 
  GemDependencies.each do |dep|
 
    if gems.search(dep[:name], dep[:version]).empty?
 
      puts "Installing dependency: #{dep[:name]}, #{dep[:version]}"
 
      begin
        require 'rubygems/dependency_installer'
        di = Gem::DependencyInstaller.new()
        di.install dep[:name], dep[:version]
 
      rescue LoadError # < rubygems 1.0.1
        require 'rubygems/remote_installer'
        Gem::RemoteInstaller.new.install(dep.name, dep.version_requirements)
      end
 
    end
 
  end
 
  puts "And done."
end
 
# This unless-statement is here to prevent this rakefile from crashing if the
# Erlake gem is not present. As you can see above, we print a nice message
# telling the user to install the gem and crashing from an uninitialized
# constant error before we can print is a Bad Thing.
 
exit(1) unless defined?(Erlake)
 
ErlangProject = Erlake::ErlangProject
 
this_dir = File.dirname(__FILE__)
 
eunit = ErlangProject.new('eunit', File.join(this_dir, 'lib/eunit')) do |proj|
 
  # Required ordering.
  proj.sources = %w(
src/eunit_autoexport.erl
src/eunit_striptests.erl
src/eunit.erl
src/eunit_tests.erl
src/eunit_server.erl
src/eunit_proc.erl
src/eunit_serial.erl
src/eunit_test.erl
src/eunit_lib.erl
src/eunit_data.erl
src/eunit_tty.erl
src/code_monitor.erl
src/file_monitor.erl
src/autoload.erl
)
 
  proj.include_paths = ["include"]
  proj.warnings = %w(+warn_unused_vars +nowarn_shadow_vars +warn_unused_import)
end
 
mochiweb = ErlangProject.new('mochiweb', File.join(this_dir, 'lib/mochiweb'))
 
smerl = ErlangProject.new('smerl', File.join(this_dir, 'lib/smerl')) do |proj|
  proj.sources = ['smerl.erl']
  proj.output_path = '../../ebin'
end
 
recess = ErlangProject.new('recess', this_dir) do |proj|
  proj.dependencies = [eunit, mochiweb, smerl]
 
  # The include_paths must have one path ending in "include/eunit" or else
  # eunit freaks out and crashes.
  proj.test_include_paths = ["./lib/include/eunit"]
end
 
recess.use_globally!