-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRakefile
114 lines (91 loc) · 2.88 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
# load libraries
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'lib/wirble.rb'
def package_info
require 'ostruct'
require 'rubygems'
# create package
ret = OpenStruct.new
# set package information
ret.name = 'Wirble'
ret.blurb = 'Handful of common Irb features, made easy.'
ret.description = <<-EOF
A handful of useful Irb features, including colorized results,
tab-completion, history, a simple prompt, and several helper
methods, all rolled into one easy to use package.
EOF
ret.version = Wirble::VERSION
ret.platform = Gem::Platform::RUBY
ret.url = 'http://pablotron.org/software/wirble/'
# author information
ret.author_names = ['Paul Duncan', 'Jens Wille']
ret.author_emails = ['[email protected]', '[email protected]']
# requirements and files
ret.reqs = ['none']
ret.include_files = Dir['lib/**/*'] + Dir['[A-Z]*'] + %w[
sample.irbrc setup.rb
]
# rdoc info
ret.rdoc_title = "#{ret.name} #{ret.version} API Documentation"
ret.rdoc_options = %w{--webcvs http://hg.pablotron.org/wirble}
ret.rdoc_dir = 'doc'
ret.rdoc_files = %w{lib/**/*.rb README}
# runtime info
ret.auto_require = 'wirble'
ret.require_path = 'lib'
ret.package_name = 'wirble'
# package release dir
if path = ENV['RAKE_PACKAGE_DIR']
ret.pkg_dir = File.join(File.expand_path(path), ret.package_name)
end
if files = ret.rdoc_files
ret.rdoc_files = files.map { |e| Dir.glob(e) }.flatten.compact
end
# return package
ret
end
pkg = package_info
gem_spec = Gem::Specification.new do |s|
# package information
s.name = 'blackwinter-' + pkg.name.downcase
s.platform = pkg.platform
s.version = pkg.version
s.summary = s.description = pkg.blurb
s.rubyforge_project = 'pablotron'
# files
pkg.reqs.each { |req| s.requirements << req }
s.files = pkg.include_files
# runtime info
s.executables = pkg.executables
s.require_path = pkg.require_path
s.autorequire = pkg.auto_require
# dependencies
# pkg.dependencies.each { |dep| s.add_dependency(dep) }
# rdoc info
s.has_rdoc = true
s.rdoc_options = ['--title', pkg.rdoc_title] + pkg.rdoc_options + pkg.rdoc_files
# author and project details
s.authors = pkg.author_names
s.email = pkg.author_emails
s.homepage = pkg.url
# gem crypto stuff
if pkg.signing_key && pkg.signing_chain
s.signing_key = pkg.signing_key
s.signing_chain = pkg.signing_chain
end
end
Rake::GemPackageTask.new(gem_spec) do |p|
p.need_tar_gz = true
# p.need_pgp_signature = true
p.package_dir = pkg.pkg_dir if pkg.pkg_dir
end
Rake::RDocTask.new do |rd|
rd.title = pkg.rdoc_title
rd.rdoc_dir = pkg.rdoc_dir
rd.rdoc_files.include(*pkg.rdoc_files)
rd.options.concat(pkg.rdoc_options)
end
task :clean => [:clobber]
task :release => [:clean, :package]