echoe 1.3 → 1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG +3 -2
  2. data/lib/echoe.rb +26 -96
  3. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
+ 1.4. auto-detect readme file; make rdoc default pattern compatible with manifest generator; fix publish_docs task; use env var for rdoc template if available
2
3
  1.3. avoid rubyforge gem multi-activation conflict
3
4
  1.2. build_manifest Rake task
4
- 1.1. Sane error messages on releasing new or duplicate gems; allow Manifest to not end in .txt
5
- 1.0.0. Fork from Hoe
5
+ 1.1. sane error messages on releasing new or duplicate gems; allow Manifest to not end in .txt
6
+ 1.0.0. fork from Hoe
6
7
 
@@ -62,12 +62,12 @@ require 'rbconfig'
62
62
  # * name - The name of the release.
63
63
  # * version - The version. Don't hardcode! use a constant in the project.
64
64
  #
65
- # ==== Damn Good to Set
65
+ # ==== Good to Set
66
66
  #
67
- # * author - The author of the package. (can be array of authors)
67
+ # * author - The author of the package.
68
68
  # * changes - A description of the release's latest changes.
69
69
  # * description - A description of the project.
70
- # * email - The author's email address. (can be array of urls)
70
+ # * email - The author's email address.
71
71
  # * summary - A short summary of the project.
72
72
  # * url - The url of the project.
73
73
  #
@@ -78,6 +78,7 @@ require 'rbconfig'
78
78
  # * need_tar - Should package create a tarball? [default: true]
79
79
  # * need_zip - Should package create a zipfile? [default: false]
80
80
  # * rdoc_pattern - A regexp to match documentation files against the manifest.
81
+ # * rdoc_template - Path to an external rdoc template file
81
82
  # * rubyforge_name - The name of the rubyforge project. [default: name.downcase]
82
83
  # * spec_extras - A hash of extra values to set in the gemspec.
83
84
  # * test_globs - An array of test file patterns [default: test/**/test_*.rb]
@@ -105,7 +106,7 @@ class Echoe
105
106
  "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" +
106
107
  (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
107
108
  FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
108
- attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :need_tar, :need_tar_gz, :need_zip, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version, :tar_extension #, :tar_separator, :zip_separator
109
+ attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :need_tar, :need_tar_gz, :need_zip, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version, :tar_extension, :rdoc_template #, :tar_separator, :zip_separator
109
110
 
110
111
  def initialize(name, version)
111
112
  self.name = name
@@ -121,7 +122,7 @@ class Echoe
121
122
  self.changes = ""
122
123
  self.description = ""
123
124
  self.summary = ""
124
- self.rdoc_pattern = /^(lib|bin)|txt$/
125
+ self.rdoc_pattern = /^(\.\/|)(lib|bin|tasks)|README|CHANGELOG|LICENSE|txt$/
125
126
  self.extra_deps = []
126
127
  self.spec_extras = {}
127
128
  self.need_tar = true
@@ -167,12 +168,7 @@ class Echoe
167
168
  s.name = name
168
169
  s.version = version
169
170
  s.summary = summary
170
- case author
171
- when Array
172
- s.authors = author
173
- else
174
- s.author = author
175
- end
171
+ s.author = Array(author).join(", ")
176
172
  s.email = email
177
173
  s.homepage = Array(url).first
178
174
  s.rubyforge_project = rubyforge_name
@@ -183,8 +179,7 @@ class Echoe
183
179
  s.add_dependency(*dep)
184
180
  end
185
181
 
186
- manifest = "Manifest"
187
- manifest += ".txt" if File.exist? "Manifest.txt"
182
+ manifest = File.exist?('Manifest.txt') ? 'Manifest.txt' : 'Manifest'
188
183
  begin
189
184
  s.files = File.read(manifest).split
190
185
  rescue Errno::ENOENT
@@ -197,7 +192,7 @@ class Echoe
197
192
  s.require_paths = dirs unless dirs.empty?
198
193
  s.has_rdoc = true
199
194
 
200
- if test ?f, "test/test_all.rb" then
195
+ if File.exist? "test/test_all.rb"
201
196
  s.test_file = "test/test_all.rb"
202
197
  else
203
198
  s.test_files = Dir[*test_globs]
@@ -229,21 +224,8 @@ class Echoe
229
224
  pkg.need_zip = @need_zip
230
225
  end
231
226
 
232
- desc 'Install the package. Uses PREFIX and RUBYLIB'
233
- task :install do
234
- [
235
- [lib_files + test_files, RUBYLIB, 0444],
236
- [bin_files, File.join(PREFIX, 'bin'), 0555]
237
- ].each do |files, dest, mode|
238
- FileUtils.mkdir_p dest unless test ?d, dest
239
- files.each do |file|
240
- install file, dest, :mode => mode
241
- end
242
- end
243
- end
244
-
245
227
  desc 'Install the package as a gem'
246
- task :install_gem => [:clean, :package] do
228
+ task :install => [:clean, :package] do
247
229
  sh "sudo gem install pkg/*.gem"
248
230
  end
249
231
 
@@ -259,7 +241,7 @@ class Echoe
259
241
 
260
242
  desc 'Package and upload the release to rubyforge.'
261
243
  task :release => [:clean, :package] do |t|
262
- v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
244
+ v = ENV["VERSION"] or abort "Must supply VERSION=x"
263
245
  abort "Versions don't match #{v} vs #{version}" if v != version
264
246
 
265
247
  gem 'rubyforge', '>= 0.4.0'
@@ -283,7 +265,7 @@ class Echoe
283
265
  c = rf.userconfig
284
266
  c["release_notes"] = description if description
285
267
  c["release_changes"] = changes if changes
286
- c["preformatted"] = true
268
+ c["preformatted"] = false
287
269
 
288
270
  files = [(@need_tar ? pkg_tar : nil),
289
271
  (@need_tar_gz ? pkg_tar_gz : nil),
@@ -303,17 +285,22 @@ class Echoe
303
285
  ############################################################
304
286
  # Doco
305
287
 
306
- Rake::RDocTask.new(:docs) do |rd|
307
- rd.main = "README.txt"
288
+ Rake::RDocTask.new(:docs) do |rd|
289
+ rd.main = Dir['*'].detect {|f| f =~ /^readme/i}
308
290
  rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/
291
+ rd.options << '--line-numbers' << '--inline-source'
309
292
  rd.rdoc_dir = 'doc'
310
293
  files = spec.files.grep(rdoc_pattern)
311
294
  files -= ['Manifest.txt', 'Manifest']
312
- rd.rdoc_files.push(*files)
295
+ rd.rdoc_files.push *files
313
296
 
314
- title = "#{name}-#{version} Documentation"
315
- title = "#{rubyforge_name}'s " + title if rubyforge_name != title
297
+ if rdoc_template
298
+ rd.template = rdoc_template
299
+ elsif ENV['RDOC_TEMPLATE'] and File.exist? ENV['RDOC_TEMPLATE']
300
+ rd.template = ENV['RDOC_TEMPLATE']
301
+ end
316
302
 
303
+ title = name.capitalize if name.downcase == name
317
304
  rd.options << "-t #{title}"
318
305
  end
319
306
 
@@ -324,7 +311,7 @@ class Echoe
324
311
 
325
312
  desc 'Publish RDoc to RubyForge'
326
313
  task :publish_docs => [:clean, :docs] do
327
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/config.yml")))
314
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
328
315
  user = "#{config["username"]}@rubyforge.org"
329
316
  project = "/var/www/gforge-projects/#{rubyforge_name}"
330
317
  project += "/#{name}" if rubyforge_name != name
@@ -342,16 +329,12 @@ class Echoe
342
329
  end
343
330
  pub.upload
344
331
  end
332
+
333
+ task :doc => [:docs]
345
334
 
346
335
  ############################################################
347
336
  # Misc/Maintenance:
348
-
349
- desc 'Run ZenTest against the package'
350
- task :audit do
351
- libs = %w(lib test).join(File::PATH_SEPARATOR)
352
- sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
353
- end
354
-
337
+
355
338
  desc 'Clean up all the extras'
356
339
  task :clean => [ :clobber_docs, :clobber_package ] do
357
340
  clean_globs.each do |pattern|
@@ -360,39 +343,6 @@ class Echoe
360
343
  end
361
344
  end
362
345
 
363
- desc 'Generate email announcement file.'
364
- task :email do
365
- require 'rubyforge'
366
- subject, title, body, urls = announcement
367
-
368
- File.open("email.txt", "w") do |mail|
369
- mail.puts "Subject: [ANN] #{subject}"
370
- mail.puts
371
- mail.puts title
372
- mail.puts
373
- mail.puts urls
374
- mail.puts
375
- mail.puts body
376
- mail.puts
377
- mail.puts urls
378
- end
379
- puts "Created email.txt"
380
- end
381
-
382
- desc 'Post announcement to rubyforge.'
383
- task :post_news do
384
- require 'rubyforge'
385
- subject, title, body, urls = announcement
386
-
387
- rf = RubyForge.new
388
- rf.login
389
- rf.post_news(rubyforge_name, subject, "#{title}\n\n#{body}")
390
- puts "Posted to rubyforge"
391
- end
392
-
393
- desc 'Generate email announcement file and post to rubyforge.'
394
- task :announce => [:email, :post_news]
395
-
396
346
  desc "Verify the manifest"
397
347
  task :check_manifest => :clean do
398
348
  f = "Manifest.tmp"
@@ -429,16 +379,6 @@ class Echoe
429
379
  end
430
380
  end # end define
431
381
 
432
- def announcement
433
- urls = " " + Array(url).map {|s| s.strip}.join("\n ")
434
-
435
- subject = "#{name} #{version} Released"
436
- title = "#{name} version #{version} has been released!"
437
- body = "#{description}\n\nChanges:\n\n#{changes}"
438
-
439
- return subject, title, body, urls
440
- end
441
-
442
382
  def run_tests(multi=false) # :nodoc:
443
383
  msg = multi ? :sh : :ruby
444
384
  cmd = if test ?f, 'test/test_all.rb' then
@@ -452,16 +392,6 @@ class Echoe
452
392
  send msg, cmd
453
393
  end
454
394
 
455
- ##
456
- # Reads a file at +path+ and spits out an array of the +paragraphs+ specified
457
- #
458
- # changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
459
- # summary, *description = p.paragraphs_of('Readme.txt', 3, 3..8)
460
-
461
- def paragraphs_of(path, *paragraphs)
462
- file = File.read(path)
463
- file.split(/\n\n+/).values_at(*paragraphs)
464
- end
465
395
  end
466
396
 
467
397
  class ::Rake::SshDirPublisher # :nodoc:
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: echoe
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.3"
7
- date: 2007-05-12 00:00:00 -04:00
6
+ version: "1.4"
7
+ date: 2007-08-02 00:00:00 -04:00
8
8
  summary: Echoe is a simple packaging tool for working with rubygems.
9
9
  require_paths:
10
10
  - lib