sysexits 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Binary file
data/ChangeLog CHANGED
@@ -1,9 +0,0 @@
1
- 2[tip] 5b05aabe75b9 2010-06-18 16:36 -0700 ged
2
- Wow, Kernel.include? Really? Good thing it's Friday.
3
-
4
- 1 975a57604d30 2010-06-18 16:15 -0700 ged
5
- Cleanup, switched README and class docs, docs corrections, no-monkeypatch test.
6
-
7
- 0 917705a6837d 2010-06-18 14:50 -0700 ged
8
- Initial checkin
9
-
data/README.md CHANGED
@@ -36,7 +36,7 @@ You can check out the current development source with Mercurial like so:
36
36
 
37
37
  hg clone http://repo.deveiate.org/sysexits
38
38
 
39
- You can submit bug reports, suggestions, and read more super-exited pointless marketing at:
39
+ You can submit bug reports, suggestions, and read more super-excited pointless marketing at:
40
40
 
41
41
  http://deveiate.org/sysexits.html
42
42
 
data/Rakefile CHANGED
@@ -18,6 +18,7 @@ BEGIN {
18
18
  libdir = basedir + "lib"
19
19
  extdir = libdir + Config::CONFIG['sitearch']
20
20
 
21
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
21
22
  $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
22
23
  $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
23
24
  }
@@ -63,7 +64,7 @@ MANUALDIR = DOCSDIR + 'manual'
63
64
 
64
65
  PROJECT_NAME = 'sysexits'
65
66
  PKG_NAME = PROJECT_NAME.downcase
66
- PKG_SUMMARY = 'A Ruby front end to sysexits.h'
67
+ PKG_SUMMARY = 'Exit status codes for system programs.'
67
68
 
68
69
  # Cruisecontrol stuff
69
70
  CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
@@ -76,7 +77,7 @@ elsif VERSION_FILE.exist?
76
77
  PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
77
78
  end
78
79
 
79
- PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION )
80
+ PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
80
81
 
81
82
  PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
82
83
  GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
@@ -168,7 +169,7 @@ include RakefileHelpers
168
169
 
169
170
  # Set the build ID if the mercurial executable is available
170
171
  if hg = which( 'hg' )
171
- id = IO.read('|-') or exec hg.to_s, 'id', '-n'
172
+ id = `#{hg} id -n`.chomp
172
173
  PKG_BUILD = "pre%03d" % [(id.chomp[ /^[[:xdigit:]]+/ ] || '1')]
173
174
  else
174
175
  PKG_BUILD = 'pre000'
@@ -208,6 +209,8 @@ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
208
209
  PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
209
210
  PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
210
211
 
212
+ GEM_PUBHOST = 'rubygems.org'
213
+
211
214
  # Gem dependencies: gemname => version
212
215
  DEPENDENCIES = {
213
216
  }
@@ -224,7 +227,6 @@ DEVELOPMENT_DEPENDENCIES = {
224
227
  'text-format' => '>= 1.0.0',
225
228
  'tmail' => '>= 1.2.3.1',
226
229
  'diff-lcs' => '>= 1.1.2',
227
- 'rake-compiler' => '>=0',
228
230
  }
229
231
 
230
232
  # Non-gem requirements: packagename => version
@@ -238,13 +240,14 @@ GEMSPEC = Gem::Specification.new do |gem|
238
240
 
239
241
  gem.summary = PKG_SUMMARY
240
242
  gem.description = [
241
- "Have you ever wanted to call exit() with an error condition, but weren't sure what",
242
- "number to use? No? Maybe it's just me, then.",
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.",
243
245
  "",
244
- "Anyway, I was reading W. Richard Stephens's book _Advanced Programming in the UNIX Environment_, and",
245
- "I wanted to make my program exit with a reasonable exit code just like his C examples, but much",
246
- "to my chagrin, I couldn't find a 'sysexits' for Ruby! Well, for the other 2 people that actually",
247
- "care about this kind of thing, now there is!",
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!",
248
251
  ].join( "\n" )
249
252
  gem.post_install_message = [
250
253
  "Happy exiting!",
@@ -270,6 +273,10 @@ GEMSPEC = Gem::Specification.new do |gem|
270
273
  gem.files = RELEASE_FILES
271
274
  gem.test_files = SPEC_FILES
272
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
+
273
280
  DEPENDENCIES.each do |name, version|
274
281
  version = '>= 0' if version.length.zero?
275
282
  gem.add_runtime_dependency( name, version )
@@ -53,10 +53,10 @@
53
53
  module Sysexits
54
54
 
55
55
  # The library version
56
- VERSION = '1.0.0'
56
+ VERSION = '1.0.1'
57
57
 
58
58
  # The library's revision id
59
- REVISION = %q$Revision: d43f3935008a $
59
+ REVISION = %q$Revision: abfbf4b067bd $
60
60
 
61
61
 
62
62
  #
@@ -44,6 +44,7 @@ begin
44
44
  end
45
45
 
46
46
  class YARD::CLI::Base; include YardGlobals; end
47
+ class YARD::CLI::Command; include YardGlobals; end
47
48
  class YARD::Parser::SourceParser; extend YardGlobals; include YardGlobals; end
48
49
  class YARD::Parser::CParser; include YardGlobals; end
49
50
  class YARD::CodeObjects::Base; include YardGlobals; end
@@ -51,7 +52,41 @@ begin
51
52
  class YARD::Handlers::Processor; include YardGlobals; end
52
53
  class YARD::Serializers::Base; include YardGlobals; end
53
54
  class YARD::RegistryStore; include YardGlobals; end
55
+ class YARD::Docstring; include YardGlobals; end
54
56
  module YARD::Templates::Helpers::ModuleHelper; include YardGlobals; end
57
+ module YARD::Templates::Helpers::HtmlHelper; include YardGlobals; end
58
+
59
+ if vvec(RUBY_VERSION) >= vvec("1.9.1")
60
+ # Monkeypatched to allow more than two '#' characters at the beginning
61
+ # of the comment line.
62
+ # Patched from yard-0.5.8
63
+ require 'yard/parser/ruby/ruby_parser'
64
+ class YARD::Parser::Ruby::RipperParser < Ripper
65
+ def on_comment(comment)
66
+ visit_ns_token(:comment, comment)
67
+ case comment
68
+ when /\A# @group\s+(.+)\s*\Z/
69
+ @groups.unshift [lineno, $1]
70
+ return
71
+ when /\A# @endgroup\s*\Z/
72
+ @groups.unshift [lineno, nil]
73
+ return
74
+ end
75
+
76
+ comment = comment.gsub(/^\#+\s{0,1}/, '').chomp
77
+ append_comment = @comments[lineno - 1]
78
+
79
+ if append_comment && @comments_last_column == column
80
+ @comments.delete(lineno - 1)
81
+ comment = append_comment + "\n" + comment
82
+ end
83
+
84
+ @comments[lineno] = comment
85
+ @comments_last_column = column
86
+ end
87
+ end # class YARD::Parser::Ruby::RipperParser
88
+ end
89
+
55
90
  # </metamonkeypatch>
56
91
 
57
92
  YARD_OPTIONS = [] unless defined?( YARD_OPTIONS )
data/rake/hg.rb CHANGED
@@ -85,7 +85,7 @@ unless defined?( HG_DOTDIR )
85
85
 
86
86
  ### Return the list of files which are of status 'unknown'
87
87
  def get_unknown_files
88
- list = read_command_output( 'hg', 'status', '-un', '--no-color' )
88
+ list = read_command_output( 'hg', 'status', '-un', '--color', 'never' )
89
89
  list = list.split( /\n/ )
90
90
 
91
91
  trace "New files: %p" % [ list ]
@@ -215,13 +215,20 @@ unless defined?( HG_DOTDIR )
215
215
  paths = get_repo_paths()
216
216
  if origin_url = paths['default']
217
217
  ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
218
- run 'hg', 'pull', '-u'
218
+ Rake::Task['hg:pull_without_confirmation'].invoke
219
219
  end
220
220
  else
221
221
  trace "Skipping pull: No 'default' path."
222
222
  end
223
223
  end
224
224
 
225
+
226
+ desc "Pull and update without confirmation"
227
+ task :pull_without_confirmation do
228
+ run 'hg', 'pull', '-u'
229
+ end
230
+
231
+
225
232
  desc "Check the current code in if tests pass"
226
233
  task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
227
234
  targets = get_target_args()
@@ -242,13 +249,18 @@ unless defined?( HG_DOTDIR )
242
249
  paths = get_repo_paths()
243
250
  if origin_url = paths['default']
244
251
  ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
245
- run 'hg', 'push'
252
+ Rake::Task['hg:push_without_confirmation'].invoke
246
253
  end
247
254
  else
248
255
  trace "Skipping push: No 'default' path."
249
256
  end
250
257
  end
251
258
 
259
+ desc "Push to the default repo without confirmation"
260
+ task :push_without_confirmation do
261
+ run 'hg', 'push'
262
+ end
263
+
252
264
  end
253
265
 
254
266
  if HG_DOTDIR.exist?
@@ -147,9 +147,14 @@ module Manual
147
147
 
148
148
  layout = self.config['layout'].sub( /\.page$/, '' )
149
149
  templatepath = @layouts_dir + "#{layout}.page"
150
- template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
151
- page = self
150
+ template = nil
151
+ if Object.const_defined?( :Encoding )
152
+ template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
153
+ else
154
+ template = ERB.new( templatepath.read )
155
+ end
152
156
 
157
+ page = self
153
158
  html = template.result( binding() )
154
159
 
155
160
  # Use Tidy to clean up the html if 'cleanup' is turned on, but remove the Tidy
@@ -13,6 +13,7 @@ $publish_privately = false
13
13
 
14
14
  ### Add SSL to Net::SMTP
15
15
  class Net::SMTP
16
+
16
17
  def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
17
18
  if block_given?
18
19
  begin
@@ -93,6 +94,9 @@ begin
93
94
  require 'etc'
94
95
  require 'socket'
95
96
  require 'text/format'
97
+ require 'rubygems/gemcutter_utilities'
98
+
99
+ include Gem::GemcutterUtilities
96
100
 
97
101
  ### Generate a valid RFC822 message-id
98
102
  def gen_message_id
@@ -104,6 +108,48 @@ begin
104
108
  end
105
109
 
106
110
 
111
+ ### Fetch the rubygems API token if it hasn't been already.
112
+ def sign_in_to_rubygems
113
+ return if Gem.configuration.rubygems_api_key
114
+
115
+ log "Enter your RubyGems.org credentials."
116
+
117
+ email = prompt " Email: "
118
+ password = prompt_for_password( "Password: " )
119
+
120
+ response = rubygems_api_request( :get, "api/v1/api_key" ) do |request|
121
+ request.basic_auth( email, password )
122
+ end
123
+
124
+ with_response( response ) do |resp|
125
+ log "Signed in."
126
+ Gem.configuration.rubygems_api_key = resp.body
127
+ end
128
+ end
129
+
130
+
131
+ ### Push the gem at the specified +path+ to the rubygems server at +gemhost+.
132
+ def push_gem( path, gemhost )
133
+ ENV['RUBYGEMS_HOST'] = "http://#{gemhost}"
134
+
135
+ sign_in_to_rubygems()
136
+
137
+ response = rubygems_api_request( :post, "api/v1/gems" ) do |request|
138
+ request.body = Gem.read_binary( path )
139
+ request.add_field "Content-Length", request.body.size
140
+ request.add_field "Content-Type", "application/octet-stream"
141
+ request.add_field "Authorization", Gem.configuration.rubygems_api_key
142
+ end
143
+
144
+ case response
145
+ when Net::HTTPSuccess
146
+ log( response.body )
147
+ else
148
+ fail( response.body )
149
+ end
150
+ end
151
+
152
+
107
153
  namespace :release do
108
154
  task :default => [ :prep_release, :upload, :publish, :announce ]
109
155
 
@@ -133,124 +179,147 @@ begin
133
179
  end
134
180
  CLOBBER.include( RELEASE_NOTES_FILE )
135
181
 
136
-
137
- desc "Upload project documentation and packages to #{PROJECT_HOST}"
138
- task :upload => [ :upload_docs, :upload_packages ]
139
- task :project => :upload # the old name
140
-
141
- desc "Publish the project docs to #{PROJECT_HOST}"
142
- task :upload_docs => [ :apidocs ] do
143
- when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
144
- log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
145
- run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
146
- run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
182
+ # Only define upload tasks if there's an upload host
183
+ if PROJECT_HOST.empty?
184
+ task :no_upload_host do
185
+ log "Skipping upload: no upload host."
186
+ end
187
+ task :upload => :no_upload_host
188
+ task :upload_docs => :no_upload_host
189
+ task :upload_packages => :no_upload_host
190
+ else
191
+ desc "Upload project documentation and packages to #{PROJECT_HOST}"
192
+ task :upload => [ :upload_docs, :upload_packages ]
193
+ task :project => :upload # the old name
194
+
195
+ desc "Publish the project docs to #{PROJECT_HOST}"
196
+ task :upload_docs => [ :apidocs ] do
197
+ when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
198
+ log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
199
+ run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
200
+ run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
201
+ end
147
202
  end
148
- end
149
203
 
150
- desc "Publish the project packages to #{PROJECT_HOST}"
151
- task :upload_packages => [ :package ] do
152
- when_writing( "Uploading packages") do
153
- pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
154
- log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
155
- pkgs.each do |pkgfile|
156
- run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
157
- end
158
- end
204
+ desc "Publish the project packages to #{PROJECT_HOST}"
205
+ task :upload_packages => [ :package ] do
206
+ when_writing( "Uploading packages") do
207
+ pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
208
+ log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
209
+ pkgs.each do |pkgfile|
210
+ run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
211
+ end
212
+ end
213
+ end
159
214
  end
160
215
 
216
+ # Only define the announcement tasks if there are addresses to announce to
217
+ if RELEASE_ANNOUNCE_ADDRESSES.empty?
218
+ task :no_announce_addresses do
219
+ log "Skipping announcement: no announce addresses"
220
+ end
221
+ task :announce => :no_announce_addresses
161
222
 
162
- file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
163
- relnotes = File.read( RELEASE_NOTES_FILE )
164
- announce_body = %{
165
-
166
- Version #{PKG_VERSION} of #{PKG_NAME} has been released.
167
-
168
- #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
223
+ else
224
+ file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
225
+ relnotes = File.read( RELEASE_NOTES_FILE )
226
+ announce_body = %{
169
227
 
170
- == Project Page
228
+ Version #{PKG_VERSION} of #{PKG_NAME} has been released.
171
229
 
172
- #{GEMSPEC.homepage}
230
+ #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
173
231
 
174
- == Installation
232
+ == Project Page
175
233
 
176
- Via gems:
234
+ #{GEMSPEC.homepage}
177
235
 
178
- $ sudo gem install #{GEMSPEC.name}
236
+ == Installation
179
237
 
180
- or from source:
238
+ Via gems:
181
239
 
182
- $ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
183
- $ tar -xzvf #{PKG_FILE_NAME}.tar.gz
184
- $ cd #{PKG_FILE_NAME}
185
- $ sudo rake install
240
+ $ sudo gem install #{GEMSPEC.name}
186
241
 
187
- == Changes
188
- #{relnotes}
189
- }.gsub( /^\t+/, '' )
242
+ or from source:
190
243
 
191
- File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
192
- fh.print( announce_body )
193
- end
244
+ $ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
245
+ $ tar -xzvf #{PKG_FILE_NAME}.tar.gz
246
+ $ cd #{PKG_FILE_NAME}
247
+ $ sudo rake install
194
248
 
195
- edit task.name
196
- end
197
- CLOBBER.include( RELEASE_ANNOUNCE_FILE )
249
+ == Changes
250
+ #{relnotes}
251
+ }.gsub( /^\t+/, '' )
198
252
 
253
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
254
+ fh.print( announce_body )
255
+ end
199
256
 
200
- desc 'Send out a release announcement'
201
- task :announce => [RELEASE_ANNOUNCE_FILE] do
202
- email = TMail::Mail.new
203
-
204
- if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
205
- trace "Sending private announce mail"
206
- email.to = 'rubymage@gmail.com'
207
- else
208
- trace "Sending public announce mail"
209
- email.to = RELEASE_ANNOUNCE_ADDRESSES
210
- email.bcc = 'rubymage@gmail.com'
257
+ edit task.name
211
258
  end
259
+ CLOBBER.include( RELEASE_ANNOUNCE_FILE )
212
260
 
213
- from = prompt_with_default( "Send announcement as:",
214
- 'Michael Granger <ged@FaerieMUD.org>' ) or fail
215
-
216
- email.from = from
217
- email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
218
- email.body = File.read( RELEASE_ANNOUNCE_FILE )
219
- email.date = Time.new
220
-
221
- email.message_id = gen_message_id()
222
-
223
- log "About to send the following email:"
224
- puts '---',
225
- email.to_s,
226
- '---'
227
261
 
228
- ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
229
- pwent = Etc.getpwuid( Process.euid )
230
- curuser = pwent ? pwent.name : 'unknown'
231
- username = prompt_with_default( "SMTP user", curuser )
232
- password = prompt_for_password()
262
+ desc 'Send out a release announcement'
263
+ task :announce => [RELEASE_ANNOUNCE_FILE] do
264
+ email = TMail::Mail.new
233
265
 
234
- trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
235
- smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
236
- smtp.set_debug_output( $stdout )
237
- smtp.esmtp = true
266
+ if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
267
+ trace "Sending private announce mail"
268
+ email.to = 'rubymage@gmail.com'
269
+ else
270
+ trace "Sending public announce mail"
271
+ email.to = RELEASE_ANNOUNCE_ADDRESSES
272
+ email.bcc = 'rubymage@gmail.com'
273
+ end
238
274
 
239
- trace "connecting..."
240
- smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
241
- trace "sending message..."
242
- smtp.send_message( email.to_s, email.from, email.to )
275
+ from = prompt_with_default( "Send announcement as:",
276
+ 'Michael Granger <ged@FaerieMUD.org>' ) or fail
277
+
278
+ email.from = from
279
+ email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
280
+ email.body = File.read( RELEASE_ANNOUNCE_FILE )
281
+ email.date = Time.new
282
+
283
+ email.message_id = gen_message_id()
284
+
285
+ log "About to send the following email:"
286
+ puts '---',
287
+ email.to_s,
288
+ '---'
289
+
290
+ ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
291
+ pwent = Etc.getpwuid( Process.euid )
292
+ curuser = pwent ? pwent.name : 'unknown'
293
+ username = prompt_with_default( "SMTP user", curuser )
294
+ password = prompt_for_password()
295
+
296
+ trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
297
+ smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
298
+ smtp.set_debug_output( $stdout )
299
+ smtp.esmtp = true
300
+
301
+ trace "connecting..."
302
+ smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
303
+ trace "sending message..."
304
+ smtp.send_message( email.to_s, email.from, email.to )
305
+ end
306
+ trace "done."
243
307
  end
244
- trace "done."
245
308
  end
246
309
  end
247
310
 
248
-
249
- desc 'Publish the new release to Gemcutter'
250
- task :publish => [:clean, :gem, :notes] do |task|
251
- ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
252
- gempath = PKGDIR + GEM_FILE_NAME
253
- sh 'gem', 'push', gempath
311
+ if GEM_PUBHOST.empty?
312
+ task :no_gem_host do
313
+ log "Skipping gem push: no gem publication host."
314
+ end
315
+ task :publish => :no_gem_host
316
+ else
317
+ desc 'Publish the new gem to #{GEM_PUBHOST}'
318
+ task :publish => [:clean, :gem, :notes] do |task|
319
+ ask_for_confirmation( "Publish #{GEM_FILE_NAME} to #{GEM_PUBHOST}?", false ) do
320
+ gempath = PKGDIR + GEM_FILE_NAME
321
+ push_gem( gempath, GEM_PUBHOST )
322
+ end
254
323
  end
255
324
  end
256
325
  end
@@ -266,6 +335,7 @@ rescue LoadError => err
266
335
  end
267
336
 
268
337
  task :release => :no_release_tasks
338
+ task "release:rerelease" => :no_release_tasks
269
339
  task "release:announce" => :no_release_tasks
270
340
  task "release:publish" => :no_release_tasks
271
341
  task "release:notes" => :no_release_tasks
@@ -16,7 +16,7 @@ end
16
16
  SPEC_FILES = [] unless defined?( SPEC_FILES )
17
17
  TEST_FILES = [] unless defined?( TEST_FILES )
18
18
 
19
- COMMON_SPEC_OPTS = ['-Du'] unless defined?( COMMON_SPEC_OPTS )
19
+ COMMON_RSPEC_OPTS = [] unless defined?( COMMON_RSPEC_OPTS )
20
20
 
21
21
  COVERAGE_TARGETDIR = BASEDIR + 'coverage' unless defined?( COVERAGE_TARGETDIR )
22
22
  RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib' unless
@@ -39,10 +39,10 @@ end
39
39
 
40
40
  ### RSpec specifications
41
41
  begin
42
- gem 'rspec', '>= 1.1.3'
42
+ gem 'rspec', '>= 2.0.0'
43
43
 
44
- require 'spec'
45
- require 'spec/rake/spectask'
44
+ require 'rspec'
45
+ require 'rspec/core/rake_task'
46
46
 
47
47
  ### Task: spec
48
48
  desc "Run specs"
@@ -51,137 +51,101 @@ begin
51
51
  namespace :spec do
52
52
  desc "Run rspec every time there's a change to one of the files"
53
53
  task :autotest do
54
- require 'autotest/rspec'
55
-
56
- autotester = Autotest::Rspec.new
57
- autotester.run
54
+ require 'autotest'
55
+ Autotest.add_discovery { "rspec2" }
56
+ Autotest.run
58
57
  end
59
58
 
60
59
  desc "Generate regular color 'doc' spec output"
61
- Spec::Rake::SpecTask.new( :doc ) do |task|
62
- task.spec_files = SPEC_FILES
63
- task.spec_opts = COMMON_SPEC_OPTS + ['-f', 's', '-c']
60
+ RSpec::Core::RakeTask.new( :doc ) do |task|
61
+ task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p', '-c']
64
62
  end
65
63
 
66
64
  desc "Generate spec output with profiling"
67
- Spec::Rake::SpecTask.new( :profile ) do |task|
68
- task.spec_files = SPEC_FILES
69
- task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'o']
65
+ RSpec::Core::RakeTask.new( :profile ) do |task|
66
+ task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p', '-p']
70
67
  end
71
68
 
72
69
  desc "Generate quiet non-colored plain-text output"
73
- Spec::Rake::SpecTask.new( :quiet ) do |task|
74
- task.spec_files = SPEC_FILES
75
- task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'p']
70
+ RSpec::Core::RakeTask.new( :quiet ) do |task|
71
+ task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p']
76
72
  end
77
73
 
78
74
  desc "Generate HTML output"
79
- Spec::Rake::SpecTask.new( :html ) do |task|
80
- task.spec_files = SPEC_FILES
81
- task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'h']
75
+ RSpec::Core::RakeTask.new( :html ) do |task|
76
+ task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'h']
82
77
  end
83
78
 
84
- end
85
- rescue LoadError => err
86
- task :no_rspec do
87
- $stderr.puts "Specification tasks not defined: %s" % [ err.message ]
88
- end
89
-
90
- task :spec => :no_rspec
91
- namespace :spec do
92
- task :autotest => :no_rspec
93
- task :doc => :no_rspec
94
- task :profile => :no_rspec
95
- task :quiet => :no_rspec
96
- task :html => :no_rspec
97
- end
98
- end
99
-
100
-
101
- ### Test::Unit tests
102
- begin
103
- require 'rake/testtask'
104
-
105
- Rake::TestTask.new( :unittests ) do |task|
106
- task.libs += [LIBDIR]
107
- task.test_files = TEST_FILES
108
- task.verbose = true
109
- end
110
79
 
111
- rescue LoadError => err
112
- task :no_test do
113
- $stderr.puts "Test tasks not defined: %s" % [ err.message ]
114
80
  end
115
81
 
116
- task :unittests => :no_rspec
117
- end
118
-
119
-
120
- ### RCov (via RSpec) tasks
121
- begin
122
- gem 'rcov'
123
- gem 'rspec', '>= 1.1.3'
124
-
125
- require 'spec'
126
- require 'rcov'
127
-
128
82
  ### Task: coverage (via RCov)
129
83
  desc "Build test coverage reports"
130
- unless SPEC_FILES.empty?
131
- Spec::Rake::SpecTask.new( :coverage ) do |task|
132
- task.spec_files = SPEC_FILES
133
- task.libs += [LIBDIR]
134
- task.spec_opts = ['-f', 'p', '-b']
135
- task.rcov_opts = RCOV_OPTS
136
- task.rcov = true
137
- end
84
+ RSpec::Core::RakeTask.new( :coverage ) do |task|
85
+ task.ruby_opts = [ "-I#{LIBDIR}" ]
86
+ task.rspec_opts = ['-f', 'p', '-b']
87
+ task.rcov_opts = RCOV_OPTS
88
+ task.rcov = true
138
89
  end
139
90
 
140
-
141
91
  ### Task: rcov
142
92
  task :rcov => :coverage
143
93
 
144
94
  ### Other coverage tasks
145
95
  namespace :coverage do
146
96
  desc "Generate a detailed text coverage report"
147
- Spec::Rake::SpecTask.new( :text ) do |task|
148
- task.spec_files = SPEC_FILES
97
+ RSpec::Core::RakeTask.new( :text ) do |task|
149
98
  task.rcov_opts = RCOV_OPTS + ['--text-report']
150
99
  task.rcov = true
151
100
  end
152
101
 
153
102
  desc "Show differences in coverage from last run"
154
- Spec::Rake::SpecTask.new( :diff ) do |task|
155
- task.spec_files = SPEC_FILES
156
- task.spec_opts = ['-f', 'p', '-b']
103
+ RSpec::Core::RakeTask.new( :diff ) do |task|
104
+ task.rspec_opts = ['-f', 'p', '-b']
157
105
  task.rcov_opts = RCOV_OPTS - ['--save'] + ['--text-coverage-diff']
158
106
  task.rcov = true
159
107
  end
160
108
 
161
109
  desc "Run RCov in 'spec-only' mode to check coverage from specs"
162
- Spec::Rake::SpecTask.new( :speconly ) do |task|
163
- task.spec_files = SPEC_FILES
110
+ RSpec::Core::RakeTask.new( :speconly ) do |task|
164
111
  task.rcov_opts = ['--exclude', RCOV_EXCLUDES, '--text-report', '--save']
165
112
  task.rcov = true
166
113
  end
167
114
  end
168
115
 
169
116
  CLOBBER.include( COVERAGE_TARGETDIR )
170
-
171
117
  rescue LoadError => err
172
- task :no_rcov do
173
- $stderr.puts "Coverage tasks not defined: RSpec+RCov tasklib not available: %s" %
174
- [ err.message ]
118
+ task :no_rspec do
119
+ $stderr.puts "Specification tasks not defined: %s" % [ err.message ]
175
120
  end
176
121
 
177
- task :coverage => :no_rcov
178
- task :clobber_coverage
179
- task :rcov => :no_rcov
180
- namespace :coverage do
181
- task :text => :no_rcov
182
- task :diff => :no_rcov
122
+ task :spec => :no_rspec
123
+ namespace :spec do
124
+ task :autotest => :no_rspec
125
+ task :doc => :no_rspec
126
+ task :profile => :no_rspec
127
+ task :quiet => :no_rspec
128
+ task :html => :no_rspec
183
129
  end
184
- task :verify => :no_rcov
130
+ end
131
+
132
+
133
+ ### Test::Unit tests
134
+ begin
135
+ require 'rake/testtask'
136
+
137
+ Rake::TestTask.new( :unittests ) do |task|
138
+ task.libs += [LIBDIR]
139
+ task.test_files = TEST_FILES
140
+ task.verbose = true
141
+ end
142
+
143
+ rescue LoadError => err
144
+ task :no_test do
145
+ $stderr.puts "Test tasks not defined: %s" % [ err.message ]
146
+ end
147
+
148
+ task :unittests => :no_rspec
185
149
  end
186
150
 
187
151
 
metadata CHANGED
@@ -1,32 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sysexits
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Granger
14
14
  autorequire:
15
15
  bindir: bin
16
- cert_chain: []
16
+ cert_chain:
17
+ - |
18
+ -----BEGIN CERTIFICATE-----
19
+ MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
20
+ FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
21
+ DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
22
+ FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
23
+ DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
24
+ h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
25
+ vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
26
+ KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
27
+ BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
28
+ TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
29
+ AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
30
+ +saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
31
+ vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
32
+ HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
33
+ aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
34
+ U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
35
+ cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
36
+ -----END CERTIFICATE-----
17
37
 
18
- date: 2010-06-19 00:00:00 -07:00
38
+ date: 2010-10-14 00:00:00 -07:00
19
39
  default_executable:
20
40
  dependencies: []
21
41
 
22
42
  description: |-
23
- Have you ever wanted to call exit() with an error condition, but weren't sure what
24
- number to use? No? Maybe it's just me, then.
43
+ Have you ever wanted to call exit() with an error condition, but
44
+ weren't sure what exit status to use? No? Maybe it's just me, then.
25
45
 
26
- Anyway, I was reading W. Richard Stephens's book _Advanced Programming in the UNIX Environment_, and
27
- I wanted to make my program exit with a reasonable exit code just like his C examples, but much
28
- to my chagrin, I couldn't find a 'sysexits' for Ruby! Well, for the other 2 people that actually
29
- care about this kind of thing, now there is!
46
+ Anyway, I was reading manpages late one evening before retiring to
47
+ bed in my palatial estate in rural Oregon, and I stumbled across
48
+ sysexits(3). Much to my chagrin, I couldn't find a 'sysexits' for
49
+ Ruby! Well, for the other 2 people that actually care about style(9)
50
+ as it applies to Ruby code, now there is one!
30
51
  email:
31
52
  - ged@FaerieMUD.org
32
53
  executables: []
@@ -94,6 +115,6 @@ rubyforge_project:
94
115
  rubygems_version: 1.3.7
95
116
  signing_key:
96
117
  specification_version: 3
97
- summary: A Ruby front end to sysexits.h
118
+ summary: Exit status codes for system programs.
98
119
  test_files:
99
120
  - spec/sysexits_spec.rb
Binary file