-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
111 lines (94 loc) · 3.04 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
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require File.join(File.dirname(__FILE__), '/lib/saml_2_ruby/version')
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME = 'saml2ruby'
PKG_VERSION = SAML::VERSION::STRING + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_DESTINATION = ENV["PKG_DESTINATION"] || "../#{PKG_NAME}"
RELEASE_NAME = "REL #{PKG_VERSION}"
PKG_FILES = FileList[
#'CHANGELOG',
#'LICENSE',
'README',
#'TODO',
'Rakefile',
'bin/**/*',
'doc/**/*',
'lib/**/*',
] - [ 'test' ]
require 'rubygems'
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "saml2ruby"
gemspec.summary = "Ruby implementation of the SAML 2.0 Specification"
gemspec.description = %Q{Part of the OpenSSO extension set. Writting by the wonderful guys over at Sun. Moved it over to a github repo and turned it into a rubygem.}
gemspec.email = ["[email protected]"]
gemspec.homepage = "http://github.com/scashin133/saml2ruby"
gemspec.authors = ["Sean Cashin"]
gemspec.add_dependency('XMLCanonicalizer', '>=1.0.1')
gemspec.version = PKG_VERSION
gemspec.files = PKG_FILES.to_a
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the library.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
test_files = FileList['test/**/*_test.rb']
t.test_files = test_files
t.verbose = true
end
desc 'Generate documentation for the library.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'RSAML'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
namespace :rcov do
desc 'Measures test coverage'
task :test do
rm_f 'coverage.data'
mkdir 'coverage' unless File.exist?('coverage')
rcov = "rcov --aggregate coverage.data --text-summary -Ilib"
system("#{rcov} test/*_test.rb")
#system("open coverage/index.html") if PLATFORM['darwin']
end
end
desc "Generate code statistics"
task :lines do
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
for file_name in FileList["lib/**/*.rb"]
next if file_name =~ /vendor/
f = File.open(file_name)
while line = f.gets
lines += 1
next if line =~ /^\s*$/
next if line =~ /^\s*#/
codelines += 1
end
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
total_lines += lines
total_codelines += codelines
lines, codelines = 0, 0
end
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
end
desc "Reinstall the gem from a local package copy"
task :reinstall => [:package] do
windows = RUBY_PLATFORM =~ /mswin/
sudo = windows ? '' : 'sudo'
gem = windows ? 'gem.bat' : 'gem'
`#{sudo} #{gem} uninstall -x -i #{PKG_NAME}`
`#{sudo} #{gem} install pkg/#{PKG_NAME}-#{PKG_VERSION}`
end