root/experiments/EventMachine/Rakefile

Revision 203, 2.1 kB (checked in by rosejn, 3 years ago)

Starting on an example application

Line 
1 require 'rubygems'
2 require 'rake'
3 require 'rake/testtask'
4 require 'rake/rdoctask'
5
6 PKG_VERSION = "0.1"
7
8 $VERBOSE = nil
9
10 desc "Run unit tests and print project statistics"
11 task :default => [ :test, :lines ]
12
13 desc "Run all unit tests"
14 Rake::TestTask.new(:test) { |t|
15   t.libs << "test"
16   t.test_files = FileList['test/*_test.rb']
17   t.verbose = true
18 }
19
20 # Generate the RDoc documentation
21 Rake::RDocTask.new(:doc) { |rdoc|
22   rdoc.main = 'README'
23   rdoc.rdoc_files.include('lib/**/*.rb', 'README', 'LICENSE', 'GPL', 'TODO',
24                          'Credits', 'ChangeLog')
25   rdoc.rdoc_dir = 'docs/api'
26   rdoc.title    = "EventMachine -- Event Based Application Framework"
27   rdoc.options << "--include=examples --line-numbers --inline-source"
28 }
29
30 Gem::manage_gems
31 require 'rake/gempackagetask'
32
33 spec = Gem::Specification.new do |s|
34   s.name = "EventMachine"
35   s.version = PKG_VERSION
36   s.homepage = "http://eventmachine.com/"
37   s.platform = Gem::Platform::RUBY
38   s.summary = "An event based application framework tailored for high performance networking."
39   s.description = "An asynchronous, event based processing and I/O framework that streamlines the process of developing high performance networking systems."
40
41   s.files = FileList["{test,lib,docs}/**/*"].to_a
42   s.files += ['GPL', 'LICENSE', 'README', 'Rakefile',
43     'ChangeLog', 'Credits', 'TODO']
44   s.autorequire = "machine"
45   s.has_rdoc = true
46   s.extra_rdoc_files = ["README", "GPL"]
47   s.rdoc_options.concat ['--main', 'README', '--line-numbers']
48
49   s.author = "Francis Cianfrocca, Jeff Rose"
50   s.email = "garbagecat10@gmail.com, rosejn@gmail.com"
51 end
52
53 Rake::GemPackageTask.new(spec) do |pkg|
54   pkg.gem_spec = spec
55   pkg.need_tar = true
56   pkg.need_zip = true
57 end
58
59 task :lines do
60   lines = 0
61   codelines = 0
62   Dir.glob("lib/**/*") { |file_name|
63     next unless file_name =~ /.*rb/
64
65     f = File.open(file_name)
66
67     while line = f.gets
68       lines += 1
69       next if line =~ /^\s*$/
70       next if line =~ /^\s*#/
71       codelines += 1
72     end
73   }
74   puts "\n------------------------------\n"
75   puts "Total Lines: #{lines}"
76   puts "Lines of Code: #{codelines}"
77 end
Note: See TracBrowser for help on using the browser.