-
Notifications
You must be signed in to change notification settings - Fork 12
/
Rakefile
149 lines (129 loc) · 3.71 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
require 'rake'
require 'rake/testtask'
require 'rake/extensiontask'
require 'rake/clean'
require 'rbconfig'
require 'rubygems/package'
Rake::ExtensionTask.new('rkerberos')
CLEAN.include(
'**/*.gem', # Gem files
'**/*.rbc', # Rubinius
'**/*.o', # C object file
'**/*.log', # Ruby extension build log
'**/Makefile', # C Makefile
'**/conftest.dSYM', # OS X build directory
'**/tmp', # Temp directory
"**/*.#{RbConfig::CONFIG['DLEXT']}" # C shared object
)
desc 'Create a tarball of the source'
task :archive do
spec = eval(IO.read('rkerberos.gemspec'))
prefix = "rkerberos-#{spec.version}/"
Dir['*.tar*'].each{ |f| File.delete(f) }
sh "git archive --prefix=#{prefix} --format=tar HEAD > rkerberos-#{spec.version}.tar"
sh "gzip rkerberos-#{spec.version}.tar"
end
namespace :gem do
desc 'Delete any existing gem files in the project.'
task :clean do
Dir['*.gem'].each{ |f| File.delete(f) }
rm_rf 'lib'
end
desc 'Create the gem'
task :create => [:clean] do
spec = eval(IO.read('rkerberos.gemspec'))
Gem::Package.build(spec)
end
desc 'Install the gem'
task :install => [:create] do
file = Dir["*.gem"].first
sh "gem install #{file}"
end
desc 'Create a binary gem'
task :binary => [:clean, :compile] do
spec = eval(IO.read('rkerberos.gemspec'))
spec.platform = Gem::Platform::CURRENT
spec.extensions = nil
spec.files = spec.files.reject{ |f| f.include?('ext') }
Gem::Builder.new(spec).build
end
end
namespace :sample do
desc "Run the sample configuration display program"
task :config => [:compile] do
sh "ruby -Ilib samples/sample_config_display.rb"
end
end
namespace 'test' do
Rake::TestTask.new('all') do |t|
task :all => [:clean, :compile]
t.libs << 'ext'
t.warning = true
t.verbose = true
end
Rake::TestTask.new('context') do |t|
task :context => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_context.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('ccache') do |t|
task :ccache => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_credentials_cache.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('krb5') do |t|
task :krb5 => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_krb5.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('keytab') do |t|
task :keytab => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_krb5_keytab.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('keytab_entry') do |t|
task :keytab_entry => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_keytab_entry.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('principal') do |t|
task :principal => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_principal.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('kadm5') do |t|
task :kadm5 => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_kadm5.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('config') do |t|
task :config => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_config.rb']
t.warning = true
t.verbose = true
end
Rake::TestTask.new('policy') do |t|
task :policy => [:clean, :compile]
t.libs << 'ext'
t.test_files = FileList['test/test_policy.rb']
t.warning = true
t.verbose = true
end
end
task :default => ['test:all']
task :test => ['test:all']