public
Description: XMPP/Jabber Library for Ruby
Homepage: http://home.gna.org/xmpp4r
Clone URL: git://github.com/ln/xmpp4r.git
xmpp4r / Rakefile
100644 104 lines (87 sloc) 2.215 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
93
94
95
96
97
98
99
100
101
102
103
104
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/rdoctask'
require 'rake'
require 'find'
 
begin
  require 'rubygems'
  require 'rcov/rcovtask'
  RCOV = true
rescue LoadError
  RCOV = false
end
 
 
# Globals
 
PKG_NAME = 'xmpp4r'
PKG_VERSION = '0.3'
 
PKG_FILES = ['ChangeLog', 'README', 'COPYING', 'LICENSE', 'setup.rb', 'Rakefile']
Find.find('lib/', 'data/', 'test/', 'tools/') do |f|
if FileTest.directory?(f) and f =~ /\.svn/
Find.prune
else
PKG_FILES << f
end
end
 
 
# Tasks
 
task :default => [:package]
 
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/tc_*.rb']
end
 
Rake::RDocTask.new do |rd|
  f = []
  require 'find'
  Find.find('lib/') do |file|
    # Skip hidden files (.svn/ directories and Vim swapfiles)
    if file.split(/\//).last =~ /^\./
      Find.prune
    else
      f << file if not FileTest.directory?(file)
    end
  end
  f.delete('lib/xmpp4r.rb')
  # hack to document the Jabber module properly
  f.unshift('lib/xmpp4r.rb')
  rd.rdoc_files.include(f)
  rd.options << '--all'
  rd.options << '--diagram'
  rd.options << '--fileboxes'
  rd.options << '--inline-source'
  rd.options << '--line-numbers'
  rd.rdoc_dir = 'rdoc'
end
 
task :doctoweb => [:rdoc] do |t|
   # copies the rdoc to the CVS repository for xmpp4r website
# repository is in $CVSDIR (default: ~/dev/xmpp4r-web)
   sh "tools/doctoweb.bash"
end
 
Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p|
p.need_tar = true
p.package_files = PKG_FILES
p p.package_files
end
 
if RCOV
Rcov::RcovTask.new do |t|
#t.test_files = FileList['test/tc_*.rb'] + FileList['test/*/tc_*.rb'] - ['test/tc_streamError.rb']
t.test_files = ['test/ts_xmpp4r.rb']
end
end
 
# "Gem" part of the Rakefile
begin
require 'rake/gempackagetask'
 
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Ruby library for Jabber Instant-Messaging"
s.name = PKG_NAME
s.version = PKG_VERSION
s.requirements << 'none'
s.require_path = 'lib'
s.autorequire = 'xmpp4r'
s.files = PKG_FILES
s.description = "Ruby library for Jabber Instant-Messaging"
end
 
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
rescue LoadError
end