jbarnette-backpack-journal 1.0.0 → 1.0.1

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.
@@ -1,3 +1,7 @@
1
+ === 1.0.1 / 2008-05-23
2
+
3
+ * Dependency, gem, and README fixes.
4
+
1
5
  === 1.0.0 / 2008-05-22
2
6
 
3
7
  * 1 major enhancement
@@ -1,8 +1,9 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
1
+ CHANGELOG
2
+ MANIFEST
3
+ README.rdoc
4
4
  Rakefile
5
5
  backpack-journal.gemspec
6
6
  bin/backpack-journal
7
7
  lib/backpack-journal/version.rb
8
+ lib/hoe.rb
8
9
  test/test_backpack-journal.rb
@@ -6,16 +6,18 @@
6
6
 
7
7
  Make journal and status entries in 37signals' Backpack.
8
8
 
9
-
10
9
  == FEATURES/PROBLEMS:
11
10
 
12
11
  * This is lunchcode. Tread lightly.
13
12
 
14
13
  == SYNOPSIS:
15
14
 
16
- # NOTE: I usually alias to 'bpj'
17
- backpack-journal setup <user-id> <user-token>
15
+ # user-id is your NUMERIC user ID. Check your URL, e.g.,
16
+ # http://something.backpackit.com/users/31415926/edit
17
+
18
+ backpack-journal setup <user-id> <api-token>
18
19
 
20
+ # I've aliased 'bpj', 'cause I'm lazy.
19
21
  backpack-journal status "Messing with backpack-journal!"
20
22
 
21
23
  backpack-journal entry "Got my daily dose of awesome."
data/Rakefile CHANGED
@@ -1,9 +1,11 @@
1
- require "rubygems"
2
- require "hoe"
3
-
1
+ require "./lib/hoe.rb"
4
2
  require "./lib/backpack-journal/version.rb"
5
3
 
6
4
  Hoe.new("backpack-journal", BackpackJournal::VERSION) do |p|
7
5
  p.developer("John Barnette", "jbarnette@rubyforge.org")
8
- p.extra_deps << ["thor", ">= 0.9.2"]
6
+ p.extra_deps << ["wycats-thor", ">= 0.9.2"]
7
+ end
8
+
9
+ task :gemspec do
10
+
9
11
  end
@@ -1,27 +1,25 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{backpack-journal}
3
- s.version = "1.0.0"
3
+ s.version = "1.0.1"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Barnette"]
9
- s.date = %q{2008-05-22}
9
+ s.date = %q{2008-05-23}
10
10
  s.default_executable = %q{backpack-journal}
11
11
  s.description = %q{Make journal and status entries in 37signals' Backpack.}
12
12
  s.email = ["jbarnette@rubyforge.org"]
13
13
  s.executables = ["backpack-journal"]
14
- s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
15
- s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "backpack-journal.gemspec", "bin/backpack-journal", "lib/backpack-journal/version.rb", "test/test_backpack-journal.rb"]
14
+ s.files = ["CHANGELOG", "MANIFEST", "README.rdoc", "Rakefile", "backpack-journal.gemspec", "bin/backpack-journal", "lib/backpack-journal/version.rb", "lib/hoe.rb", "test/test_backpack-journal.rb"]
16
15
  s.has_rdoc = true
17
16
  s.homepage = %q{http://github.com/jbarnette/backpack-journal}
18
- s.rdoc_options = ["--main", "README.txt"]
17
+ s.rdoc_options = ["--main", "README.rdoc"]
19
18
  s.require_paths = ["lib"]
20
19
  s.rubyforge_project = %q{backpack-journal}
21
20
  s.rubygems_version = %q{1.1.1}
22
21
  s.summary = %q{Make journal and status entries in 37signals' Backpack.}
23
22
  s.test_files = ["test/test_backpack-journal.rb"]
24
23
 
25
- s.add_dependency(%q<thor>, [">= 0.9.2"])
26
- s.add_dependency(%q<hoe>, [">= 1.5.3"])
24
+ s.add_dependency(%q<wycats-thor>, [">= 0.9.2"])
27
25
  end
@@ -1,3 +1,3 @@
1
1
  module BackpackJournal
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.0.1".freeze
3
3
  end
data/lib/hoe.rb ADDED
@@ -0,0 +1,832 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/gempackagetask'
6
+ require 'rake/rdoctask'
7
+ require 'rake/testtask'
8
+ require 'rbconfig'
9
+ require 'rubyforge'
10
+ require 'yaml'
11
+
12
+ ##
13
+ # hoe - a tool to help rake
14
+ #
15
+ # Hoe is a simple rake/rubygems helper for project Rakefiles. It
16
+ # generates all the usual tasks for projects including rdoc generation,
17
+ # testing, packaging, and deployment.
18
+ #
19
+ # == Using Hoe
20
+ #
21
+ # === Basics
22
+ #
23
+ # Use this as a minimal starting point:
24
+ #
25
+ # require 'hoe'
26
+ #
27
+ # Hoe.new("project_name", '1.0.0') do |p|
28
+ # p.rubyforge_name = "rf_project"
29
+ # # add other details here
30
+ # end
31
+ #
32
+ # # add other tasks here
33
+ #
34
+ # === Tasks Provided:
35
+ #
36
+ # announce:: Create news email file and post to rubyforge.
37
+ # audit:: Run ZenTest against the package.
38
+ # check_manifest:: Verify the manifest.
39
+ # clean:: Clean up all the extras.
40
+ # config_hoe:: Create a fresh ~/.hoerc file.
41
+ # debug_gem:: Show information about the gem.
42
+ # default:: Run the default tasks.
43
+ # docs:: Build the docs HTML Files
44
+ # email:: Generate email announcement file.
45
+ # gem:: Build the gem file hoe-1.5.0.gem
46
+ # generate_key:: Generate a key for signing your gems.
47
+ # install_gem:: Install the package as a gem.
48
+ # multi:: Run the test suite using multiruby.
49
+ # package:: Build all the packages
50
+ # post_blog:: Post announcement to blog.
51
+ # post_news:: Post announcement to rubyforge.
52
+ # publish_docs:: Publish RDoc to RubyForge.
53
+ # release:: Package and upload the release to rubyforge.
54
+ # ridocs:: Generate ri locally for testing.
55
+ # test:: Run the test suite.
56
+ # test_deps:: Show which test files fail when run alone.
57
+ #
58
+ # === Extra Configuration Options:
59
+ #
60
+ # Run +config_hoe+ to generate a new ~/.hoerc file. The file is a
61
+ # YAML formatted config file with the following settings:
62
+ #
63
+ # exclude:: A regular expression of files to exclude from
64
+ # +check_manifest+.
65
+ # publish_on_announce:: Run +publish_docs+ when you run +release+.
66
+ # signing_key_file:: Signs your gems with this private key.
67
+ # signing_cert_file:: Signs your gem with this certificate.
68
+ # blogs:: An array of hashes of blog settings.
69
+ #
70
+ # Run +config_hoe+ and see ~/.hoerc for examples.
71
+ #
72
+ # === Signing Gems:
73
+ #
74
+ # Run the 'generate_key' task. This will:
75
+ #
76
+ # 1. Configure your ~/.hoerc.
77
+ # 2. Generate a signing key and certificate.
78
+ # 3. Install the private key and public certificate files into ~/.gem.
79
+ # 4. Upload the certificate to RubyForge.
80
+ #
81
+ # Hoe will now generate signed gems when the package task is run. If you have
82
+ # multiple machines you build gems on, be sure to install your key and
83
+ # certificate on each machine.
84
+ #
85
+ # Keep your private key secret! Keep your private key safe!
86
+ #
87
+ # To make sure your gems are signed run:
88
+ #
89
+ # rake package; tar tf pkg/yourproject-1.2.3.gem
90
+ #
91
+ # If your gem is signed you will see:
92
+ #
93
+ # data.tar.gz
94
+ # data.tar.gz.sig
95
+ # metadata.gz
96
+ # metadata.gz.sig
97
+ #
98
+ # === Platform awareness
99
+ #
100
+ # Hoe allows bundling of pre-compiled extensions in the +package+ task.
101
+ #
102
+ # To create a package for your current platform:
103
+ #
104
+ # rake package INLINE=1
105
+ #
106
+ # This will force Hoe analize your +Inline+ already compiled
107
+ # extensions and include them in your gem.
108
+ #
109
+ # If somehow you need to force a specific platform:
110
+ #
111
+ # rake package INLINE=1 FORCE_PLATFORM=mswin32
112
+ #
113
+ # This will set the +Gem::Specification+ platform to the one indicated in
114
+ # +FORCE_PLATFORM+ (instead of default Gem::Platform::CURRENT)
115
+ #
116
+
117
+ class Hoe
118
+ VERSION = '1.5.3'
119
+
120
+ ruby_prefix = Config::CONFIG['prefix']
121
+ sitelibdir = Config::CONFIG['sitelibdir']
122
+
123
+ ##
124
+ # Used to specify a custom install location (for rake install).
125
+
126
+ PREFIX = ENV['PREFIX'] || ruby_prefix
127
+
128
+ ##
129
+ # Used to add extra flags to RUBY_FLAGS.
130
+
131
+ RUBY_DEBUG = ENV['RUBY_DEBUG']
132
+
133
+ default_ruby_flags = "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" +
134
+ (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
135
+
136
+ ##
137
+ # Used to specify flags to ruby [has smart default].
138
+
139
+ RUBY_FLAGS = ENV['RUBY_FLAGS'] || default_ruby_flags
140
+
141
+ ##
142
+ # Used to add flags to test_unit (e.g., -n test_borked).
143
+
144
+ FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
145
+
146
+ # :stopdoc:
147
+
148
+ RUBYLIB = if PREFIX == ruby_prefix then
149
+ sitelibdir
150
+ else
151
+ File.join(PREFIX, sitelibdir[ruby_prefix.size..-1])
152
+ end
153
+
154
+ DLEXT = Config::CONFIG['DLEXT']
155
+
156
+ WINDOZE = /djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WINDOZE
157
+
158
+ DIFF = if WINDOZE
159
+ 'diff.exe'
160
+ else
161
+ if system("gdiff", __FILE__, __FILE__)
162
+ 'gdiff' # solaris and kin suck
163
+ else
164
+ 'diff'
165
+ end
166
+ end unless defined? DIFF
167
+
168
+ # :startdoc:
169
+
170
+ ##
171
+ # *Recommended*: The author(s) of the package. (can be array)
172
+ # Really. Set this or we'll tease you.
173
+
174
+ attr_accessor :author
175
+
176
+ ##
177
+ # Populated automatically from the manifest. List of executables.
178
+
179
+ attr_accessor :bin_files # :nodoc:
180
+
181
+ ##
182
+ # Optional: A description of the release's latest changes. Auto-populates.
183
+
184
+ attr_accessor :changes
185
+
186
+ ##
187
+ # Optional: An array of file patterns to delete on clean.
188
+
189
+ attr_accessor :clean_globs
190
+
191
+ ##
192
+ # Optional: A description of the project. Auto-populates.
193
+
194
+ attr_accessor :description
195
+
196
+ ##
197
+ # Optional: What sections from the readme to use for auto-description. Defaults to %w(description).
198
+
199
+ attr_accessor :description_sections
200
+
201
+ ##
202
+ # *Recommended*: The author's email address(es). (can be array)
203
+
204
+ attr_accessor :email
205
+
206
+ ##
207
+ # Optional: An array of rubygem dependencies.
208
+
209
+ attr_accessor :extra_deps
210
+
211
+ ##
212
+ # Populated automatically from the manifest. List of library files.
213
+
214
+ attr_accessor :lib_files # :nodoc:
215
+
216
+ ##
217
+ # Optional: Array of incompatible versions for multiruby filtering. Used as a regex.
218
+
219
+ attr_accessor :multiruby_skip
220
+
221
+ ##
222
+ # *MANDATORY*: The name of the release.
223
+
224
+ attr_accessor :name
225
+
226
+ ##
227
+ # Optional: Should package create a tarball? [default: true]
228
+
229
+ attr_accessor :need_tar
230
+
231
+ ##
232
+ # Optional: Should package create a zipfile? [default: false]
233
+
234
+ attr_accessor :need_zip
235
+
236
+ ##
237
+ # Optional: A post-install message to be displayed when gem is installed.
238
+
239
+ attr_accessor :post_install_message
240
+
241
+ ##
242
+ # Optional: A regexp to match documentation files against the manifest.
243
+
244
+ attr_accessor :rdoc_pattern
245
+
246
+ ##
247
+ # Optional: Name of RDoc destination directory on Rubyforge. [default: +name+]
248
+
249
+ attr_accessor :remote_rdoc_dir
250
+
251
+ ##
252
+ # Optional: Flags for RDoc rsync. [default: "-av --delete"]
253
+
254
+ attr_accessor :rsync_args
255
+
256
+ ##
257
+ # Optional: The name of the rubyforge project. [default: name.downcase]
258
+
259
+ attr_accessor :rubyforge_name
260
+
261
+ ##
262
+ # The Gem::Specification.
263
+
264
+ attr_accessor :spec # :nodoc:
265
+
266
+ ##
267
+ # Optional: A hash of extra values to set in the gemspec. Value may be a proc.
268
+
269
+ attr_accessor :spec_extras
270
+
271
+ ##
272
+ # Optional: A short summary of the project. Auto-populates.
273
+
274
+ attr_accessor :summary
275
+
276
+ ##
277
+ # Optional: Number of sentences from description for summary. Defaults to 1.
278
+
279
+ attr_accessor :summary_sentences
280
+
281
+ ##
282
+ # Populated automatically from the manifest. List of tests.
283
+
284
+ attr_accessor :test_files # :nodoc:
285
+
286
+ ##
287
+ # Optional: An array of test file patterns [default: test/**/test_*.rb]
288
+
289
+ attr_accessor :test_globs
290
+
291
+ ##
292
+ # Optional: The url(s) of the project. (can be array). Auto-populates.
293
+
294
+ attr_accessor :url
295
+
296
+ ##
297
+ # *MANDATORY*: The version. Don't hardcode! use a constant in the project.
298
+
299
+ attr_accessor :version
300
+
301
+ def initialize(name, version) # :nodoc:
302
+ self.name = name
303
+ self.version = version
304
+
305
+ # Defaults
306
+ self.author = []
307
+ self.clean_globs = %w(diff diff.txt email.txt ri
308
+ *.gem *~ **/*~ *.rbc **/*.rbc)
309
+ self.description_sections = %w(description)
310
+ self.email = []
311
+ self.extra_deps = []
312
+ self.multiruby_skip = []
313
+ self.need_tar = true
314
+ self.need_zip = false
315
+ self.rdoc_pattern = /^(lib|bin|ext)|txt$/
316
+ self.remote_rdoc_dir = name
317
+ self.rsync_args = '-av --delete'
318
+ self.rubyforge_name = name.downcase
319
+ self.spec_extras = {}
320
+ self.summary_sentences = 1
321
+ self.test_globs = ['test/**/test_*.rb']
322
+ self.post_install_message = nil
323
+
324
+ yield self if block_given?
325
+
326
+ # Intuit values:
327
+
328
+ def missing name
329
+ warn "** #{name} is missing or in the wrong format for auto-intuiting."
330
+ warn " run `sow blah` and look at its text files"
331
+ end
332
+
333
+ readme = File.read("README.rdoc").split(/^(=+ .*)$/)[1..-1] rescue ''
334
+ unless readme.empty? then
335
+ sections = readme.map { |s|
336
+ s =~ /^=/ ? s.strip.downcase.chomp(':').split.last : s.strip
337
+ }
338
+ sections = Hash[*sections]
339
+ desc = sections.values_at(*description_sections).join("\n\n")
340
+ summ = desc.split(/\.\s+/).first(summary_sentences).join(". ")
341
+
342
+ self.description ||= desc
343
+ self.summary ||= summ
344
+ self.url ||= readme[1].gsub(/^\* /, '').split(/\n/).grep(/\S+/)
345
+ else
346
+ missing 'README.rdoc'
347
+ end
348
+
349
+ self.changes ||= begin
350
+ h = File.read("CHANGELOG")
351
+ h.split(/^(===.*)/)[1..2].join.strip
352
+ rescue
353
+ missing 'CHANGELOG'
354
+ ''
355
+ end
356
+
357
+ %w(email author).each do |field|
358
+ value = self.send(field)
359
+ if value.nil? or value.empty? then
360
+ if Time.now < Time.local(2008, 4, 1) then
361
+ warn "Hoe #{field} value not set - Fix by 2008-04-01!"
362
+ self.send "#{field}=", "doofus"
363
+ else
364
+ abort "Hoe #{field} value not set. aborting"
365
+ end
366
+ end
367
+ end
368
+
369
+ self.extra_deps = Array(extra_deps).map { |o| String === o ? [o] : o }
370
+
371
+ define_tasks
372
+ end
373
+
374
+ def developer name, email
375
+ self.author << name
376
+ self.email << email
377
+ end
378
+
379
+ def define_tasks # :nodoc:
380
+ def with_config # :nodoc:
381
+ rc = File.expand_path("~/.hoerc")
382
+ exists = File.exist? rc
383
+ config = exists ? YAML.load_file(rc) : {}
384
+ yield(config, rc)
385
+ end
386
+
387
+ desc 'Run the default tasks.'
388
+ task :default => :test
389
+
390
+ desc 'Run the test suite. Use FILTER to add to the command line.'
391
+ task :test do
392
+ run_tests
393
+ end
394
+
395
+ desc 'Show which test files fail when run alone.'
396
+ task :test_deps do
397
+ tests = Dir["test/**/test_*.rb"] + Dir["test/**/*_test.rb"]
398
+
399
+ tests.each do |test|
400
+ if not system "ruby -Ibin:lib:test #{test} &> /dev/null" then
401
+ puts "Dependency Issues: #{test}"
402
+ end
403
+ end
404
+ end
405
+
406
+ desc 'Run the test suite using multiruby.'
407
+ task :multi do
408
+ run_tests :multi
409
+ end
410
+
411
+ ############################################################
412
+ # Packaging and Installing
413
+
414
+ signing_key = nil
415
+ cert_chain = []
416
+
417
+ with_config do |config, path|
418
+ break unless config['signing_key_file'] and config['signing_cert_file']
419
+ key_file = File.expand_path config['signing_key_file'].to_s
420
+ signing_key = key_file if File.exist? key_file
421
+
422
+ cert_file = File.expand_path config['signing_cert_file'].to_s
423
+ cert_chain << cert_file if File.exist? cert_file
424
+ end
425
+
426
+ self.spec = Gem::Specification.new do |s|
427
+ s.name = name
428
+ s.version = version
429
+ s.summary = summary
430
+ case author
431
+ when Array
432
+ s.authors = author
433
+ else
434
+ s.author = author
435
+ end
436
+ s.email = email
437
+ s.homepage = Array(url).first
438
+ s.rubyforge_project = rubyforge_name
439
+
440
+ s.description = description
441
+
442
+ extra_deps.each do |dep|
443
+ s.add_dependency(*dep)
444
+ end
445
+
446
+ s.files = File.read("MANIFEST").delete("\r").split(/\n/)
447
+ s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
448
+
449
+ s.bindir = "bin"
450
+ dirs = Dir['{lib,ext}']
451
+ s.require_paths = dirs unless dirs.empty?
452
+
453
+ s.rdoc_options = ['--main', 'README.rdoc']
454
+ s.extra_rdoc_files = s.files.grep(/txt$/)
455
+ s.has_rdoc = true
456
+
457
+ s.post_install_message = post_install_message
458
+
459
+ if test ?f, "test/test_all.rb" then
460
+ s.test_file = "test/test_all.rb"
461
+ else
462
+ s.test_files = Dir[*test_globs]
463
+ end
464
+
465
+ if signing_key and cert_chain then
466
+ s.signing_key = signing_key
467
+ s.cert_chain = cert_chain
468
+ end
469
+
470
+ ############################################################
471
+ # Allow automatic inclusion of compiled extensions
472
+ if ENV['INLINE'] then
473
+ s.platform = ENV['FORCE_PLATFORM'] || Gem::Platform::CURRENT
474
+ # name of the extension is CamelCase
475
+ alternate_name = if name =~ /[A-Z]/ then
476
+ name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
477
+ elsif name =~ /_/ then
478
+ name.capitalize.gsub(/_([a-z])/) { $1.upcase }
479
+ end
480
+
481
+ # Try collecting Inline extensions for +name+
482
+ if defined?(Inline) then
483
+ directory 'lib/inline'
484
+
485
+ extensions = Dir.chdir(Inline::directory) {
486
+ Dir["Inline_{#{name},#{alternate_name}}_*.#{DLEXT}"]
487
+ }
488
+ extensions.each do |ext|
489
+ # add the inlined extension to the spec files
490
+ s.files += ["lib/inline/#{ext}"]
491
+
492
+ # include the file in the tasks
493
+ file "lib/inline/#{ext}" => ["lib/inline"] do
494
+ cp File.join(Inline::directory, ext), "lib/inline"
495
+ end
496
+ end
497
+ end
498
+ end
499
+
500
+ # Do any extra stuff the user wants
501
+ spec_extras.each do |msg, val|
502
+ case val
503
+ when Proc
504
+ val.call(s.send(msg))
505
+ else
506
+ s.send "#{msg}=", val
507
+ end
508
+ end
509
+ end
510
+
511
+ desc 'Show information about the gem.'
512
+ task :debug_gem do
513
+ puts spec.to_ruby
514
+ end
515
+
516
+ desc "Generate #{name}.gemspec"
517
+ task :gemspec do
518
+ File.open("#{name}.gemspec", "w") do |f|
519
+ f.write spec.to_ruby
520
+ end
521
+ end
522
+
523
+ self.lib_files = spec.files.grep(/^(lib|ext)/)
524
+ self.bin_files = spec.files.grep(/^bin/)
525
+ self.test_files = spec.files.grep(/^test/)
526
+
527
+ Rake::GemPackageTask.new spec do |pkg|
528
+ pkg.need_tar = @need_tar
529
+ pkg.need_zip = @need_zip
530
+ end
531
+
532
+ desc 'Install the package as a gem.'
533
+ task :install_gem => [:clean, :package] do
534
+ sh "#{'sudo ' unless WINDOZE}gem install --local pkg/*.gem"
535
+ end
536
+
537
+ desc 'Package and upload the release to rubyforge.'
538
+ task :release => [:clean, :package] do |t|
539
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
540
+ abort "Versions don't match #{v} vs #{version}" if v != version
541
+ pkg = "pkg/#{name}-#{version}"
542
+
543
+ if $DEBUG then
544
+ puts "release_id = rf.add_release #{rubyforge_name.inspect}, #{name.inspect}, #{version.inspect}, \"#{pkg}.tgz\""
545
+ puts "rf.add_file #{rubyforge_name.inspect}, #{name.inspect}, release_id, \"#{pkg}.gem\""
546
+ end
547
+
548
+ rf = RubyForge.new.configure
549
+ puts "Logging in"
550
+ rf.login
551
+
552
+ c = rf.userconfig
553
+ c["release_notes"] = description if description
554
+ c["release_changes"] = changes if changes
555
+ c["preformatted"] = true
556
+
557
+ files = [(@need_tar ? "#{pkg}.tgz" : nil),
558
+ (@need_zip ? "#{pkg}.zip" : nil),
559
+ "#{pkg}.gem"].compact
560
+
561
+ puts "Releasing #{name} v. #{version}"
562
+ rf.add_release rubyforge_name, name, version, *files
563
+ end
564
+
565
+ ############################################################
566
+ # Doco
567
+
568
+ Rake::RDocTask.new(:docs) do |rd|
569
+ rd.main = "README.rdoc"
570
+ rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/ and not ENV['NODOT']
571
+ rd.rdoc_dir = 'doc'
572
+ files = spec.files.grep(rdoc_pattern)
573
+ files -= ['MANIFEST']
574
+ rd.rdoc_files.push(*files)
575
+
576
+ title = "#{name}-#{version} Documentation"
577
+ title = "#{rubyforge_name}'s " + title if rubyforge_name != name
578
+
579
+ rd.options << "-t #{title}"
580
+ end
581
+
582
+ desc 'Generate ri locally for testing.'
583
+ task :ridocs => :clean do
584
+ sh %q{ rdoc --ri -o ri . }
585
+ end
586
+
587
+ desc 'Publish RDoc to RubyForge.'
588
+ task :publish_docs => [:clean, :docs] do
589
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
590
+ host = "#{config["username"]}@rubyforge.org"
591
+
592
+ remote_dir = "/var/www/gforge-projects/#{rubyforge_name}/#{remote_rdoc_dir}"
593
+ local_dir = 'doc'
594
+
595
+ sh %{rsync #{rsync_args} #{local_dir}/ #{host}:#{remote_dir}}
596
+ end
597
+
598
+ # no doco for this one
599
+ task :publish_on_announce do
600
+ with_config do |config, _|
601
+ Rake::Task['publish_docs'].invoke if config["publish_on_announce"]
602
+ end
603
+ end
604
+
605
+ ############################################################
606
+ # Misc/Maintenance:
607
+
608
+ desc 'Run ZenTest against the package.'
609
+ task :audit do
610
+ libs = %w(lib test ext).join(File::PATH_SEPARATOR)
611
+ sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
612
+ end
613
+
614
+ desc 'Clean up all the extras.'
615
+ task :clean => [ :clobber_docs, :clobber_package ] do
616
+ clean_globs.each do |pattern|
617
+ files = Dir[pattern]
618
+ rm_rf files, :verbose => true unless files.empty?
619
+ end
620
+ end
621
+
622
+ desc 'Create a fresh ~/.hoerc file.'
623
+ task :config_hoe do
624
+ with_config do |config, path|
625
+ default_config = {
626
+ "exclude" => /tmp$|CVS|\.svn/,
627
+ "publish_on_announce" => false,
628
+ "signing_key_file" => "~/.gem/gem-private_key.pem",
629
+ "signing_cert_file" => "~/.gem/gem-public_cert.pem",
630
+ "blogs" => [ {
631
+ "user" => "user",
632
+ "url" => "url",
633
+ "extra_headers" => {
634
+ "mt_convert_breaks" => "markdown"
635
+ },
636
+ "blog_id" => "blog_id",
637
+ "password"=>"password",
638
+ } ],
639
+ }
640
+ File.open(path, "w") do |f|
641
+ YAML.dump(default_config.merge(config), f)
642
+ end
643
+
644
+ editor = ENV['EDITOR'] || 'vi'
645
+ system "#{editor} #{path}" if ENV['SHOW_EDITOR'] != 'no'
646
+ end
647
+ end
648
+
649
+ desc 'Generate email announcement file.'
650
+ task :email do
651
+ require 'rubyforge'
652
+ subject, title, body, urls = announcement
653
+
654
+ File.open("email.txt", "w") do |mail|
655
+ mail.puts "Subject: [ANN] #{subject}"
656
+ mail.puts
657
+ mail.puts title
658
+ mail.puts
659
+ mail.puts urls
660
+ mail.puts
661
+ mail.puts body
662
+ mail.puts
663
+ mail.puts urls
664
+ end
665
+ puts "Created email.txt"
666
+ end
667
+
668
+ desc 'Post announcement to blog.'
669
+ task :post_blog do
670
+ require 'xmlrpc/client'
671
+
672
+ with_config do |config, path|
673
+ break unless config['blogs']
674
+
675
+ subject, title, body, urls = announcement
676
+ body += "\n\n#{urls}"
677
+
678
+ config['blogs'].each do |site|
679
+ server = XMLRPC::Client.new2(site['url'])
680
+ content = site['extra_headers'].merge(:title => title,
681
+ :description => body)
682
+ result = server.call('metaWeblog.newPost',
683
+ site['blog_id'],
684
+ site['user'],
685
+ site['password'],
686
+ content,
687
+ true)
688
+ end
689
+ end
690
+ end
691
+
692
+ desc 'Post announcement to rubyforge.'
693
+ task :post_news do
694
+ require 'rubyforge'
695
+ subject, title, body, urls = announcement
696
+
697
+ rf = RubyForge.new.configure
698
+ rf.login
699
+ rf.post_news(rubyforge_name, subject, "#{title}\n\n#{body}")
700
+ puts "Posted to rubyforge"
701
+ end
702
+
703
+ desc 'Create news email file and post to rubyforge.'
704
+ task :announce => [:email, :post_news, :post_blog, :publish_on_announce ]
705
+
706
+ desc 'Verify the manifest.'
707
+ task :check_manifest => :clean do
708
+ f = "Manifest.tmp"
709
+ require 'find'
710
+ files = []
711
+ with_config do |config, _|
712
+ exclusions = config["exclude"]
713
+ abort "exclude entry missing from .hoerc. Aborting." if exclusions.nil?
714
+ Find.find '.' do |path|
715
+ next unless File.file? path
716
+ next if path =~ exclusions
717
+ files << path[2..-1]
718
+ end
719
+ files = files.sort.join "\n"
720
+ File.open f, 'w' do |fp| fp.puts files end
721
+ system "#{DIFF} -du MANIFEST #{f}"
722
+ rm f
723
+ end
724
+ end
725
+
726
+ desc 'Generate a key for signing your gems.'
727
+ task :generate_key do
728
+ email = spec.email
729
+ abort "No email in your gemspec" if email.nil? or email.empty?
730
+
731
+ key_file = with_config { |config, _| config['signing_key_file'] }
732
+ cert_file = with_config { |config, _| config['signing_cert_file'] }
733
+
734
+ if key_file.nil? or cert_file.nil? then
735
+ ENV['SHOW_EDITOR'] ||= 'no'
736
+ Rake::Task['config_hoe'].invoke
737
+
738
+ key_file = with_config { |config, _| config['signing_key_file'] }
739
+ cert_file = with_config { |config, _| config['signing_cert_file'] }
740
+ end
741
+
742
+ key_file = File.expand_path key_file
743
+ cert_file = File.expand_path cert_file
744
+
745
+ unless File.exist? key_file or File.exist? cert_file then
746
+ sh "gem cert --build #{email}"
747
+ mv "gem-private_key.pem", key_file, :verbose => true
748
+ mv "gem-public_cert.pem", cert_file, :verbose => true
749
+
750
+ puts "Installed key and certificate."
751
+
752
+ rf = RubyForge.new.configure
753
+ rf.login
754
+
755
+ cert_package = "#{rubyforge_name}-certificates"
756
+
757
+ begin
758
+ rf.lookup 'package', cert_package
759
+ rescue
760
+ rf.create_package rubyforge_name, cert_package
761
+ end
762
+
763
+ begin
764
+ rf.lookup('release', cert_package)['certificates']
765
+ rf.add_file rubyforge_name, cert_package, 'certificates', cert_file
766
+ rescue
767
+ rf.add_release rubyforge_name, cert_package, 'certificates', cert_file
768
+ end
769
+
770
+ puts "Uploaded certificate to release \"certificates\" in package #{cert_package}"
771
+ else
772
+ puts "Keys already exist."
773
+ end
774
+ end
775
+
776
+ end # end define
777
+
778
+ def announcement # :nodoc:
779
+ changes = self.changes.rdoc_to_markdown
780
+
781
+ subject = "#{name} #{version} Released"
782
+ title = "#{name} version #{version} has been released!"
783
+ body = "#{description}\n\nChanges:\n\n#{changes}".rdoc_to_markdown
784
+ urls = Array(url).map { |s| "* <#{s.strip.rdoc_to_markdown}>" }.join("\n")
785
+
786
+ return subject, title, body, urls
787
+ end
788
+
789
+ def run_tests(multi=false) # :nodoc:
790
+ msg = multi ? :sh : :ruby
791
+ cmd = if test ?f, 'test/test_all.rb' then
792
+ "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
793
+ else
794
+ tests = ['test/unit'] + test_globs.map { |g| Dir.glob(g) }.flatten
795
+ tests.map! {|f| %Q(require "#{f}")}
796
+ "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
797
+ end
798
+
799
+ excludes = multiruby_skip.join(":")
800
+ ENV['EXCLUDED_VERSIONS'] = excludes
801
+ cmd = "multiruby #{cmd}" if multi
802
+
803
+ send msg, cmd
804
+ end
805
+
806
+ ##
807
+ # Reads a file at +path+ and spits out an array of the +paragraphs+ specified.
808
+ #
809
+ # changes = p.paragraphs_of('CHANGELOG', 0..1).join("\n\n")
810
+ # summary, *description = p.paragraphs_of('README.rdoc', 3, 3..8)
811
+
812
+ def paragraphs_of(path, *paragraphs)
813
+ File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
814
+ end
815
+ end
816
+
817
+ # :enddoc:
818
+
819
+ class ::Rake::SshDirPublisher # :nodoc:
820
+ attr_reader :host, :remote_dir, :local_dir
821
+ end
822
+
823
+ class String
824
+ def rdoc_to_markdown
825
+ self.gsub(/^mailto:/, '').gsub(/^(=+)/) { "#" * $1.size }
826
+ end
827
+ end
828
+
829
+ if $0 == __FILE__ then
830
+ out = `rake -T | egrep -v "redocs|repackage|clobber|trunk"`
831
+ puts out.gsub(/\#/, '-').gsub(/^rake /, '# * ')
832
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbarnette-backpack-journal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-22 00:00:00 -07:00
12
+ date: 2008-05-23 00:00:00 -07:00
13
13
  default_executable: backpack-journal
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: thor
16
+ name: wycats-thor
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
@@ -21,15 +21,6 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.9.2
23
23
  version:
24
- - !ruby/object:Gem::Dependency
25
- name: hoe
26
- version_requirement:
27
- version_requirements: !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- version: 1.5.3
32
- version:
33
24
  description: Make journal and status entries in 37signals' Backpack.
34
25
  email:
35
26
  - jbarnette@rubyforge.org
@@ -37,25 +28,24 @@ executables:
37
28
  - backpack-journal
38
29
  extensions: []
39
30
 
40
- extra_rdoc_files:
41
- - History.txt
42
- - Manifest.txt
43
- - README.txt
31
+ extra_rdoc_files: []
32
+
44
33
  files:
45
- - History.txt
46
- - Manifest.txt
47
- - README.txt
34
+ - CHANGELOG
35
+ - MANIFEST
36
+ - README.rdoc
48
37
  - Rakefile
49
38
  - backpack-journal.gemspec
50
39
  - bin/backpack-journal
51
40
  - lib/backpack-journal/version.rb
41
+ - lib/hoe.rb
52
42
  - test/test_backpack-journal.rb
53
43
  has_rdoc: true
54
44
  homepage: http://github.com/jbarnette/backpack-journal
55
45
  post_install_message:
56
46
  rdoc_options:
57
47
  - --main
58
- - README.txt
48
+ - README.rdoc
59
49
  require_paths:
60
50
  - lib
61
51
  required_ruby_version: !ruby/object:Gem::Requirement