-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
99 lines (81 loc) · 2.26 KB
/
Rakefile
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
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/clean'
require 'rake/rdoctask'
NAME = 'bitpack'
VERS = '0.1'
GEM_NAME = "#{NAME}-#{VERS}.gem"
TGZ_NAME = "#{NAME}-#{VERS}.tgz"
RUBYFORGE_USER = "burrows"
WWW = "#{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{NAME}/"
RDOC_MAIN = "README"
spec = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS
s.author = "Corey Burrows"
s.email = "[email protected]"
s.platform = Gem::Platform::RUBY
s.summary = "Library for packing and unpacking binary strings."
s.files = %w{README CHANGELOG LICENSE Rakefile} +
Dir.glob("ext/**/*.{h,c,rb}") +
Dir.glob("lib/**/*.{rb}") +
Dir.glob("test/**/*.rb")
s.require_path = "."
s.autorequire = "bitpack"
s.extensions = ["ext/extconf.rb"]
#s.test_file = ""
s.has_rdoc = true
s.extra_rdoc_files = [ RDOC_MAIN, "CHANGELOG", "LICENSE" ]
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
Rake::RDocTask.new(:rdoc) do |rd|
rd.main = RDOC_MAIN
rd.rdoc_files.include(RDOC_MAIN, "CHANGELOG", "LICENSE", "ext/**/*.c", "lib/**/*.rb")
rd.options << "--all"
end
CLEAN.include FileList["ext/**/*.o",
"ext/**/*.so",
"ext/**/*.bundle",
"ext/**/Makefile",
"ext/**/mkmf.log",
"pkg/*",
"test/*.o",
"test/test_driver",
"html"
]
task :build do
Dir.chdir('ext')
sh('ruby extconf.rb')
sh('make')
Dir.chdir('..')
end
task :c_test do
Dir.chdir('test')
sh('make')
Dir.chdir('..')
end
task :ruby_test do
Dir.chdir('test')
sh('ruby bitpack_tests.rb')
Dir.chdir('..')
end
task :test => [ :build, :c_test, :ruby_test ] do
end
task :gem do
sh %{rake pkg/#{GEM_NAME}}
end
task :tgz do
sh %{rake pkg/#{TGZ_NAME}}
end
task :package => [ :gem, :tgz ]
task :install => :gem do
sh %{gem install pkg/#{GEM_NAME}}
end
task :uninstall do
sh %{gem uninstall #{NAME}}
end
task :www => :rdoc do
sh("scp -r html/* #{WWW}")
end