bones 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,21 @@
1
+ == 1.3.3 / 2008-02-18
2
+
3
+ * 4 minor enhancements
4
+ - The annotation tags to search for can be specified by the user
5
+ in the Rakefile
6
+ - Directory names can be substituted during skeleton creation
7
+ - Support for the GEM post_install_message
8
+ - Support to generate an announcement text file and send the
9
+ announcement via e-mail
10
+ - Added a manifest:assert task that can be used when building the
11
+ gem to assert that the manifest is up to date
12
+ task 'gem:package' => 'manifest:assert'
13
+ * 1 bug fix
14
+ - Fixed a circular dependency in the gem creation tasks
15
+
1
16
  == 1.3.2 / 2008-02-05
2
17
 
3
- * 1 minor enchancement
18
+ * 1 minor enhancement
4
19
  - Added colorization to the manifest:check task
5
20
 
6
21
  == 1.3.1 / 2008-02-01
@@ -16,7 +31,7 @@
16
31
  - RSpec tasks were not including the user defined project libraries
17
32
  such as "ext" or anything besides "lib"
18
33
  - Tweaked the gem install/uninstall tasks to remove installed binaries
19
- and to install paltform specific gem versions
34
+ and to install platform specific gem versions
20
35
  - Fixed a bug where the RDoc task was ignore the PROJ.rdoc_opts
21
36
 
22
37
  == 1.3.0 / 2008-01-04
@@ -46,12 +61,12 @@
46
61
  * 2 minor enhancements
47
62
  - The pkg and doc directories are now excluded from the manifest
48
63
  - Added method to hide tasks from the rake task listing
49
- * 1 bugfix
64
+ * 1 bug fix
50
65
  - Fixed typo in an abort message (thanks Bill Kleb)
51
66
 
52
67
  == 1.1.1 / 2007-12-29
53
68
 
54
- * 1 bugfix
69
+ * 1 bug fix
55
70
  - Fixed the bad interaction with RSpec gem
56
71
 
57
72
  == 1.1.0 / 2007-12-29
@@ -11,6 +11,7 @@ data/bin/NAME.erb
11
11
  data/lib/NAME.rb.erb
12
12
  data/spec/NAME_spec.rb.erb
13
13
  data/spec/spec_helper.rb.erb
14
+ data/tasks/ann.rake
14
15
  data/tasks/annotations.rake
15
16
  data/tasks/doc.rake
16
17
  data/tasks/gem.rake
@@ -25,6 +26,8 @@ data/test/test_NAME.rb
25
26
  lib/bones.rb
26
27
  lib/bones/annotation_extractor.rb
27
28
  lib/bones/main.rb
29
+ lib/bones/smtp_tls.rb
30
+ tasks/ann.rake
28
31
  tasks/annotations.rake
29
32
  tasks/doc.rake
30
33
  tasks/gem.rake
data/README.txt CHANGED
@@ -14,36 +14,39 @@ gem dependency required).
14
14
 
15
15
  Mr Bones provides the following rake tasks:
16
16
 
17
- clobber # Remove all build products
18
- doc # Alias to doc:rdoc
19
- doc:rdoc # Build the rdoc HTML Files
20
- doc:release # Publish RDoc to RubyForge
21
- doc:rerdoc # Force a rebuild of the RDOC files
22
- doc:ri # Generate ri locally for testing
23
- gem # Alias to gem:package
24
- gem:debug # Show information about the gem
25
- gem:gem # Build the gem file bones-1.3.0.gem
26
- gem:install # Install the gem
27
- gem:package # Build all the packages
28
- gem:release # Package and upload to RubyForge
29
- gem:repackage # Force a rebuild of the package files
30
- gem:uninstall # Uninstall the gem
31
- manifest # Alias to manifest:check
32
- manifest:check # Verify the manifest
33
- manifest:create # Create a new manifest
34
- notes # Enumerate all annotations
35
- notes:fixme # Enumerate all FIXME annotations
36
- notes:optimize # Enumerate all OPTIMIZE annotations
37
- notes:todo # Enumerate all TODO annotations
38
- spec # Alias to spec:run
39
- spec:rcov # Run all specs with RCov
40
- spec:run # Run all specs with basic output
41
- spec:specdoc # Run all specs with text output
42
- svn:create_tag # Create a new tag in the SVN repository
43
- svn:show_tags # Show tags from the SVN repository
44
- test # Alias to test:run
45
- test:rcov # Run rcov on the unit tests
46
- test:run # Run tests for run
17
+ ann # Alias to ann:announcement
18
+ ann:announcement # Create an announcement file
19
+ ann:email # Send email announcement
20
+ clobber # Remove all build products
21
+ doc # Alias to doc:rdoc
22
+ doc:rdoc # Build the rdoc HTML Files
23
+ doc:release # Publish RDoc to RubyForge
24
+ doc:rerdoc # Force a rebuild of the RDOC files
25
+ doc:ri # Generate ri locally for testing
26
+ gem # Alias to gem:package
27
+ gem:debug # Show information about the gem
28
+ gem:gem # Build the gem file bones-1.3.3.gem
29
+ gem:install # Install the gem
30
+ gem:package # Build all the packages
31
+ gem:release # Package and upload to RubyForge
32
+ gem:repackage # Force a rebuild of the package files
33
+ gem:uninstall # Uninstall the gem
34
+ manifest # Alias to manifest:check
35
+ manifest:check # Verify the manifest
36
+ manifest:create # Create a new manifest
37
+ notes # Enumerate all annotations
38
+ notes:fixme # Enumerate all FIXME annotations
39
+ notes:optimize # Enumerate all OPTIMIZE annotations
40
+ notes:todo # Enumerate all TODO annotations
41
+ spec # Alias to spec:run
42
+ spec:rcov # Run all specs with RCov
43
+ spec:run # Run all specs with basic output
44
+ spec:specdoc # Run all specs with text output
45
+ svn:create_tag # Create a new tag in the SVN repository
46
+ svn:show_tags # Show tags from the SVN repository
47
+ test # Alias to test:run
48
+ test:rcov # Run rcov on the unit tests
49
+ test:run # Run tests for run
47
50
 
48
51
  The rake tasks in the Mr Bones framework can be found in the "tasks"
49
52
  directory. Add your own tasks there when you need more functionality.
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: Rakefile 489 2008-02-01 17:32:57Z tim_pease $
1
+ # $Id: Rakefile 536 2008-02-18 23:07:49Z tim_pease $
2
2
 
3
3
  $:.unshift('lib')
4
4
 
@@ -14,11 +14,40 @@ PROJ.url = 'http://codeforpeople.rubyforge.org/bones'
14
14
  PROJ.rubyforge_name = 'codeforpeople'
15
15
  PROJ.rdoc_remote_dir = 'bones'
16
16
  PROJ.version = Bones::VERSION
17
+ PROJ.release_name = 'Fractal Bovine'
17
18
 
18
19
  PROJ.rdoc_exclude << '^data/'
19
- PROJ.annotation_exclude = %w(^README\.txt$ ^data/)
20
+ PROJ.annotation_exclude = %w(^README\.txt$ ^data/ ^tasks/setup.rb$)
20
21
  PROJ.svn = 'bones'
21
22
 
22
23
  PROJ.spec_opts << '--color'
23
24
 
25
+ PROJ.ann_email[:server] = 'smtp.gmail.com'
26
+ PROJ.ann_email[:port] = 587
27
+
28
+ PROJ.post_install_message = <<-MSG
29
+ --------------------------
30
+ Keep rattlin' dem bones!
31
+ --------------------------
32
+ MSG
33
+
34
+ PROJ.ann_paragraphs = %w[install synopsis features requirements]
35
+ PROJ.ann_text = <<-ANN
36
+ == FUN FACT
37
+
38
+ Half of all Americans are below average.
39
+
40
+ == POST SCRIPT
41
+
42
+ Blessings,
43
+ TwP
44
+
45
+ #{PROJ.post_install_message}
46
+ ANN
47
+
48
+ task 'gem:package' => 'manifest:assert'
49
+
50
+ task(:titlize) {PROJ.name = 'Mr Bones'}
51
+ task 'ann:announcement' => :titlize
52
+
24
53
  # EOF
@@ -0,0 +1,77 @@
1
+ # $Id$
2
+
3
+ begin
4
+ require 'bones/smtp_tls'
5
+ rescue LoadError
6
+ require 'net/smtp'
7
+ end
8
+ require 'time'
9
+
10
+ namespace :ann do
11
+
12
+ desc "Create an announcement file"
13
+ task :announcement do
14
+ File.open('announcement.txt','w') do |fd|
15
+ fd.puts("#{PROJ.name} version #{PROJ.version}")
16
+ fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
17
+ fd.puts(" #{PROJ.url}") if PROJ.url
18
+ fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
19
+ fd.puts
20
+ fd.puts("== DESCRIPTION")
21
+ fd.puts
22
+ fd.puts(PROJ.description)
23
+ fd.puts
24
+ fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
25
+ fd.puts
26
+ PROJ.ann_paragraphs.each do |p|
27
+ fd.puts "== #{p.upcase}"
28
+ fd.puts
29
+ fd.puts paragraphs_of('README.txt', p).join("\n\n")
30
+ fd.puts
31
+ end
32
+ fd.puts PROJ.ann_text if PROJ.ann_text
33
+ end
34
+ end
35
+
36
+ desc "Send email announcement"
37
+ task :email => :announcement do
38
+ from = PROJ.ann_email[:from] || PROJ.email
39
+ to = Array(PROJ.ann_email[:to])
40
+
41
+ ### build a mail header for RFC 822
42
+ rfc822msg = "From: #{from}\n"
43
+ rfc822msg << "To: #{to.join(',')}\n"
44
+ rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
45
+ rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
46
+ rfc822msg << "\n"
47
+ rfc822msg << "Date: #{Time.new.rfc822}\n"
48
+ rfc822msg << "Message-Id: "
49
+ rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{PROJ.ann_email[:domain]}>\n\n"
50
+ rfc822msg << File.read('announcement.txt')
51
+
52
+ params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
53
+ PROJ.ann_email[key]
54
+ end
55
+
56
+ params[3] = PROJ.email if params[3].nil?
57
+
58
+ if params[4].nil?
59
+ STDOUT.write "Please enter your e-mail password (#{params[3]}): "
60
+ params[4] = STDIN.gets.chomp
61
+ end
62
+
63
+ ### send email
64
+ Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
65
+ end
66
+
67
+ task :clobber_announcement do
68
+ rm 'announcement.txt' rescue nil
69
+ end
70
+ end # namespace :ann
71
+
72
+ desc 'Alias to ann:announcement'
73
+ task :ann => 'ann:announcement'
74
+
75
+ task :clobber => %w(ann:clobber_announcement)
76
+
77
+ # EOF
@@ -5,23 +5,15 @@ if HAVE_BONES
5
5
  desc "Enumerate all annotations"
6
6
  task :notes do
7
7
  Bones::AnnotationExtractor.enumerate(
8
- PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
8
+ PROJ, PROJ.annotation_tags.join('|'), :tag => true)
9
9
  end
10
10
 
11
11
  namespace :notes do
12
- desc "Enumerate all OPTIMIZE annotations"
13
- task :optimize do
14
- Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
15
- end
16
-
17
- desc "Enumerate all FIXME annotations"
18
- task :fixme do
19
- Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
20
- end
21
-
22
- desc "Enumerate all TODO annotations"
23
- task :todo do
24
- Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
12
+ PROJ.annotation_tags.each do |tag|
13
+ desc "Enumerate all #{tag} annotations"
14
+ task tag.downcase.to_sym do
15
+ Bones::AnnotationExtractor.enumerate(PROJ, tag)
16
+ end
25
17
  end
26
18
  end
27
19
 
@@ -12,6 +12,7 @@ namespace :gem do
12
12
  s.email = PROJ.email
13
13
  s.homepage = Array(PROJ.url).first
14
14
  s.rubyforge_project = PROJ.rubyforge_name
15
+ s.post_install_message = PROJ.post_install_message
15
16
 
16
17
  s.description = PROJ.description
17
18
 
@@ -62,9 +63,29 @@ namespace :gem do
62
63
  puts PROJ.spec.to_ruby
63
64
  end
64
65
 
65
- Rake::GemPackageTask.new(PROJ.spec) do |pkg|
66
+ pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
66
67
  pkg.need_tar = PROJ.need_tar
67
68
  pkg.need_zip = PROJ.need_zip
69
+ pkg.package_files += PROJ.spec.files
70
+ end
71
+ Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
72
+
73
+ gem_file = if PROJ.spec.platform == Gem::Platform::RUBY
74
+ "#{pkg.package_name}.gem"
75
+ else
76
+ "#{pkg.package_name}-#{PROJ.spec.platform}.gem"
77
+ end
78
+
79
+ desc "Build the gem file #{gem_file}"
80
+ task :package => "#{pkg.package_dir}/#{gem_file}"
81
+
82
+ file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.spec.files do
83
+ when_writing("Creating GEM") {
84
+ Gem::Builder.new(PROJ.spec).build
85
+ verbose(true) {
86
+ mv gem_file, "#{pkg.package_dir}/#{gem_file}"
87
+ }
88
+ }
68
89
  end
69
90
 
70
91
  desc 'Install the gem'
@@ -7,16 +7,9 @@ namespace :manifest do
7
7
  desc 'Verify the manifest'
8
8
  task :check do
9
9
  fn = 'Manifest.tmp'
10
- files = []
11
- exclude = Regexp.new(PROJ.exclude.join('|'))
12
- Find.find '.' do |path|
13
- path.sub! %r/^(\.\/|\/)/o, ''
14
- next unless test ?f, path
15
- next if path =~ exclude
16
- files << path
17
- end
10
+ files = manifest_files
18
11
 
19
- File.open(fn, 'w') {|fp| fp.puts files.sort}
12
+ File.open(fn, 'w') {|fp| fp.puts files}
20
13
  lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
21
14
  if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
22
15
  lines.map! do |line|
@@ -35,18 +28,20 @@ namespace :manifest do
35
28
  desc 'Create a new manifest'
36
29
  task :create do
37
30
  fn = 'Manifest.txt'
38
- files = []
39
- exclude = Regexp.new(PROJ.exclude.join('|'))
40
- Find.find '.' do |path|
41
- path.sub! %r/^(\.\/|\/)/o, ''
42
- next unless test ?f, path
43
- next if path =~ exclude
44
- files << path
31
+ files = manifest_files
32
+ unless test(?f, fn)
33
+ files << fn
34
+ files.sort!
45
35
  end
36
+ File.open(fn, 'w') {|fp| fp.puts files}
37
+ end
46
38
 
47
- files << fn unless test ?f, fn
48
- File.open(fn, 'w') {|fp| fp.puts files.sort}
39
+ task :assert do
40
+ files = manifest_files
41
+ manifest = File.read('Manifest.txt').split($/)
42
+ raise RuntimeError, "Manifest.txt is out of date" unless files == manifest
49
43
  end
44
+
50
45
  end # namespace :manifest
51
46
 
52
47
  desc 'Alias to manifest:check'
@@ -16,7 +16,8 @@ PROJ.email = nil
16
16
  PROJ.url = nil
17
17
  PROJ.version = ENV['VERSION'] || '0.0.0'
18
18
  PROJ.rubyforge_name = nil
19
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/)
19
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ announcement.txt)
20
+ PROJ.release_name = ENV['RELEASE']
20
21
 
21
22
  # Rspec
22
23
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -55,10 +56,12 @@ PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
55
56
  PROJ.dependencies = []
56
57
  PROJ.need_tar = true
57
58
  PROJ.need_zip = false
59
+ PROJ.post_install_message = nil
58
60
 
59
61
  # File Annotations
60
- PROJ.annotation_exclude = []
62
+ PROJ.annotation_exclude = %w(^tasks/setup.rb$)
61
63
  PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
64
+ PROJ.annotation_tags = %w(FIXME OPTIMIZE TODO)
62
65
 
63
66
  # Subversion Repository
64
67
  PROJ.svn = false
@@ -67,6 +70,20 @@ PROJ.svn_trunk = 'trunk'
67
70
  PROJ.svn_tags = 'tags'
68
71
  PROJ.svn_branches = 'branches'
69
72
 
73
+ # Announce
74
+ PROJ.ann_text = nil
75
+ PROJ.ann_paragraphs = []
76
+ PROJ.ann_email = {
77
+ :from => nil,
78
+ :to => %w(ruby-talk@ruby-lang.org),
79
+ :server => 'localhost',
80
+ :port => 25,
81
+ :domain => ENV['HOSTNAME'],
82
+ :acct => nil,
83
+ :passwd => nil,
84
+ :authtype => :plain
85
+ }
86
+
70
87
  # Load the other rake files in the tasks folder
71
88
  rakefiles = Dir.glob('tasks/*.rake').sort
72
89
  rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
@@ -99,8 +116,8 @@ SUDO = if WIN32 then ''
99
116
  else '' end
100
117
  end
101
118
 
102
- RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
103
- GEM = WIN32 ? 'gem.cmd' : 'gem'
119
+ RCOV = WIN32 ? 'rcov.bat' : 'rcov'
120
+ GEM = WIN32 ? 'gem.bat' : 'gem'
104
121
 
105
122
  %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
106
123
  begin
@@ -186,4 +203,19 @@ def in_directory( dir, &block )
186
203
  end
187
204
  end
188
205
 
206
+ # Scans the current working directory and creates a list of files that are
207
+ # candidates to be in the manifest.
208
+ #
209
+ def manifest_files
210
+ files = []
211
+ exclude = Regexp.new(PROJ.exclude.join('|'))
212
+ Find.find '.' do |path|
213
+ path.sub! %r/^(\.\/|\/)/o, ''
214
+ next unless test ?f, path
215
+ next if path =~ exclude
216
+ files << path
217
+ end
218
+ files.sort!
219
+ end
220
+
189
221
  # EOF
@@ -1,9 +1,9 @@
1
- # $Id: bones.rb 500 2008-02-04 01:27:40Z tim_pease $
1
+ # $Id: bones.rb 509 2008-02-08 17:17:53Z tim_pease $
2
2
 
3
3
  module Bones
4
4
 
5
5
  # :stopdoc:
6
- VERSION = '1.3.2'
6
+ VERSION = '1.3.3'
7
7
  PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
8
8
  WIN32 = %r/win32/ =~ RUBY_PLATFORM
9
9
  DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
@@ -29,6 +29,8 @@ module Bones
29
29
  # these guys are just grabbing whatever is there and not pulling
30
30
  # the filenames from the manifest
31
31
 
32
+ # TODO: create some tasks to generate e-mails / announcements
33
+
32
34
  end # module Bones
33
35
 
34
36
 
@@ -1,4 +1,4 @@
1
- # $Id: main.rb 462 2008-01-04 20:56:16Z tim_pease $
1
+ # $Id: main.rb 536 2008-02-18 23:07:49Z tim_pease $
2
2
 
3
3
  require 'fileutils'
4
4
  require 'optparse'
@@ -210,7 +210,7 @@ class Main
210
210
  # indicating that the file is being created.
211
211
  #
212
212
  def cp( file )
213
- dir = File.dirname(file)
213
+ dir = File.dirname(file).sub('NAME', name)
214
214
  dir = (dir == '.' ? name : File.join(name, dir))
215
215
  dst = File.join(dir, File.basename(file, '.erb').sub('NAME', name))
216
216
  src = File.join(data, file)
@@ -0,0 +1,69 @@
1
+ # $Id: smtp_tls.rb 536 2008-02-18 23:07:49Z tim_pease $
2
+
3
+ # This code enables SMTPTLS authentication requireed for sending mail
4
+ # via the gmail servers. I found this code via a blog entry from James
5
+ # Britt.
6
+ #
7
+ # http://d.hatena.ne.jp/zorio/20060416
8
+ # http://www.jamesbritt.com/2007/12/18/sending-mail-through-gmail-with-ruby-s-net-smtp
9
+
10
+ require "openssl"
11
+ require "net/smtp"
12
+
13
+ Net::SMTP.class_eval do
14
+ private
15
+ def do_start(helodomain, user, secret, authtype)
16
+ raise IOError, 'SMTP session already started' if @started
17
+ check_auth_args user, secret, authtype if user or secret
18
+
19
+ sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) }
20
+ @socket = Net::InternetMessageIO.new(sock)
21
+ @socket.read_timeout = 60 #@read_timeout
22
+ @socket.debug_output = STDERR #@debug_output
23
+
24
+ check_response(critical { recv_response() })
25
+ do_helo(helodomain)
26
+
27
+ raise 'openssl library not installed' unless defined?(OpenSSL)
28
+ starttls
29
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
30
+ ssl.sync_close = true
31
+ ssl.connect
32
+ @socket = Net::InternetMessageIO.new(ssl)
33
+ @socket.read_timeout = 60 #@read_timeout
34
+ @socket.debug_output = STDERR #@debug_output
35
+ do_helo(helodomain)
36
+
37
+ authenticate user, secret, authtype if user
38
+ @started = true
39
+ ensure
40
+ unless @started
41
+ # authentication failed, cancel connection.
42
+ @socket.close if not @started and @socket and not @socket.closed?
43
+ @socket = nil
44
+ end
45
+ end
46
+
47
+ def do_helo(helodomain)
48
+ begin
49
+ if @esmtp
50
+ ehlo helodomain
51
+ else
52
+ helo helodomain
53
+ end
54
+ rescue Net::ProtocolError
55
+ if @esmtp
56
+ @esmtp = false
57
+ @error_occured = false
58
+ retry
59
+ end
60
+ raise
61
+ end
62
+ end
63
+
64
+ def starttls
65
+ getok('STARTTLS')
66
+ end
67
+ end
68
+
69
+ # EOF
@@ -0,0 +1,77 @@
1
+ # $Id: ann.rake 536 2008-02-18 23:07:49Z tim_pease $
2
+
3
+ begin
4
+ require 'bones/smtp_tls'
5
+ rescue LoadError
6
+ require 'net/smtp'
7
+ end
8
+ require 'time'
9
+
10
+ namespace :ann do
11
+
12
+ desc "Create an announcement file"
13
+ task :announcement do
14
+ File.open('announcement.txt','w') do |fd|
15
+ fd.puts("#{PROJ.name} version #{PROJ.version}")
16
+ fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
17
+ fd.puts(" #{PROJ.url}") if PROJ.url
18
+ fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
19
+ fd.puts
20
+ fd.puts("== DESCRIPTION")
21
+ fd.puts
22
+ fd.puts(PROJ.description)
23
+ fd.puts
24
+ fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
25
+ fd.puts
26
+ PROJ.ann_paragraphs.each do |p|
27
+ fd.puts "== #{p.upcase}"
28
+ fd.puts
29
+ fd.puts paragraphs_of('README.txt', p).join("\n\n")
30
+ fd.puts
31
+ end
32
+ fd.puts PROJ.ann_text if PROJ.ann_text
33
+ end
34
+ end
35
+
36
+ desc "Send email announcement"
37
+ task :email => :announcement do
38
+ from = PROJ.ann_email[:from] || PROJ.email
39
+ to = Array(PROJ.ann_email[:to])
40
+
41
+ ### build a mail header for RFC 822
42
+ rfc822msg = "From: #{from}\n"
43
+ rfc822msg << "To: #{to.join(',')}\n"
44
+ rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
45
+ rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
46
+ rfc822msg << "\n"
47
+ rfc822msg << "Date: #{Time.new.rfc822}\n"
48
+ rfc822msg << "Message-Id: "
49
+ rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{PROJ.ann_email[:domain]}>\n\n"
50
+ rfc822msg << File.read('announcement.txt')
51
+
52
+ params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
53
+ PROJ.ann_email[key]
54
+ end
55
+
56
+ params[3] = PROJ.email if params[3].nil?
57
+
58
+ if params[4].nil?
59
+ STDOUT.write "Please enter your e-mail password (#{params[3]}): "
60
+ params[4] = STDIN.gets.chomp
61
+ end
62
+
63
+ ### send email
64
+ Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
65
+ end
66
+
67
+ task :clobber_announcement do
68
+ rm 'announcement.txt' rescue nil
69
+ end
70
+ end # namespace :ann
71
+
72
+ desc 'Alias to ann:announcement'
73
+ task :ann => 'ann:announcement'
74
+
75
+ task :clobber => %w(ann:clobber_announcement)
76
+
77
+ # EOF
@@ -5,23 +5,15 @@ if HAVE_BONES
5
5
  desc "Enumerate all annotations"
6
6
  task :notes do
7
7
  Bones::AnnotationExtractor.enumerate(
8
- PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
8
+ PROJ, PROJ.annotation_tags.join('|'), :tag => true)
9
9
  end
10
10
 
11
11
  namespace :notes do
12
- desc "Enumerate all OPTIMIZE annotations"
13
- task :optimize do
14
- Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
15
- end
16
-
17
- desc "Enumerate all FIXME annotations"
18
- task :fixme do
19
- Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
20
- end
21
-
22
- desc "Enumerate all TODO annotations"
23
- task :todo do
24
- Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
12
+ PROJ.annotation_tags.each do |tag|
13
+ desc "Enumerate all #{tag} annotations"
14
+ task tag.downcase.to_sym do
15
+ Bones::AnnotationExtractor.enumerate(PROJ, tag)
16
+ end
25
17
  end
26
18
  end
27
19
 
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: gem.rake 536 2008-02-18 23:07:49Z tim_pease $
2
2
 
3
3
  require 'rake/gempackagetask'
4
4
 
@@ -12,6 +12,7 @@ namespace :gem do
12
12
  s.email = PROJ.email
13
13
  s.homepage = Array(PROJ.url).first
14
14
  s.rubyforge_project = PROJ.rubyforge_name
15
+ s.post_install_message = PROJ.post_install_message
15
16
 
16
17
  s.description = PROJ.description
17
18
 
@@ -62,9 +63,29 @@ namespace :gem do
62
63
  puts PROJ.spec.to_ruby
63
64
  end
64
65
 
65
- Rake::GemPackageTask.new(PROJ.spec) do |pkg|
66
+ pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
66
67
  pkg.need_tar = PROJ.need_tar
67
68
  pkg.need_zip = PROJ.need_zip
69
+ pkg.package_files += PROJ.spec.files
70
+ end
71
+ Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
72
+
73
+ gem_file = if PROJ.spec.platform == Gem::Platform::RUBY
74
+ "#{pkg.package_name}.gem"
75
+ else
76
+ "#{pkg.package_name}-#{PROJ.spec.platform}.gem"
77
+ end
78
+
79
+ desc "Build the gem file #{gem_file}"
80
+ task :package => "#{pkg.package_dir}/#{gem_file}"
81
+
82
+ file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.spec.files do
83
+ when_writing("Creating GEM") {
84
+ Gem::Builder.new(PROJ.spec).build
85
+ verbose(true) {
86
+ mv gem_file, "#{pkg.package_dir}/#{gem_file}"
87
+ }
88
+ }
68
89
  end
69
90
 
70
91
  desc 'Install the gem'
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: manifest.rake 536 2008-02-18 23:07:49Z tim_pease $
2
2
 
3
3
  require 'find'
4
4
 
@@ -7,16 +7,9 @@ namespace :manifest do
7
7
  desc 'Verify the manifest'
8
8
  task :check do
9
9
  fn = 'Manifest.tmp'
10
- files = []
11
- exclude = Regexp.new(PROJ.exclude.join('|'))
12
- Find.find '.' do |path|
13
- path.sub! %r/^(\.\/|\/)/o, ''
14
- next unless test ?f, path
15
- next if path =~ exclude
16
- files << path
17
- end
10
+ files = manifest_files
18
11
 
19
- File.open(fn, 'w') {|fp| fp.puts files.sort}
12
+ File.open(fn, 'w') {|fp| fp.puts files}
20
13
  lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
21
14
  if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
22
15
  lines.map! do |line|
@@ -35,18 +28,20 @@ namespace :manifest do
35
28
  desc 'Create a new manifest'
36
29
  task :create do
37
30
  fn = 'Manifest.txt'
38
- files = []
39
- exclude = Regexp.new(PROJ.exclude.join('|'))
40
- Find.find '.' do |path|
41
- path.sub! %r/^(\.\/|\/)/o, ''
42
- next unless test ?f, path
43
- next if path =~ exclude
44
- files << path
31
+ files = manifest_files
32
+ unless test(?f, fn)
33
+ files << fn
34
+ files.sort!
45
35
  end
36
+ File.open(fn, 'w') {|fp| fp.puts files}
37
+ end
46
38
 
47
- files << fn unless test ?f, fn
48
- File.open(fn, 'w') {|fp| fp.puts files.sort}
39
+ task :assert do
40
+ files = manifest_files
41
+ manifest = File.read('Manifest.txt').split($/)
42
+ raise RuntimeError, "manifest is out of date" unless files == manifest
49
43
  end
44
+
50
45
  end # namespace :manifest
51
46
 
52
47
  desc 'Alias to manifest:check'
@@ -1,4 +1,4 @@
1
- # $Id: setup.rb 504 2008-02-05 04:50:00Z tim_pease $
1
+ # $Id: setup.rb 536 2008-02-18 23:07:49Z tim_pease $
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
@@ -16,7 +16,8 @@ PROJ.email = nil
16
16
  PROJ.url = nil
17
17
  PROJ.version = ENV['VERSION'] || '0.0.0'
18
18
  PROJ.rubyforge_name = nil
19
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/)
19
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ announcement.txt)
20
+ PROJ.release_name = ENV['RELEASE']
20
21
 
21
22
  # Rspec
22
23
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -55,10 +56,12 @@ PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
55
56
  PROJ.dependencies = []
56
57
  PROJ.need_tar = true
57
58
  PROJ.need_zip = false
59
+ PROJ.post_install_message = nil
58
60
 
59
61
  # File Annotations
60
- PROJ.annotation_exclude = []
62
+ PROJ.annotation_exclude = %w(^tasks/setup.rb$)
61
63
  PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
64
+ PROJ.annotation_tags = %w(FIXME OPTIMIZE TODO)
62
65
 
63
66
  # Subversion Repository
64
67
  PROJ.svn = false
@@ -67,6 +70,20 @@ PROJ.svn_trunk = 'trunk'
67
70
  PROJ.svn_tags = 'tags'
68
71
  PROJ.svn_branches = 'branches'
69
72
 
73
+ # Announce
74
+ PROJ.ann_text = nil
75
+ PROJ.ann_paragraphs = []
76
+ PROJ.ann_email = {
77
+ :from => nil,
78
+ :to => %w(ruby-talk@ruby-lang.org),
79
+ :server => 'localhost',
80
+ :port => 25,
81
+ :domain => ENV['HOSTNAME'],
82
+ :acct => nil,
83
+ :passwd => nil,
84
+ :authtype => :plain
85
+ }
86
+
70
87
  # Load the other rake files in the tasks folder
71
88
  rakefiles = Dir.glob('tasks/*.rake').sort
72
89
  rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
@@ -99,8 +116,8 @@ SUDO = if WIN32 then ''
99
116
  else '' end
100
117
  end
101
118
 
102
- RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
103
- GEM = WIN32 ? 'gem.cmd' : 'gem'
119
+ RCOV = WIN32 ? 'rcov.bat' : 'rcov'
120
+ GEM = WIN32 ? 'gem.bat' : 'gem'
104
121
 
105
122
  %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
106
123
  begin
@@ -186,4 +203,19 @@ def in_directory( dir, &block )
186
203
  end
187
204
  end
188
205
 
206
+ # Scans the current working directory and creates a list of files that are
207
+ # candidates to be in the manifest.
208
+ #
209
+ def manifest_files
210
+ files = []
211
+ exclude = Regexp.new(PROJ.exclude.join('|'))
212
+ Find.find '.' do |path|
213
+ path.sub! %r/^(\.\/|\/)/o, ''
214
+ next unless test ?f, path
215
+ next if path =~ exclude
216
+ files << path
217
+ end
218
+ files.sort!
219
+ end
220
+
189
221
  # EOF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bones
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-05 00:00:00 -07:00
12
+ date: 2008-02-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -37,6 +37,7 @@ files:
37
37
  - data/lib/NAME.rb.erb
38
38
  - data/spec/NAME_spec.rb.erb
39
39
  - data/spec/spec_helper.rb.erb
40
+ - data/tasks/ann.rake
40
41
  - data/tasks/annotations.rake
41
42
  - data/tasks/doc.rake
42
43
  - data/tasks/gem.rake
@@ -51,6 +52,8 @@ files:
51
52
  - lib/bones.rb
52
53
  - lib/bones/annotation_extractor.rb
53
54
  - lib/bones/main.rb
55
+ - lib/bones/smtp_tls.rb
56
+ - tasks/ann.rake
54
57
  - tasks/annotations.rake
55
58
  - tasks/doc.rake
56
59
  - tasks/gem.rake
@@ -63,7 +66,11 @@ files:
63
66
  - tasks/test.rake
64
67
  has_rdoc: true
65
68
  homepage: http://codeforpeople.rubyforge.org/bones
66
- post_install_message:
69
+ post_install_message: |
70
+ --------------------------
71
+ Keep rattlin' dem bones!
72
+ --------------------------
73
+
67
74
  rdoc_options:
68
75
  - --main
69
76
  - README.txt