/
Rakefile
163 lines (128 loc) · 5.23 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
150
151
152
153
154
155
156
157
158
159
160
require "rdoc/task"
require "rubygems/package_task"
require "rake/testtask"
require "rake/clean"
require "rubygems"
# Some definitions that you'll need to edit in case you reuse this
# Rakefile for your own project.
SHORTNAME ='tlv' # this should be the rubyforge project name
DESC ='lib for handling tlv data'
PKG_VERSION ='0.0.3'
LONG_DESC = <<END_DESC
lib for handling tlv (der) and dgi encoded data
END_DESC
RUBYFORGE_USER ='a2800276'
AUTHOR = "Tim Becker"
EMAIL = "tim@kuriositaet.de"
HOMEPAGE = "http://github.com/a2800276/tlv"
# Specifies the default task to execute. This is often the "test" task
# and we'll change things around as soon as we have some tests.
task :default => [:test]
# The directory to generate +rdoc+ in.
RDOC_DIR="doc/html"
# This global variable contains files that will be erased by the `clean` task.
# The `clean` task itself is automatically generated by requiring `rake/clean`.
CLEAN << RDOC_DIR << "pkg"
# This is the task that generates the +rdoc+ documentation from the
# source files. Instantiating Rake::RDocTask automatically generates a
# task called `rdoc`.
Rake::RDocTask.new do |rd|
# Options for documenation generation are specified inside of
# this block. For example the following line specifies that the
# content of the README file should be the main page of the
# documenation.
rd.main = "README"
# The following line specifies all the files to extract
# documenation from.
rd.rdoc_files.include( "README", "AUTHORS", "LICENSE", "TODO",
"CHANGELOG", "bin/**/*", "lib/**/*.rb",
"examples/**/*rb", "doc/*.rdoc")
# This one specifies the output directory ...
rd.rdoc_dir = "doc/html"
# Or the HTML title of the generated documentation set.
rd.title = "#{SHORTNAME}: #{DESC}"
# These are options specifiying how source code inlined in the
# documentation should be formatted.
rd.options = ["--line-numbers", "--inline-source"]
# Check:
# `rdoc --help` for more rdoc options
# the {rdoc documenation home}[http://www.ruby-doc.org/stdlib/libdoc/rdoc/rdoc/index.html]
# or the documentation for the +Rake::RDocTask+ task[http://rake.rubyforge.org/classes/Rake/RDocTask.html]
end
Rake::RDocTask.new(:rdoc_dev) do |rd|
# Options for documenation generation are specified inside of
# this block. For example the following line specifies that the
# content of the README file should be the main page of the
# documenation.
rd.main = "README"
# The following line specifies all the files to extract
# documenation from.
rd.rdoc_files.include( "README", "AUTHORS", "LICENSE", "TODO",
"CHANGELOG", "bin/**/*", "lib/**/*.rb",
"examples/**/*rb","test/**/*.rb", "doc/*.rdoc")
# This one specifies the output directory ...
rd.rdoc_dir = "doc/dev_html"
# Or the HTML title of the generated documentation set.
rd.title = "#{SHORTNAME}: #{DESC}"
# These are options specifiying how source code inlined in the
# documentation should be formatted.
rd.options = ["--line-numbers", "--inline-source"]
# Check:
# `rdoc --help` for more rdoc options
# the {rdoc documenation home}[http://www.ruby-doc.org/stdlib/libdoc/rdoc/rdoc/index.html]
# or the documentation for the +Rake::RDocTask+ task[http://rake.rubyforge.org/classes/Rake/RDocTask.html]
end
# The GemPackageTask facilitates getting all your files collected
# together into gem archives. You can also use it to generate tarball
# and zip archives.
# First you'll need to assemble a gemspec
PKG_FILES = FileList['lib/**/*.rb', 'bin/**/*', 'examples/**/*', '[A-Z]*', 'test/**/*'].to_a
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "#{SHORTNAME}: #{DESC}"
s.add_dependency "hexy"
s.name = SHORTNAME
s.version = PKG_VERSION
s.files = PKG_FILES
s.requirements << "none"
s.require_path = 'lib'
s.description = LONG_DESC
s.author = AUTHOR
s.email = EMAIL
s.homepage = HOMEPAGE
s.has_rdoc = true
s.executables = ["parse_tlv", "parse_dgi"]
end
# Adding a new GemPackageTask adds a task named `package`, which generates
# packages as gems, tarball and zip archives.
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar_gz = true
end
# This task is used to demonstrate how to upload files to Rubyforge.
# Calling `upload_page` creates a current version of the +rdoc+
# documentation and uploads it to the Rubyforge homepage of the project,
# assuming it's hosted there and naming conventions haven't changed.
#
# This task uses `sh` to call the `scp` binary, which is plattform
# dependant and may not be installed on your computer if you're using
# Windows. I'm currently not aware of any pure ruby way to do scp
# transfers.
RubyForgeProject=SHORTNAME
desc "Upload the web pages to the web."
task :upload_pages => ["rdoc"] do
if RubyForgeProject then
path = "/var/www/gforge-projects/#{RubyForgeProject}"
sh "scp -r doc/html/* #{RUBYFORGE_USER}@rubyforge.org:#{path}"
sh "scp doc/images/*.png #{RUBYFORGE_USER}@rubyforge.org:#{path}/images"
end
end
# This task will run the unit tests provided in files called
# `test/test*.rb`. The task itself can be run with a call to `rake test`
Rake::TestTask.new do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/*.rb']
t.ruby_opts = ["-rubygems"]
t.verbose = true
end