bones 1.3.3 → 1.3.4

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,16 @@
1
+ == 1.3.4 / 2008-02-20
2
+
3
+ * 4 minor enhancements
4
+ - Added more RCov options and tasks to verify a coverage
5
+ threshold (RSpec only)
6
+ - Can specify exact dependency version requirement
7
+ - Added a command line option to specify the output directory for
8
+ a new project
9
+ - The history, readme, and manifest file names can be configured
10
+ in the Rakefile
11
+ * 1 bug fix
12
+ - Now including the default rake/clean tasks
13
+
1
14
  == 1.3.3 / 2008-02-18
2
15
 
3
16
  * 4 minor enhancements
data/README.txt CHANGED
@@ -16,8 +16,9 @@ Mr Bones provides the following rake tasks:
16
16
 
17
17
  ann # Alias to ann:announcement
18
18
  ann:announcement # Create an announcement file
19
- ann:email # Send email announcement
20
- clobber # Remove all build products
19
+ ann:email # Send an email announcement
20
+ clean # Remove any temporary products.
21
+ clobber # Remove any generated file.
21
22
  doc # Alias to doc:rdoc
22
23
  doc:rdoc # Build the rdoc HTML Files
23
24
  doc:release # Publish RDoc to RubyForge
@@ -25,9 +26,8 @@ Mr Bones provides the following rake tasks:
25
26
  doc:ri # Generate ri locally for testing
26
27
  gem # Alias to gem:package
27
28
  gem:debug # Show information about the gem
28
- gem:gem # Build the gem file bones-1.3.3.gem
29
29
  gem:install # Install the gem
30
- gem:package # Build all the packages
30
+ gem:package # Build the gem file bones-1.3.4.gem
31
31
  gem:release # Package and upload to RubyForge
32
32
  gem:repackage # Force a rebuild of the package files
33
33
  gem:uninstall # Uninstall the gem
@@ -42,6 +42,7 @@ Mr Bones provides the following rake tasks:
42
42
  spec:rcov # Run all specs with RCov
43
43
  spec:run # Run all specs with basic output
44
44
  spec:specdoc # Run all specs with text output
45
+ spec:verify # Verify that rcov coverage is at least 90.0%
45
46
  svn:create_tag # Create a new tag in the SVN repository
46
47
  svn:show_tags # Show tags from the SVN repository
47
48
  test # Alias to test:run
@@ -74,6 +75,7 @@ following gems installed you will not get all that Mr Bones has to offer.
74
75
  * rubyforge - for easy gem publishing to rubyforge.org
75
76
  * rcov - for code coverage testing
76
77
  * rspec - if that's the way you roll
78
+ * facets - for pretty colors
77
79
 
78
80
  == INSTALL:
79
81
 
data/Rakefile CHANGED
@@ -1,12 +1,10 @@
1
- # $Id: Rakefile 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id: Rakefile 547 2008-02-20 20:30:47Z tim_pease $
2
2
 
3
3
  $:.unshift('lib')
4
4
 
5
5
  load 'tasks/setup.rb'
6
6
  require 'bones'
7
7
 
8
- task :default => 'spec:run'
9
-
10
8
  PROJ.name = 'bones'
11
9
  PROJ.authors = 'Tim Pease'
12
10
  PROJ.email = 'tim.pease@gmail.com'
@@ -14,7 +12,7 @@ PROJ.url = 'http://codeforpeople.rubyforge.org/bones'
14
12
  PROJ.rubyforge_name = 'codeforpeople'
15
13
  PROJ.rdoc_remote_dir = 'bones'
16
14
  PROJ.version = Bones::VERSION
17
- PROJ.release_name = 'Fractal Bovine'
15
+ PROJ.release_name = 'Finite State Puppy'
18
16
 
19
17
  PROJ.rdoc_exclude << '^data/'
20
18
  PROJ.annotation_exclude = %w(^README\.txt$ ^data/ ^tasks/setup.rb$)
@@ -35,18 +33,22 @@ PROJ.ann_paragraphs = %w[install synopsis features requirements]
35
33
  PROJ.ann_text = <<-ANN
36
34
  == FUN FACT
37
35
 
38
- Half of all Americans are below average.
36
+ A 'jiffy' is an actual unit of time for 1/100th of a second.
39
37
 
40
38
  == POST SCRIPT
41
39
 
42
40
  Blessings,
43
41
  TwP
44
42
 
43
+ == POST POST SCRIPT
44
+
45
+ The "Finite State Puppy" is the only known pet that is Touring complete.
46
+
45
47
  #{PROJ.post_install_message}
46
48
  ANN
47
49
 
50
+ task :default => 'spec:run'
48
51
  task 'gem:package' => 'manifest:assert'
49
-
50
52
  task(:titlize) {PROJ.name = 'Mr Bones'}
51
53
  task 'ann:announcement' => :titlize
52
54
 
@@ -9,9 +9,9 @@ require 'time'
9
9
 
10
10
  namespace :ann do
11
11
 
12
- desc "Create an announcement file"
13
- task :announcement do
14
- File.open('announcement.txt','w') do |fd|
12
+ file PROJ.ann_file do
13
+ puts "Generating #{PROJ.ann_file}"
14
+ File.open(PROJ.ann_file,'w') do |fd|
15
15
  fd.puts("#{PROJ.name} version #{PROJ.version}")
16
16
  fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
17
17
  fd.puts(" #{PROJ.url}") if PROJ.url
@@ -26,15 +26,18 @@ namespace :ann do
26
26
  PROJ.ann_paragraphs.each do |p|
27
27
  fd.puts "== #{p.upcase}"
28
28
  fd.puts
29
- fd.puts paragraphs_of('README.txt', p).join("\n\n")
29
+ fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
30
30
  fd.puts
31
31
  end
32
32
  fd.puts PROJ.ann_text if PROJ.ann_text
33
33
  end
34
34
  end
35
35
 
36
- desc "Send email announcement"
37
- task :email => :announcement do
36
+ desc "Create an announcement file"
37
+ task :announcement => PROJ.ann_file
38
+
39
+ desc "Send an email announcement"
40
+ task :email => PROJ.ann_file do
38
41
  from = PROJ.ann_email[:from] || PROJ.email
39
42
  to = Array(PROJ.ann_email[:to])
40
43
 
@@ -47,7 +50,7 @@ namespace :ann do
47
50
  rfc822msg << "Date: #{Time.new.rfc822}\n"
48
51
  rfc822msg << "Message-Id: "
49
52
  rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{PROJ.ann_email[:domain]}>\n\n"
50
- rfc822msg << File.read('announcement.txt')
53
+ rfc822msg << File.read(PROJ.ann_file)
51
54
 
52
55
  params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
53
56
  PROJ.ann_email[key]
@@ -63,15 +66,11 @@ namespace :ann do
63
66
  ### send email
64
67
  Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
65
68
  end
66
-
67
- task :clobber_announcement do
68
- rm 'announcement.txt' rescue nil
69
- end
70
69
  end # namespace :ann
71
70
 
72
71
  desc 'Alias to ann:announcement'
73
72
  task :ann => 'ann:announcement'
74
73
 
75
- task :clobber => %w(ann:clobber_announcement)
74
+ CLOBBER << PROJ.ann_file
76
75
 
77
76
  # EOF
@@ -31,7 +31,6 @@ namespace :doc do
31
31
  sh "#{RDOC} --ri -o ri ."
32
32
  end
33
33
 
34
- desc 'Remove ri products'
35
34
  task :clobber_ri do
36
35
  rm_r 'ri' rescue nil
37
36
  end
@@ -44,6 +43,6 @@ task :doc => 'doc:rdoc'
44
43
  desc 'Remove all build products'
45
44
  task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
46
45
 
47
- remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
46
+ remove_desc_for_task %w(doc:clobber_rdoc)
48
47
 
49
48
  # EOF
@@ -6,11 +6,11 @@ namespace :manifest do
6
6
 
7
7
  desc 'Verify the manifest'
8
8
  task :check do
9
- fn = 'Manifest.tmp'
9
+ fn = PROJ.manifest_file + '.tmp'
10
10
  files = manifest_files
11
11
 
12
12
  File.open(fn, 'w') {|fp| fp.puts files}
13
- lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
13
+ lines = %x(#{DIFF} -du #{PROJ.manifest_file} #{fn}).split("\n")
14
14
  if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
15
15
  lines.map! do |line|
16
16
  case line
@@ -27,19 +27,18 @@ namespace :manifest do
27
27
 
28
28
  desc 'Create a new manifest'
29
29
  task :create do
30
- fn = 'Manifest.txt'
31
30
  files = manifest_files
32
- unless test(?f, fn)
33
- files << fn
31
+ unless test(?f, PROJ.manifest_file)
32
+ files << PROJ.manifest_file
34
33
  files.sort!
35
34
  end
36
- File.open(fn, 'w') {|fp| fp.puts files}
35
+ File.open(PROJ.manifest_file, 'w') {|fp| fp.puts files}
37
36
  end
38
37
 
39
38
  task :assert do
40
39
  files = manifest_files
41
- manifest = File.read('Manifest.txt').split($/)
42
- raise RuntimeError, "Manifest.txt is out of date" unless files == manifest
40
+ manifest = File.read(PROJ.manifest_file).split($/)
41
+ raise "ERROR: #{PROJ.manifest_file} is out of date" unless files == manifest
43
42
  end
44
43
 
45
44
  end # namespace :manifest
@@ -3,16 +3,24 @@
3
3
  # This file does not define any rake tasks. It is used to load some project
4
4
  # settings if they are not defined by the user.
5
5
 
6
- unless PROJ.changes
7
- PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
8
- end
6
+ PROJ.rdoc_exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
7
+ PROJ.exclude << "^#{Regexp.escape(PROJ.ann_file)}$"
9
8
 
10
- unless PROJ.description
11
- PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
12
- end
9
+ PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
13
10
 
14
- unless PROJ.summary
15
- PROJ.summary = PROJ.description.split('.').first
16
- end
11
+ PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
12
+
13
+ PROJ.summary ||= PROJ.description.split('.').first
14
+
15
+ PROJ.files ||=
16
+ if test(?f, PROJ.manifest_file)
17
+ files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
18
+ files.delete ''
19
+ files
20
+ else [] end
21
+
22
+ PROJ.executables ||= PROJ.files.find_all {|fn| fn =~ %r/^bin/}
23
+
24
+ PROJ.rdoc_main ||= PROJ.readme_file
17
25
 
18
26
  # EOF
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
5
+ require 'rake/clean'
5
6
  require 'fileutils'
6
7
  require 'ostruct'
7
8
 
@@ -16,8 +17,11 @@ PROJ.email = nil
16
17
  PROJ.url = nil
17
18
  PROJ.version = ENV['VERSION'] || '0.0.0'
18
19
  PROJ.rubyforge_name = nil
19
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ announcement.txt)
20
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/)
20
21
  PROJ.release_name = ENV['RELEASE']
22
+ PROJ.history_file = 'History.txt'
23
+ PROJ.manifest_file = 'Manifest.txt'
24
+ PROJ.readme_file = 'README.txt'
21
25
 
22
26
  # Rspec
23
27
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -29,13 +33,16 @@ PROJ.test_file = 'test/all.rb'
29
33
  PROJ.test_opts = []
30
34
 
31
35
  # Rcov
36
+ PROJ.rcov_dir = 'coverage'
32
37
  PROJ.rcov_opts = ['--sort', 'coverage', '-T']
38
+ PROJ.rcov_threshold = 90.0
39
+ PROJ.rcov_threshold_exact = false
33
40
 
34
41
  # Rdoc
35
42
  PROJ.rdoc_opts = []
36
43
  PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
37
- PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
38
- PROJ.rdoc_main = 'README.txt'
44
+ PROJ.rdoc_exclude = %w(extconf.rb$)
45
+ PROJ.rdoc_main = nil
39
46
  PROJ.rdoc_dir = 'doc'
40
47
  PROJ.rdoc_remote_dir = nil
41
48
 
@@ -46,13 +53,8 @@ PROJ.libs = []
46
53
  %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
47
54
 
48
55
  # Gem Packaging
49
- PROJ.files =
50
- if test ?f, 'Manifest.txt'
51
- files = File.readlines('Manifest.txt').map {|fn| fn.chomp.strip}
52
- files.delete ''
53
- files
54
- else [] end
55
- PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
56
+ PROJ.files = nil
57
+ PROJ.executables = nil
56
58
  PROJ.dependencies = []
57
59
  PROJ.need_tar = true
58
60
  PROJ.need_zip = false
@@ -71,6 +73,7 @@ PROJ.svn_tags = 'tags'
71
73
  PROJ.svn_branches = 'branches'
72
74
 
73
75
  # Announce
76
+ PROJ.ann_file = 'announcement.txt'
74
77
  PROJ.ann_text = nil
75
78
  PROJ.ann_paragraphs = []
76
79
  PROJ.ann_email = {
@@ -166,7 +169,10 @@ def depend_on( name, version = nil )
166
169
  spec = Gem.source_index.find_name(name).last
167
170
  version = spec.version.to_s if version.nil? and !spec.nil?
168
171
 
169
- PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
172
+ PROJ.dependencies << case version
173
+ when nil; [name]
174
+ when %r/^\d/; [name, ">= #{version}"]
175
+ else [name, version] end
170
176
  end
171
177
 
172
178
  # Adds the given arguments to the include path if they are not already there
@@ -1,11 +1,13 @@
1
1
  # $Id$
2
2
 
3
3
  if HAVE_SPEC_RAKE_SPECTASK
4
+ require 'spec/rake/verify_rcov'
4
5
 
5
6
  namespace :spec do
6
7
 
7
8
  desc 'Run all specs with basic output'
8
9
  Spec::Rake::SpecTask.new(:run) do |t|
10
+ t.ruby_opts = PROJ.ruby_opts
9
11
  t.spec_opts = PROJ.spec_opts
10
12
  t.spec_files = PROJ.specs
11
13
  t.libs += PROJ.libs
@@ -13,6 +15,7 @@ namespace :spec do
13
15
 
14
16
  desc 'Run all specs with text output'
15
17
  Spec::Rake::SpecTask.new(:specdoc) do |t|
18
+ t.ruby_opts = PROJ.ruby_opts
16
19
  t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
17
20
  t.spec_files = PROJ.specs
18
21
  t.libs += PROJ.libs
@@ -21,12 +24,20 @@ namespace :spec do
21
24
  if HAVE_RCOV
22
25
  desc 'Run all specs with RCov'
23
26
  Spec::Rake::SpecTask.new(:rcov) do |t|
27
+ t.ruby_opts = PROJ.ruby_opts
24
28
  t.spec_opts = PROJ.spec_opts
25
29
  t.spec_files = PROJ.specs
26
30
  t.libs += PROJ.libs
27
31
  t.rcov = true
32
+ t.rcov_dir = PROJ.rcov_dir
28
33
  t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
29
34
  end
35
+
36
+ RCov::VerifyTask.new(:verify) do |t|
37
+ t.threshold = PROJ.rcov_threshold
38
+ t.index_html = File.join(PROJ.rcov_dir, 'index.html')
39
+ t.require_exact_threshold = PROJ.rcov_threshold_exact
40
+ end
30
41
  end
31
42
 
32
43
  end # namespace :spec
@@ -6,7 +6,7 @@ namespace :test do
6
6
 
7
7
  Rake::TestTask.new(:run) do |t|
8
8
  t.libs = PROJ.libs
9
- t.test_files = if test ?f, PROJ.test_file then [PROJ.test_file]
9
+ t.test_files = if test(?f, PROJ.test_file) then [PROJ.test_file]
10
10
  else PROJ.tests end
11
11
  t.ruby_opts += PROJ.ruby_opts
12
12
  t.ruby_opts += PROJ.test_opts
@@ -15,14 +15,14 @@ namespace :test do
15
15
  if HAVE_RCOV
16
16
  desc 'Run rcov on the unit tests'
17
17
  task :rcov => :clobber_rcov do
18
- opts = PROJ.rcov_opts.join(' ')
19
- files = if test ?f, PROJ.test_file then [PROJ.test_file]
18
+ opts = PROJ.rcov_opts.dup << '-o' << PROJ.rcov_dir
19
+ opts = opts.join(' ')
20
+ files = if test(?f, PROJ.test_file) then [PROJ.test_file]
20
21
  else PROJ.tests end
21
22
  files = files.join(' ')
22
23
  sh "#{RCOV} #{files} #{opts}"
23
24
  end
24
25
 
25
- desc 'Remove rcov products'
26
26
  task :clobber_rcov do
27
27
  rm_r 'coverage' rescue nil
28
28
  end
@@ -35,6 +35,4 @@ task :test => 'test:run'
35
35
 
36
36
  task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
37
 
38
- remove_desc_for_task %w(test:clobber_rcov)
39
-
40
38
  # EOF
@@ -1,9 +1,9 @@
1
- # $Id: bones.rb 509 2008-02-08 17:17:53Z tim_pease $
1
+ # $Id: bones.rb 542 2008-02-20 00:03:45Z tim_pease $
2
2
 
3
3
  module Bones
4
4
 
5
5
  # :stopdoc:
6
- VERSION = '1.3.3'
6
+ VERSION = '1.3.4'
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'
@@ -1,4 +1,4 @@
1
- # $Id: main.rb 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id: main.rb 543 2008-02-20 04:36:46Z tim_pease $
2
2
 
3
3
  require 'fileutils'
4
4
  require 'optparse'
@@ -8,7 +8,7 @@ module Bones
8
8
  class Main
9
9
 
10
10
  attr_writer :update
11
- attr_accessor :name, :data, :verbose
11
+ attr_accessor :name, :data, :verbose, :output_dir
12
12
 
13
13
  # Create a new instance of Main, and run the +bones+ application given
14
14
  # the command line _args_.
@@ -38,6 +38,8 @@ class Main
38
38
  'update the rake tasks for the project') {self.update = true}
39
39
  opts.on('-v', '--verbose',
40
40
  'enable verbose output') {self.verbose = true}
41
+ opts.on('-d', '--directory DIRECTORY', String,
42
+ 'project directory to create') {|dir| self.output_dir = dir}
41
43
 
42
44
  opts.separator ''
43
45
  opts.on('--freeze', 'freeze the project skeleton') {freeze; exit}
@@ -67,6 +69,8 @@ class Main
67
69
  puts opts
68
70
  ::Kernel.abort
69
71
  end
72
+
73
+ self.output_dir = name if output_dir.nil?
70
74
  nil
71
75
  end
72
76
 
@@ -88,23 +92,28 @@ class Main
88
92
  #
89
93
  def create
90
94
  # see if the directory already exists
91
- abort "'#{name}' already exists" if test ?e, name
95
+ abort "'#{output_dir}' already exists" if test ?e, output_dir
92
96
 
93
97
  begin
94
98
  files_to_copy.each {|fn| cp fn}
95
99
 
96
100
  pwd = File.expand_path(FileUtils.pwd)
97
101
  begin
98
- FileUtils.cd name
102
+ FileUtils.cd output_dir
99
103
  system "rake manifest:create 2>&1 > #{::Bones::DEV_NULL}"
100
- STDOUT.puts "created '#{name}'\nnow you need to fix these files"
104
+ msg = "created '#{name}'"
105
+ msg << " in directory '#{output_dir}'" if name != output_dir
106
+ msg << "\nnow you need to fix these files"
107
+ STDOUT.puts msg
101
108
  system "rake notes"
102
109
  ensure
103
110
  FileUtils.cd pwd
104
111
  end
105
112
  rescue Exception => err
106
- FileUtils.rm_rf name
107
- abort "could not create '#{name}'"
113
+ FileUtils.rm_rf output_dir
114
+ msg = "could not create '#{name}'"
115
+ msg << " in directory '#{output_dir}'" if name != output_dir
116
+ abort msg
108
117
  end
109
118
  end
110
119
 
@@ -112,10 +121,10 @@ class Main
112
121
  # copy in new tasks from the bones/data directory.
113
122
  #
114
123
  def update
115
- abort "'#{name}' does not exist" unless test ?e, name
124
+ abort "'#{output_dir}' does not exist" unless test ?e, output_dir
116
125
 
117
- task_dir = File.join(name, 'tasks')
118
- abort "no tasks directory found in '#{name}'" unless test ?d, task_dir
126
+ task_dir = File.join(output_dir, 'tasks')
127
+ abort "no tasks directory found in '#{output_dir}'" unless test ?d, task_dir
119
128
 
120
129
  archive_dir = File.join(task_dir, 'archive')
121
130
  FileUtils.rm_rf archive_dir
@@ -131,7 +140,9 @@ class Main
131
140
  cp fn
132
141
  end
133
142
 
134
- STDOUT.puts "updated tasks for '#{name}'"
143
+ msg = "updated tasks for '#{name}'"
144
+ msg << " in directory '#{output_dir}'" if name != output_dir
145
+ STDOUT.puts msg
135
146
  end
136
147
 
137
148
  # Freeze the project skeleton to the current Mr Bones gem. If the project
@@ -211,7 +222,7 @@ class Main
211
222
  #
212
223
  def cp( file )
213
224
  dir = File.dirname(file).sub('NAME', name)
214
- dir = (dir == '.' ? name : File.join(name, dir))
225
+ dir = (dir == '.' ? output_dir : File.join(output_dir, dir))
215
226
  dst = File.join(dir, File.basename(file, '.erb').sub('NAME', name))
216
227
  src = File.join(data, file)
217
228
 
@@ -1,4 +1,4 @@
1
- # $Id: ann.rake 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  begin
4
4
  require 'bones/smtp_tls'
@@ -9,9 +9,9 @@ require 'time'
9
9
 
10
10
  namespace :ann do
11
11
 
12
- desc "Create an announcement file"
13
- task :announcement do
14
- File.open('announcement.txt','w') do |fd|
12
+ file PROJ.ann_file do
13
+ puts "Generating #{PROJ.ann_file}"
14
+ File.open(PROJ.ann_file,'w') do |fd|
15
15
  fd.puts("#{PROJ.name} version #{PROJ.version}")
16
16
  fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
17
17
  fd.puts(" #{PROJ.url}") if PROJ.url
@@ -26,15 +26,18 @@ namespace :ann do
26
26
  PROJ.ann_paragraphs.each do |p|
27
27
  fd.puts "== #{p.upcase}"
28
28
  fd.puts
29
- fd.puts paragraphs_of('README.txt', p).join("\n\n")
29
+ fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
30
30
  fd.puts
31
31
  end
32
32
  fd.puts PROJ.ann_text if PROJ.ann_text
33
33
  end
34
34
  end
35
35
 
36
- desc "Send email announcement"
37
- task :email => :announcement do
36
+ desc "Create an announcement file"
37
+ task :announcement => PROJ.ann_file
38
+
39
+ desc "Send an email announcement"
40
+ task :email => PROJ.ann_file do
38
41
  from = PROJ.ann_email[:from] || PROJ.email
39
42
  to = Array(PROJ.ann_email[:to])
40
43
 
@@ -47,7 +50,7 @@ namespace :ann do
47
50
  rfc822msg << "Date: #{Time.new.rfc822}\n"
48
51
  rfc822msg << "Message-Id: "
49
52
  rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{PROJ.ann_email[:domain]}>\n\n"
50
- rfc822msg << File.read('announcement.txt')
53
+ rfc822msg << File.read(PROJ.ann_file)
51
54
 
52
55
  params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
53
56
  PROJ.ann_email[key]
@@ -63,15 +66,11 @@ namespace :ann do
63
66
  ### send email
64
67
  Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
65
68
  end
66
-
67
- task :clobber_announcement do
68
- rm 'announcement.txt' rescue nil
69
- end
70
69
  end # namespace :ann
71
70
 
72
71
  desc 'Alias to ann:announcement'
73
72
  task :ann => 'ann:announcement'
74
73
 
75
- task :clobber => %w(ann:clobber_announcement)
74
+ CLOBBER << PROJ.ann_file
76
75
 
77
76
  # EOF
@@ -31,7 +31,6 @@ namespace :doc do
31
31
  sh "#{RDOC} --ri -o ri ."
32
32
  end
33
33
 
34
- desc 'Remove ri products'
35
34
  task :clobber_ri do
36
35
  rm_r 'ri' rescue nil
37
36
  end
@@ -44,6 +43,6 @@ task :doc => 'doc:rdoc'
44
43
  desc 'Remove all build products'
45
44
  task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
46
45
 
47
- remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
46
+ remove_desc_for_task %w(doc:clobber_rdoc)
48
47
 
49
48
  # EOF
@@ -1,4 +1,4 @@
1
- # $Id: gem.rake 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/gempackagetask'
4
4
 
@@ -1,4 +1,4 @@
1
- # $Id: manifest.rake 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'find'
4
4
 
@@ -6,11 +6,11 @@ namespace :manifest do
6
6
 
7
7
  desc 'Verify the manifest'
8
8
  task :check do
9
- fn = 'Manifest.tmp'
9
+ fn = PROJ.manifest_file + '.tmp'
10
10
  files = manifest_files
11
11
 
12
12
  File.open(fn, 'w') {|fp| fp.puts files}
13
- lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
13
+ lines = %x(#{DIFF} -du #{PROJ.manifest_file} #{fn}).split("\n")
14
14
  if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
15
15
  lines.map! do |line|
16
16
  case line
@@ -27,19 +27,18 @@ namespace :manifest do
27
27
 
28
28
  desc 'Create a new manifest'
29
29
  task :create do
30
- fn = 'Manifest.txt'
31
30
  files = manifest_files
32
- unless test(?f, fn)
33
- files << fn
31
+ unless test(?f, PROJ.manifest_file)
32
+ files << PROJ.manifest_file
34
33
  files.sort!
35
34
  end
36
- File.open(fn, 'w') {|fp| fp.puts files}
35
+ File.open(PROJ.manifest_file, 'w') {|fp| fp.puts files}
37
36
  end
38
37
 
39
38
  task :assert do
40
39
  files = manifest_files
41
- manifest = File.read('Manifest.txt').split($/)
42
- raise RuntimeError, "manifest is out of date" unless files == manifest
40
+ manifest = File.read(PROJ.manifest_file).split($/)
41
+ raise "ERROR: #{PROJ.manifest_file} is out of date" unless files == manifest
43
42
  end
44
43
 
45
44
  end # namespace :manifest
@@ -3,16 +3,24 @@
3
3
  # This file does not define any rake tasks. It is used to load some project
4
4
  # settings if they are not defined by the user.
5
5
 
6
- unless PROJ.changes
7
- PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
8
- end
6
+ PROJ.rdoc_exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
7
+ PROJ.exclude << "^#{Regexp.escape(PROJ.ann_file)}$"
9
8
 
10
- unless PROJ.description
11
- PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
12
- end
9
+ PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
13
10
 
14
- unless PROJ.summary
15
- PROJ.summary = PROJ.description.split('.').first
16
- end
11
+ PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
12
+
13
+ PROJ.summary ||= PROJ.description.split('.').first
14
+
15
+ PROJ.files ||=
16
+ if test(?f, PROJ.manifest_file)
17
+ files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
18
+ files.delete ''
19
+ files
20
+ else [] end
21
+
22
+ PROJ.executables ||= PROJ.files.find_all {|fn| fn =~ %r/^bin/}
23
+
24
+ PROJ.rdoc_main ||= PROJ.readme_file
17
25
 
18
26
  # EOF
@@ -1,7 +1,8 @@
1
- # $Id: setup.rb 536 2008-02-18 23:07:49Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
5
+ require 'rake/clean'
5
6
  require 'fileutils'
6
7
  require 'ostruct'
7
8
 
@@ -16,8 +17,11 @@ PROJ.email = nil
16
17
  PROJ.url = nil
17
18
  PROJ.version = ENV['VERSION'] || '0.0.0'
18
19
  PROJ.rubyforge_name = nil
19
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ announcement.txt)
20
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/)
20
21
  PROJ.release_name = ENV['RELEASE']
22
+ PROJ.history_file = 'History.txt'
23
+ PROJ.manifest_file = 'Manifest.txt'
24
+ PROJ.readme_file = 'README.txt'
21
25
 
22
26
  # Rspec
23
27
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -29,13 +33,16 @@ PROJ.test_file = 'test/all.rb'
29
33
  PROJ.test_opts = []
30
34
 
31
35
  # Rcov
36
+ PROJ.rcov_dir = 'coverage'
32
37
  PROJ.rcov_opts = ['--sort', 'coverage', '-T']
38
+ PROJ.rcov_threshold = 90.0
39
+ PROJ.rcov_threshold_exact = false
33
40
 
34
41
  # Rdoc
35
42
  PROJ.rdoc_opts = []
36
43
  PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
37
- PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
38
- PROJ.rdoc_main = 'README.txt'
44
+ PROJ.rdoc_exclude = %w(extconf.rb$)
45
+ PROJ.rdoc_main = nil
39
46
  PROJ.rdoc_dir = 'doc'
40
47
  PROJ.rdoc_remote_dir = nil
41
48
 
@@ -46,13 +53,8 @@ PROJ.libs = []
46
53
  %w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
47
54
 
48
55
  # Gem Packaging
49
- PROJ.files =
50
- if test ?f, 'Manifest.txt'
51
- files = File.readlines('Manifest.txt').map {|fn| fn.chomp.strip}
52
- files.delete ''
53
- files
54
- else [] end
55
- PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
56
+ PROJ.files = nil
57
+ PROJ.executables = nil
56
58
  PROJ.dependencies = []
57
59
  PROJ.need_tar = true
58
60
  PROJ.need_zip = false
@@ -71,6 +73,7 @@ PROJ.svn_tags = 'tags'
71
73
  PROJ.svn_branches = 'branches'
72
74
 
73
75
  # Announce
76
+ PROJ.ann_file = 'announcement.txt'
74
77
  PROJ.ann_text = nil
75
78
  PROJ.ann_paragraphs = []
76
79
  PROJ.ann_email = {
@@ -166,7 +169,10 @@ def depend_on( name, version = nil )
166
169
  spec = Gem.source_index.find_name(name).last
167
170
  version = spec.version.to_s if version.nil? and !spec.nil?
168
171
 
169
- PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
172
+ PROJ.dependencies << case version
173
+ when nil; [name]
174
+ when %r/^\d/; [name, ">= #{version}"]
175
+ else [name, version] end
170
176
  end
171
177
 
172
178
  # Adds the given arguments to the include path if they are not already there
@@ -1,11 +1,13 @@
1
1
  # $Id$
2
2
 
3
3
  if HAVE_SPEC_RAKE_SPECTASK
4
+ require 'spec/rake/verify_rcov'
4
5
 
5
6
  namespace :spec do
6
7
 
7
8
  desc 'Run all specs with basic output'
8
9
  Spec::Rake::SpecTask.new(:run) do |t|
10
+ t.ruby_opts = PROJ.ruby_opts
9
11
  t.spec_opts = PROJ.spec_opts
10
12
  t.spec_files = PROJ.specs
11
13
  t.libs += PROJ.libs
@@ -13,6 +15,7 @@ namespace :spec do
13
15
 
14
16
  desc 'Run all specs with text output'
15
17
  Spec::Rake::SpecTask.new(:specdoc) do |t|
18
+ t.ruby_opts = PROJ.ruby_opts
16
19
  t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
17
20
  t.spec_files = PROJ.specs
18
21
  t.libs += PROJ.libs
@@ -21,12 +24,20 @@ namespace :spec do
21
24
  if HAVE_RCOV
22
25
  desc 'Run all specs with RCov'
23
26
  Spec::Rake::SpecTask.new(:rcov) do |t|
27
+ t.ruby_opts = PROJ.ruby_opts
24
28
  t.spec_opts = PROJ.spec_opts
25
29
  t.spec_files = PROJ.specs
26
30
  t.libs += PROJ.libs
27
31
  t.rcov = true
32
+ t.rcov_dir = PROJ.rcov_dir
28
33
  t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
29
34
  end
35
+
36
+ RCov::VerifyTask.new(:verify) do |t|
37
+ t.threshold = PROJ.rcov_threshold
38
+ t.index_html = File.join(PROJ.rcov_dir, 'index.html')
39
+ t.require_exact_threshold = PROJ.rcov_threshold_exact
40
+ end
30
41
  end
31
42
 
32
43
  end # namespace :spec
@@ -6,7 +6,7 @@ namespace :test do
6
6
 
7
7
  Rake::TestTask.new(:run) do |t|
8
8
  t.libs = PROJ.libs
9
- t.test_files = if test ?f, PROJ.test_file then [PROJ.test_file]
9
+ t.test_files = if test(?f, PROJ.test_file) then [PROJ.test_file]
10
10
  else PROJ.tests end
11
11
  t.ruby_opts += PROJ.ruby_opts
12
12
  t.ruby_opts += PROJ.test_opts
@@ -15,14 +15,14 @@ namespace :test do
15
15
  if HAVE_RCOV
16
16
  desc 'Run rcov on the unit tests'
17
17
  task :rcov => :clobber_rcov do
18
- opts = PROJ.rcov_opts.join(' ')
19
- files = if test ?f, PROJ.test_file then [PROJ.test_file]
18
+ opts = PROJ.rcov_opts.dup << '-o' << PROJ.rcov_dir
19
+ opts = opts.join(' ')
20
+ files = if test(?f, PROJ.test_file) then [PROJ.test_file]
20
21
  else PROJ.tests end
21
22
  files = files.join(' ')
22
23
  sh "#{RCOV} #{files} #{opts}"
23
24
  end
24
25
 
25
- desc 'Remove rcov products'
26
26
  task :clobber_rcov do
27
27
  rm_r 'coverage' rescue nil
28
28
  end
@@ -35,6 +35,4 @@ task :test => 'test:run'
35
35
 
36
36
  task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
37
 
38
- remove_desc_for_task %w(test:clobber_rcov)
39
-
40
38
  # 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.3
4
+ version: 1.3.4
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-18 00:00:00 -07:00
12
+ date: 2008-02-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15