sysexits 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.md +15 -0
- data/README.md +81 -18
- data/Rakefile +61 -339
- data/lib/sysexits.rb +2 -2
- data/spec/sysexits_spec.rb +2 -2
- metadata +114 -52
- metadata.gz.sig +0 -0
- data/ChangeLog +0 -0
- data/rake/191_compat.rb +0 -26
- data/rake/dependencies.rb +0 -76
- data/rake/documentation.rb +0 -123
- data/rake/helpers.rb +0 -502
- data/rake/hg.rb +0 -287
- data/rake/manual.rb +0 -787
- data/rake/packaging.rb +0 -129
- data/rake/publishing.rb +0 -348
- data/rake/style.rb +0 -62
- data/rake/svn.rb +0 -668
- data/rake/testing.rb +0 -151
- data/rake/verifytask.rb +0 -64
data.tar.gz.sig
CHANGED
Binary file
|
data/History.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## 1.0.2 [2010-12-22] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Converted to RSpec 2, Hoe.
|
4
|
+
|
5
|
+
|
6
|
+
## 1.0.1 [2010-10-14] Michael Granger <ged@FaerieMUD.org>
|
7
|
+
|
8
|
+
Fixes for Ruby 1.9.2.
|
9
|
+
|
10
|
+
|
11
|
+
## 1.0.0 [2010-06-19] Michael Granger <ged@FaerieMUD.org>
|
12
|
+
|
13
|
+
Initial release.
|
14
|
+
|
15
|
+
|
data/README.md
CHANGED
@@ -1,46 +1,109 @@
|
|
1
1
|
# sysexits
|
2
2
|
|
3
|
-
|
3
|
+
* http://deveiate.org/sysexits.html
|
4
4
|
|
5
|
-
|
5
|
+
## Description
|
6
6
|
|
7
|
-
|
7
|
+
Have you ever wanted to call exit() with an error condition, but weren't sure
|
8
|
+
what exit status to use? No? Maybe it's just me, then.
|
8
9
|
|
9
|
-
|
10
|
+
Anyway, I was reading manpages late one evening before retiring to bed in my
|
11
|
+
palatial estate in rural Oregon, and I stumbled across sysexits(3). Much to my
|
12
|
+
chagrin, I couldn't find a 'sysexits' for Ruby! Well, for the other 2 people
|
13
|
+
that actually care about style(9) as it applies to Ruby code, now there is
|
14
|
+
one!
|
15
|
+
|
16
|
+
Sysexits is a _completely awesome_ collection of human-readable constants for
|
17
|
+
the standard (BSDish) exit codes, used as arguments to `Kernel.exit` to
|
18
|
+
indicate a specific error condition to the parent process.
|
19
|
+
|
20
|
+
It's so fantastically fabulous that you'll want to fork it right away to avoid
|
21
|
+
being thought of as that guy that's still using Webrick for his blog. I mean,
|
22
|
+
`exit(1)` is so passé! This is like the 14-point font of Systems Programming.
|
23
|
+
|
24
|
+
Like the C header file from which this was derived (I mean forked, naturally),
|
25
|
+
error numbers begin at `Sysexits::EX__BASE` (which is way more cool than plain
|
26
|
+
old '64') to reduce the possibility of clashing with other exit statuses that
|
27
|
+
other programs may already return.
|
28
|
+
|
29
|
+
The codes are available in two forms: as constants which can be imported into
|
30
|
+
your own namespace via `include Sysexits`, or as `Sysexits::STATUS_CODES`, a
|
31
|
+
Hash keyed by Symbols derived from the constant names.
|
10
32
|
|
11
33
|
Allow me to demonstrate. First, the old way:
|
12
34
|
|
13
35
|
exit( 69 )
|
14
36
|
|
15
|
-
Whaaa...? Is that a euphemism? What's going on? See how unattractive and...
|
37
|
+
Whaaa...? Is that a euphemism? What's going on? See how unattractive and...
|
38
|
+
well, 1970 that is? We're not changing vaccuum tubes here, people, we're
|
39
|
+
_building a totally-awesome future in the Cloud™!_
|
16
40
|
|
17
41
|
include Sysexits
|
18
42
|
exit EX_UNAVAILABLE
|
19
43
|
|
20
|
-
Okay, at least this is readable to people who have used fork() more
|
21
|
-
|
44
|
+
Okay, at least this is readable to people who have used fork() more than
|
45
|
+
twice, but you could do so much better!
|
22
46
|
|
23
47
|
include Sysexits
|
24
48
|
exit :unavailable
|
25
49
|
|
26
|
-
Holy Toledo! It's like we're writing Ruby, but our own made-up
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
wiser.
|
50
|
+
Holy Toledo! It's like we're writing Ruby, but our own made-up dialect in
|
51
|
+
which variable++ is possible! Well, okay, it's not quite that cool. But it
|
52
|
+
does look more Rubyish. And no monkeys were patched in the filming of this
|
53
|
+
episode! All the simpletons still exiting with icky *numbers* can still
|
54
|
+
continue blithely along, none the wiser.
|
32
55
|
|
33
56
|
## Contributing
|
34
57
|
|
35
|
-
You can
|
58
|
+
You can clone the source with Mercurial, submit bug reports, suggestions,
|
59
|
+
etc., via the project page:
|
60
|
+
|
61
|
+
https://bitbucket.org/ged/sysexits
|
62
|
+
|
63
|
+
Or if you prefer Git, you can clone the source via its Github mirror:
|
64
|
+
|
65
|
+
https://github.com/ged/sysexits
|
66
|
+
|
67
|
+
After checking out the source, run:
|
36
68
|
|
37
|
-
|
69
|
+
$ rake newb
|
38
70
|
|
39
|
-
|
71
|
+
This task will install any missing dependencies, run the tests/specs,
|
72
|
+
and generate the RDoc.
|
73
|
+
|
74
|
+
You can read more super-exited pointless marketing at:
|
40
75
|
|
41
76
|
http://deveiate.org/sysexits.html
|
42
77
|
|
43
|
-
|
78
|
+
Or maybe not.
|
79
|
+
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
Copyright (c) 2010, Michael Granger
|
84
|
+
All rights reserved.
|
85
|
+
|
86
|
+
Redistribution and use in source and binary forms, with or without
|
87
|
+
modification, are permitted provided that the following conditions are met:
|
88
|
+
|
89
|
+
* Redistributions of source code must retain the above copyright notice,
|
90
|
+
this list of conditions and the following disclaimer.
|
91
|
+
|
92
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
93
|
+
this list of conditions and the following disclaimer in the documentation
|
94
|
+
and/or other materials provided with the distribution.
|
44
95
|
|
45
|
-
|
96
|
+
* Neither the name of the author/s, nor the names of the project's
|
97
|
+
contributors may be used to endorse or promote products derived from this
|
98
|
+
software without specific prior written permission.
|
46
99
|
|
100
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
101
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
102
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
103
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
104
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
105
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
106
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
107
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
108
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
109
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Rakefile
CHANGED
@@ -1,365 +1,87 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# sysexits rakefile
|
4
|
-
#
|
5
|
-
# Based on various other Rakefiles, especially one by Ben Bleything
|
6
|
-
#
|
7
|
-
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
8
|
-
#
|
9
|
-
# Authors:
|
10
|
-
# * Michael Granger <ged@FaerieMUD.org>
|
11
|
-
#
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
#encoding: utf-8
|
12
3
|
|
13
|
-
|
14
|
-
require 'rbconfig'
|
15
|
-
require 'pathname'
|
16
|
-
basedir = Pathname.new( __FILE__ ).dirname
|
4
|
+
require 'hoe'
|
17
5
|
|
18
|
-
|
19
|
-
|
6
|
+
Hoe.plugin :mercurial
|
7
|
+
Hoe.plugin :yard
|
8
|
+
Hoe.plugin :signing
|
20
9
|
|
21
|
-
|
22
|
-
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
23
|
-
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
24
|
-
}
|
10
|
+
Hoe.plugins.delete :rubyforge
|
25
11
|
|
26
|
-
|
27
|
-
|
28
|
-
include Readline
|
29
|
-
rescue LoadError
|
30
|
-
# Fall back to a plain prompt
|
31
|
-
def readline( text )
|
32
|
-
$stderr.print( text.chomp )
|
33
|
-
return $stdin.gets
|
34
|
-
end
|
35
|
-
end
|
12
|
+
hoespec = Hoe.spec 'sysexits' do
|
13
|
+
self.readme_file = 'README.md'
|
36
14
|
|
37
|
-
|
38
|
-
require 'rubygems'
|
39
|
-
rescue LoadError
|
40
|
-
module Gem
|
41
|
-
class Specification; end
|
42
|
-
end
|
43
|
-
end
|
15
|
+
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
44
16
|
|
45
|
-
|
46
|
-
|
47
|
-
require 'rake/testtask'
|
48
|
-
require 'rake/packagetask'
|
49
|
-
require 'rake/clean'
|
50
|
-
# require 'rake/191_compat.rb'
|
17
|
+
self.extra_dev_deps <<
|
18
|
+
['rspec', '~> 2.1.0']
|
51
19
|
|
52
|
-
|
20
|
+
self.spec_extras[:licenses] = ["BSD"]
|
21
|
+
self.spec_extras[:post_install_message] = %{
|
22
|
+
Get ready to be amazed. I'll bet you can't wait to Exit Like
|
23
|
+
a Pro®!
|
24
|
+
|
25
|
+
Well, if you want, you can do it right from the command-line! Check
|
26
|
+
this out:
|
27
|
+
|
28
|
+
ruby -rubygems -e \\
|
29
|
+
'require "sysexits"; include Sysexits; exit :software_error' \\
|
30
|
+
|| echo $?
|
53
31
|
|
54
|
-
|
55
|
-
|
56
|
-
BINDIR = BASEDIR + 'bin'
|
57
|
-
LIBDIR = BASEDIR + 'lib'
|
58
|
-
EXTDIR = BASEDIR + 'ext'
|
59
|
-
DOCSDIR = BASEDIR + 'docs'
|
60
|
-
PKGDIR = BASEDIR + 'pkg'
|
61
|
-
DATADIR = BASEDIR + 'data'
|
32
|
+
I know, I know: so awesome right? Okay, I'll let you bask in the
|
33
|
+
warn glow of superior systems-programming now.
|
62
34
|
|
63
|
-
|
35
|
+
}.gsub( /^\t+/m, '' )
|
64
36
|
|
65
|
-
|
66
|
-
PKG_NAME = PROJECT_NAME.downcase
|
67
|
-
PKG_SUMMARY = 'Exit status codes for system programs.'
|
37
|
+
self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
|
68
38
|
|
69
|
-
|
70
|
-
|
71
|
-
CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
|
39
|
+
self.require_ruby_version( '>=1.8.7' )
|
40
|
+
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags )
|
72
41
|
|
73
|
-
|
74
|
-
|
75
|
-
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
|
76
|
-
elsif VERSION_FILE.exist?
|
77
|
-
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
42
|
+
self.yard_opts = [ '--use-cache', '--protected', '--verbose' ]
|
43
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
78
44
|
end
|
79
45
|
|
80
|
-
|
81
|
-
|
82
|
-
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
83
|
-
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
84
|
-
|
85
|
-
# Universal VCS constants
|
86
|
-
DEFAULT_EDITOR = 'vi'
|
87
|
-
COMMIT_MSG_FILE = 'commit-msg.txt'
|
88
|
-
FILE_INDENT = " " * 12
|
89
|
-
LOG_INDENT = " " * 3
|
90
|
-
|
91
|
-
EXTCONF = EXTDIR + 'extconf.rb'
|
92
|
-
|
93
|
-
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
94
|
-
|
95
|
-
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
|
96
|
-
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
97
|
-
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
98
|
-
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
99
|
-
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
|
100
|
-
|
101
|
-
SPECDIR = BASEDIR + 'spec'
|
102
|
-
SPECLIBDIR = SPECDIR + 'lib'
|
103
|
-
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
104
|
-
|
105
|
-
TESTDIR = BASEDIR + 'tests'
|
106
|
-
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
|
107
|
-
|
108
|
-
RAKE_TASKDIR = BASEDIR + 'rake'
|
109
|
-
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
110
|
-
PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
|
111
|
-
PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
|
112
|
-
|
113
|
-
RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
|
114
|
-
|
115
|
-
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
116
|
-
|
117
|
-
EXTRA_PKGFILES = Rake::FileList.new
|
46
|
+
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
118
47
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
"Ruby-Talk List <ruby-talk@ruby-lang.org>",
|
134
|
-
]
|
135
|
-
|
136
|
-
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
137
|
-
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
138
|
-
RCOV_OPTS = [
|
139
|
-
'--exclude', RCOV_EXCLUDES,
|
140
|
-
'--xrefs',
|
141
|
-
'--save',
|
142
|
-
'--callsites',
|
143
|
-
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
|
144
|
-
]
|
145
|
-
|
146
|
-
|
147
|
-
### Load some task libraries that need to be loaded early
|
148
|
-
if !RAKE_TASKDIR.exist?
|
149
|
-
$stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
|
150
|
-
ans = readline( "for you? [y]" )
|
151
|
-
ans = 'y' if !ans.nil? && ans.empty?
|
152
|
-
|
153
|
-
if ans =~ /^y/i
|
154
|
-
$stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
|
155
|
-
system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
|
156
|
-
if ! $?.success?
|
157
|
-
fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
|
48
|
+
begin
|
49
|
+
include Hoe::MercurialHelpers
|
50
|
+
|
51
|
+
### Task: prerelease
|
52
|
+
desc "Append the package build number to package versions"
|
53
|
+
task :pre do
|
54
|
+
rev = get_numeric_rev()
|
55
|
+
trace "Current rev is: %p" % [ rev ]
|
56
|
+
hoespec.spec.version.version << "pre#{rev}"
|
57
|
+
Rake::Task[:gem].clear
|
58
|
+
|
59
|
+
Gem::PackageTask.new( hoespec.spec ) do |pkg|
|
60
|
+
pkg.need_zip = true
|
61
|
+
pkg.need_tar = true
|
158
62
|
end
|
159
|
-
else
|
160
|
-
$stderr.puts "Then I'm afraid I can't continue. Best of luck."
|
161
|
-
fail "Rake tasklibs not present."
|
162
63
|
end
|
163
64
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
id = `#{hg} id -n`.chomp
|
173
|
-
PKG_BUILD = "pre%03d" % [(id.chomp[ /^[[:xdigit:]]+/ ] || '1')]
|
174
|
-
else
|
175
|
-
PKG_BUILD = 'pre000'
|
176
|
-
end
|
177
|
-
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
178
|
-
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
179
|
-
|
180
|
-
# Documentation constants
|
181
|
-
API_DOCSDIR = DOCSDIR + 'api'
|
182
|
-
README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
|
183
|
-
RDOC_OPTIONS = [
|
184
|
-
'--tab-width=4',
|
185
|
-
'--show-hash',
|
186
|
-
'--include', BASEDIR.to_s,
|
187
|
-
"--main=#{README_FILE}",
|
188
|
-
"--title=#{PKG_NAME}",
|
189
|
-
]
|
190
|
-
YARD_OPTIONS = [
|
191
|
-
'--use-cache',
|
192
|
-
'--no-private',
|
193
|
-
'--protected',
|
194
|
-
'-r', README_FILE,
|
195
|
-
'--exclude', 'extconf\\.rb',
|
196
|
-
'--files', 'ChangeLog,LICENSE',
|
197
|
-
'--output-dir', API_DOCSDIR.to_s,
|
198
|
-
'--title', "#{PKG_NAME} #{PKG_VERSION}",
|
199
|
-
]
|
200
|
-
|
201
|
-
# Release constants
|
202
|
-
SMTP_HOST = "mail.faeriemud.org"
|
203
|
-
SMTP_PORT = 465 # SMTP + SSL
|
204
|
-
|
205
|
-
# Project constants
|
206
|
-
PROJECT_HOST = 'deveiate.org'
|
207
|
-
PROJECT_PUBDIR = '/usr/local/www/public/code/'
|
208
|
-
PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
209
|
-
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
210
|
-
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
211
|
-
|
212
|
-
GEM_PUBHOST = 'rubygems.org'
|
213
|
-
|
214
|
-
# Gem dependencies: gemname => version
|
215
|
-
DEPENDENCIES = {
|
216
|
-
}
|
217
|
-
|
218
|
-
# Developer Gem dependencies: gemname => version
|
219
|
-
DEVELOPMENT_DEPENDENCIES = {
|
220
|
-
'rake' => '>= 0.8.7',
|
221
|
-
'rcodetools' => '>= 0.7.0.0',
|
222
|
-
'rcov' => '>= 0.8.1.2.0',
|
223
|
-
'rdoc' => '>= 2.4.3',
|
224
|
-
'RedCloth' => '>= 4.0.3',
|
225
|
-
'rspec' => '>= 1.2.6',
|
226
|
-
'ruby-termios' => '>= 0.9.6',
|
227
|
-
'text-format' => '>= 1.0.0',
|
228
|
-
'tmail' => '>= 1.2.3.1',
|
229
|
-
'diff-lcs' => '>= 1.1.2',
|
230
|
-
}
|
231
|
-
|
232
|
-
# Non-gem requirements: packagename => version
|
233
|
-
REQUIREMENTS = {
|
234
|
-
}
|
235
|
-
|
236
|
-
# RubyGem specification
|
237
|
-
GEMSPEC = Gem::Specification.new do |gem|
|
238
|
-
gem.name = PKG_NAME.downcase
|
239
|
-
gem.version = PKG_VERSION
|
240
|
-
|
241
|
-
gem.summary = PKG_SUMMARY
|
242
|
-
gem.description = [
|
243
|
-
"Have you ever wanted to call exit() with an error condition, but",
|
244
|
-
"weren't sure what exit status to use? No? Maybe it's just me, then.",
|
245
|
-
"",
|
246
|
-
"Anyway, I was reading manpages late one evening before retiring to ",
|
247
|
-
"bed in my palatial estate in rural Oregon, and I stumbled across ",
|
248
|
-
"sysexits(3). Much to my chagrin, I couldn't find a 'sysexits' for",
|
249
|
-
"Ruby! Well, for the other 2 people that actually care about style(9) ",
|
250
|
-
"as it applies to Ruby code, now there is one!",
|
251
|
-
].join( "\n" )
|
252
|
-
gem.post_install_message = [
|
253
|
-
"Happy exiting!",
|
254
|
-
].join( "\n" )
|
255
|
-
|
256
|
-
gem.authors = "Michael Granger"
|
257
|
-
gem.email = ["ged@FaerieMUD.org"]
|
258
|
-
gem.homepage = 'http://rubygems.org/gems/sysexits'
|
259
|
-
|
260
|
-
gem.has_rdoc = true
|
261
|
-
gem.rdoc_options = RDOC_OPTIONS
|
262
|
-
gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
|
263
|
-
|
264
|
-
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
265
|
-
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
266
|
-
collect {|pn| File.basename(pn) }
|
267
|
-
gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
|
268
|
-
|
269
|
-
if EXTCONF.exist?
|
270
|
-
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
271
|
-
end
|
272
|
-
|
273
|
-
gem.files = RELEASE_FILES
|
274
|
-
gem.test_files = SPEC_FILES
|
275
|
-
|
276
|
-
# signing key and certificate chain
|
277
|
-
gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
|
278
|
-
gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
|
279
|
-
|
280
|
-
DEPENDENCIES.each do |name, version|
|
281
|
-
version = '>= 0' if version.length.zero?
|
282
|
-
gem.add_runtime_dependency( name, version )
|
283
|
-
end
|
284
|
-
|
285
|
-
REQUIREMENTS.each do |name, version|
|
286
|
-
gem.requirements << [ name, version ].compact.join(' ')
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
$trace = Rake.application.options.trace ? true : false
|
291
|
-
$dryrun = Rake.application.options.dryrun ? true : false
|
292
|
-
$include_dev_dependencies = false
|
293
|
-
|
294
|
-
# Load any remaining task libraries
|
295
|
-
RAKE_TASKLIBS.each do |tasklib|
|
296
|
-
next if tasklib.to_s =~ %r{/helpers\.rb$}
|
297
|
-
begin
|
298
|
-
trace " loading tasklib %s" % [ tasklib ]
|
299
|
-
import tasklib
|
300
|
-
rescue ScriptError => err
|
301
|
-
fail "Task library '%s' failed to load: %s: %s" %
|
302
|
-
[ tasklib, err.class.name, err.message ]
|
303
|
-
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
304
|
-
rescue => err
|
305
|
-
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
|
306
|
-
[ tasklib, err.class.name, err.message ]
|
307
|
-
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
# Load any project-specific rules defined in 'Rakefile.local' if it exists
|
312
|
-
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
313
|
-
|
314
|
-
|
315
|
-
#####################################################################
|
316
|
-
### T A S K S
|
317
|
-
#####################################################################
|
318
|
-
|
319
|
-
### Default task
|
320
|
-
task :default => [:clean, :local, :spec, :apidocs, :package]
|
321
|
-
|
322
|
-
### Task the local Rakefile can append to -- no-op by default
|
323
|
-
task :local
|
324
|
-
|
325
|
-
### Task: clean
|
326
|
-
CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
|
327
|
-
CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
|
328
|
-
|
329
|
-
### Task: changelog
|
330
|
-
file 'ChangeLog' do |task|
|
331
|
-
log "Updating #{task.name}"
|
332
|
-
|
333
|
-
changelog = make_changelog()
|
334
|
-
File.open( task.name, 'w' ) do |fh|
|
335
|
-
fh.print( changelog )
|
65
|
+
### Make the ChangeLog update if the repo has changed since it was last built
|
66
|
+
file '.hg/branch'
|
67
|
+
file 'ChangeLog' => '.hg/branch' do |task|
|
68
|
+
$stderr.puts "Updating the changelog..."
|
69
|
+
content = make_changelog()
|
70
|
+
File.open( task.name, 'w', 0644 ) do |fh|
|
71
|
+
fh.print( content )
|
72
|
+
end
|
336
73
|
end
|
337
|
-
end
|
338
|
-
|
339
74
|
|
340
|
-
|
341
|
-
|
342
|
-
task :cruise => [:clean, 'spec:quiet', :package] do |task|
|
343
|
-
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
|
344
|
-
artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
|
345
|
-
artifact_dir.mkpath
|
75
|
+
# Rebuild the ChangeLog immediately before release
|
76
|
+
task :prerelease => 'ChangeLog'
|
346
77
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
FileUtils.cp_r( 'coverage', artifact_dir )
|
78
|
+
rescue NameError => err
|
79
|
+
task :no_hg_helpers do
|
80
|
+
fail "Couldn't define the :pre task: %s: %s" % [ err.class.name, err.message ]
|
351
81
|
end
|
352
82
|
|
353
|
-
|
354
|
-
|
355
|
-
end
|
356
|
-
|
83
|
+
task :pre => :no_hg_helpers
|
84
|
+
task 'ChangeLog' => :no_hg_helpers
|
357
85
|
|
358
|
-
desc "Update the build system to the latest version"
|
359
|
-
task :update_build do
|
360
|
-
log "Updating the build system"
|
361
|
-
run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
|
362
|
-
log "Updating the Rakefile"
|
363
|
-
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
|
364
86
|
end
|
365
87
|
|