-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRakefile
More file actions
146 lines (119 loc) · 4.62 KB
/
Rakefile
File metadata and controls
146 lines (119 loc) · 4.62 KB
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
#
# Copyright 2006, Red Hat, Inc
# Scott Seago <sseago@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
require "rake/rdoctask"
require "rake/gempackagetask"
require "rake/clean"
require "rubygems"
# 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 => [:rdoc]
# 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","testsuite/**/*.rb")
# This one specifies the output directory ...
rd.rdoc_dir = "doc/html"
# Or the HTML title of the generated documentation set.
rd.title = "RubyWBEM: Documenation"
# 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_VERSION = "0.2.0"
#PKG_FILES = FileList['lib/**/*.rb', 'bin/**/*', 'examples/**/*', '[A-Z]*', 'testsuite/**/*'].to_a
PKG_FILES = FileList['lib/**/*.rb', '[A-Z]*', '*.spec', 'testsuite/**/*.rb', 'testsuite/**/*.sh', 'testsuite/**/*.dtd'].to_a
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "RubyWBEM: a pure-Ruby library for performing operations using the WBEM management protocol."
s.name = 'rubywbem'
s.version = PKG_VERSION
s.files = PKG_FILES
s.requirements << "none"
s.require_path = 'lib'
s.description = <<END_DESC
This is a short description
END_DESC
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar_gz = true
end
task :test do
sh "export RUBYLIB=`pwd`/lib:$RUBYLIB; cd testsuite; ./runtests.sh"
end
SPEC_FILE = "ruby-wbem.spec"
NAME = %x{rpm -q --specfile #{SPEC_FILE} --qf "%{name}\n" | head -1 }.strip
RPM_VERSION = %x{rpm -q --specfile #{SPEC_FILE} --qf "%{version}\n" | head -1}.strip
NV = "#{NAME}-#{RPM_VERSION}"
RPM_FLAGS = ' --define "_topdir %(pwd)" ' +
' --define "_builddir %{_topdir}" ' +
' --define "_rpmdir %{_topdir}" ' +
' --define "_srcrpmdir %{_topdir}" ' +
" --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' " +
' --define "_specdir %{_topdir}" ' +
' --define "_sourcedir %{_topdir}"'
DATADIR = %x{ rpm --eval "%{_datadir}"}
task :clean do
sh "rm -f *~ *.tar.gz *.rpm"
sh "rm -rf #{NV}"
sh "rm -rf testsuite/testtmp/*"
end
task :tar => [:clean] do
sh "install -d #{NV}/lib/wbem"
sh "install -d #{NV}/testsuite"
sh "install AUTHORS CHANGELOG LICENSE Rakefile README ruby-wbem.spec #{NV}"
sh "install lib/wbem/*.rb #{NV}/lib/wbem"
sh "install lib/wbem.rb #{NV}/lib"
sh "install testsuite/*.sh testsuite/*.rb testsuite/*.dtd #{NV}/testsuite"
sh "tar zcvf #{NV}.tar.gz #{NV}"
sh "rm -rf #{NV}"
end
task :rpm => [:tar] do
sh " rpmbuild #{RPM_FLAGS} -ba #{SPEC_FILE}"
end
#
#tar: clean
# install -d $(NV)/mof
# install COPYING AUTHORS README NEWS CHANGELOG $(NV)
# install *.py *.spec Makefile* $(NV)
# install mof/*.mof $(NV)/mof/
# tar zcvf $(NV).tar.gz $(NV)
# rm -rf $(NV)
#
#rpm: tar
# rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
#