bones 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,20 @@
1
- == 1.3.0 /
1
+ == 1.3.1 / 2008-02-01
2
+
3
+ * 4 minor enhancements
4
+ - Updated the "ensure_in_path" method to take more than one path
5
+ - Added an "in_directory" method for executing shell tasks in a
6
+ different directory
7
+ - Fleshed out a spec_helper and a better default project spec file
8
+ - By default the project changes, description, and summary will be
9
+ loaded from the History and README files
10
+ * 3 bug fixes
11
+ - RSpec tasks were not including the user defined project libraries
12
+ such as "ext" or anything besides "lib"
13
+ - Tweaked the gem install/uninstall tasks to remove installed binaries
14
+ and to install paltform specific gem versions
15
+ - Fixed a bug where the RDoc task was ignore the PROJ.rdoc_opts
16
+
17
+ == 1.3.0 / 2008-01-04
2
18
 
3
19
  * 2 minor enhancements
4
20
  - Added a few more methods to the default framework
@@ -9,11 +9,13 @@ data/README.txt.erb
9
9
  data/Rakefile.erb
10
10
  data/bin/NAME.erb
11
11
  data/lib/NAME.rb.erb
12
- data/spec/NAME_spec.rb
12
+ data/spec/NAME_spec.rb.erb
13
+ data/spec/spec_helper.rb.erb
13
14
  data/tasks/annotations.rake
14
15
  data/tasks/doc.rake
15
16
  data/tasks/gem.rake
16
17
  data/tasks/manifest.rake
18
+ data/tasks/post_load.rake
17
19
  data/tasks/rubyforge.rake
18
20
  data/tasks/setup.rb
19
21
  data/tasks/spec.rake
@@ -27,6 +29,7 @@ tasks/annotations.rake
27
29
  tasks/doc.rake
28
30
  tasks/gem.rake
29
31
  tasks/manifest.rake
32
+ tasks/post_load.rake
30
33
  tasks/rubyforge.rake
31
34
  tasks/setup.rb
32
35
  tasks/spec.rake
data/README.txt CHANGED
@@ -3,7 +3,7 @@ Mr Bones
3
3
  http://codeforpeople.rubyforge.org/bones
4
4
 
5
5
  == DESCRIPTION:
6
-
6
+
7
7
  Mr Bones is a handy tool that builds a skeleton for your new Ruby projects.
8
8
  The skeleton contains some starter code and a collection of rake tasks to
9
9
  ease the management and deployment of your source code. Mr Bones is not
@@ -28,6 +28,7 @@ Mr Bones provides the following rake tasks:
28
28
  gem:release # Package and upload to RubyForge
29
29
  gem:repackage # Force a rebuild of the package files
30
30
  gem:uninstall # Uninstall the gem
31
+ manifest # Alias to manifest:check
31
32
  manifest:check # Verify the manifest
32
33
  manifest:create # Create a new manifest
33
34
  notes # Enumerate all annotations
@@ -180,7 +181,7 @@ name and the derived class name into template files. The file must end in an
180
181
  ".erb" suffix for ERB substitutions to take place. The ".erb" suffix is
181
182
  stripped from the file during project generation. Therefore, your ERB files
182
183
  should have two suffixes -- the ".erb" suffix that will be stripped, and the
183
- suffix you want the resulting project file to have.
184
+ suffix you want the resulting project file to have.
184
185
 
185
186
  Only two values can be substituted into files using ERB -- the project name and
186
187
  the derived class name.
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: Rakefile 460 2008-01-04 20:53:46Z tim_pease $
1
+ # $Id: Rakefile 489 2008-02-01 17:32:57Z tim_pease $
2
2
 
3
3
  $:.unshift('lib')
4
4
 
@@ -8,12 +8,9 @@ require 'bones'
8
8
  task :default => 'spec:run'
9
9
 
10
10
  PROJ.name = 'bones'
11
- PROJ.summary = 'Mr Bones is a handy tool that builds a skeleton for your new Ruby projects'
12
11
  PROJ.authors = 'Tim Pease'
13
12
  PROJ.email = 'tim.pease@gmail.com'
14
13
  PROJ.url = 'http://codeforpeople.rubyforge.org/bones'
15
- PROJ.description = paragraphs_of('README.txt', 1).join("\n\n")
16
- PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
17
14
  PROJ.rubyforge_name = 'codeforpeople'
18
15
  PROJ.rdoc_remote_dir = 'bones'
19
16
  PROJ.version = Bones::VERSION
@@ -3,11 +3,11 @@
3
3
  FIXME (url)
4
4
 
5
5
  == DESCRIPTION:
6
-
6
+
7
7
  FIXME (describe your package)
8
8
 
9
9
  == FEATURES/PROBLEMS:
10
-
10
+
11
11
  * FIXME (list of features or problems)
12
12
 
13
13
  == SYNOPSIS:
@@ -10,12 +10,9 @@ require '<%= name %>'
10
10
  task :default => 'spec:run'
11
11
 
12
12
  PROJ.name = '<%= name %>'
13
- PROJ.summary = 'FIXME (summary of your project)'
14
13
  PROJ.authors = 'FIXME (who is writing this software)'
15
14
  PROJ.email = 'FIXME (your e-mail)'
16
15
  PROJ.url = 'FIXME (project homepage)'
17
- PROJ.description = paragraphs_of('README.txt', 1).join("\n\n")
18
- PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
19
16
  PROJ.rubyforge_name = '<%= name %>'
20
17
 
21
18
  PROJ.spec_opts << '--color'
@@ -0,0 +1,8 @@
1
+ # $Id$
2
+
3
+ require File.join(File.dirname(__FILE__), %w[spec_helper])
4
+
5
+ describe <%= classname %> do
6
+ end
7
+
8
+ # EOF
@@ -0,0 +1,17 @@
1
+ # $Id$
2
+
3
+ require File.expand_path(
4
+ File.join(File.dirname(__FILE__), %w[.. lib <%= name %>]))
5
+
6
+ Spec::Runner.configure do |config|
7
+ # == Mock Framework
8
+ #
9
+ # RSpec uses it's own mocking framework by default. If you prefer to
10
+ # use mocha, flexmock or RR, uncomment the appropriate line:
11
+ #
12
+ # config.mock_with :mocha
13
+ # config.mock_with :flexmock
14
+ # config.mock_with :rr
15
+ end
16
+
17
+ # EOF
@@ -7,7 +7,6 @@ namespace :doc do
7
7
  desc 'Generate RDoc documentation'
8
8
  Rake::RDocTask.new do |rd|
9
9
  rd.main = PROJ.rdoc_main
10
- rd.options << '-d' if !WIN32 and `which dot` =~ %r/\/dot/
11
10
  rd.rdoc_dir = PROJ.rdoc_dir
12
11
 
13
12
  incl = Regexp.new(PROJ.rdoc_include.join('|'))
@@ -24,6 +23,7 @@ namespace :doc do
24
23
  title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
25
24
 
26
25
  rd.options << "-t #{title}"
26
+ rd.options.concat(PROJ.rdoc_opts)
27
27
  end
28
28
 
29
29
  desc 'Generate ri locally for testing'
@@ -69,12 +69,12 @@ namespace :gem do
69
69
 
70
70
  desc 'Install the gem'
71
71
  task :install => [:clobber, :package] do
72
- sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.file_name}"
72
+ sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.full_name}"
73
73
  end
74
74
 
75
75
  desc 'Uninstall the gem'
76
76
  task :uninstall do
77
- sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' #{PROJ.name}"
77
+ sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' -x #{PROJ.name}"
78
78
  end
79
79
 
80
80
  end # namespace :gem
@@ -36,6 +36,9 @@ namespace :manifest do
36
36
  files << fn unless test ?f, fn
37
37
  File.open(fn, 'w') {|fp| fp.puts files.sort}
38
38
  end
39
- end
39
+ end # namespace :manifest
40
+
41
+ desc 'Alias to manifest:check'
42
+ task :manifest => 'manifest:check'
40
43
 
41
44
  # EOF
@@ -0,0 +1,18 @@
1
+ # $Id$
2
+
3
+ # This file does not define any rake tasks. It is used to load some project
4
+ # settings if they are not defined by the user.
5
+
6
+ unless PROJ.changes
7
+ PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
8
+ end
9
+
10
+ unless PROJ.description
11
+ PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
12
+ end
13
+
14
+ unless PROJ.summary
15
+ PROJ.summary = PROJ.description.split('.').first
16
+ end
17
+
18
+ # EOF
@@ -68,7 +68,9 @@ PROJ.svn_tags = 'tags'
68
68
  PROJ.svn_branches = 'branches'
69
69
 
70
70
  # Load the other rake files in the tasks folder
71
- Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
71
+ rakefiles = Dir.glob('tasks/*.rake').sort
72
+ rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
73
+ import(*rakefiles)
72
74
 
73
75
  # Setup some constants
74
76
  WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
@@ -115,8 +117,28 @@ end
115
117
  # changes = paragraphs_of('History.txt', 0..1).join("\n\n")
116
118
  # summary, *description = paragraphs_of('README.txt', 3, 3..8)
117
119
  #
118
- def paragraphs_of(path, *paragraphs)
119
- File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
120
+ def paragraphs_of( path, *paragraphs )
121
+ title = String === paragraphs.first ? paragraphs.shift : nil
122
+ ary = File.read(path).delete("\r").split(/\n\n+/)
123
+
124
+ result = if title
125
+ tmp, matching = [], false
126
+ rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
127
+ paragraphs << (0..-1) if paragraphs.empty?
128
+
129
+ ary.each do |val|
130
+ if val =~ rgxp
131
+ break if matching
132
+ matching = true
133
+ rgxp = %r/^=+/i
134
+ elsif matching
135
+ tmp << val
136
+ end
137
+ end
138
+ tmp
139
+ else ary end
140
+
141
+ result.values_at(*paragraphs)
120
142
  end
121
143
 
122
144
  # Adds the given gem _name_ to the current project's dependency list. An
@@ -130,11 +152,13 @@ def depend_on( name, version = nil )
130
152
  PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
131
153
  end
132
154
 
133
- # Adds the given _path_ to the include path if it is not already there
155
+ # Adds the given arguments to the include path if they are not already there
134
156
  #
135
- def ensure_in_path( path )
136
- path = File.expand_path(path)
137
- $:.unshift(path) if test(?d, path) and not $:.include?(path)
157
+ def ensure_in_path( *args )
158
+ args.each do |path|
159
+ path = File.expand_path(path)
160
+ $:.unshift(path) if test(?d, path) and not $:.include?(path)
161
+ end
138
162
  end
139
163
 
140
164
  # Find a rake task using the task name and remove any description text. This
@@ -148,4 +172,18 @@ def remove_desc_for_task( names )
148
172
  end
149
173
  end
150
174
 
175
+ # Change working directories to _dir_, call the _block_ of code, and then
176
+ # change back to the original working directory (the current directory when
177
+ # this method was called).
178
+ #
179
+ def in_directory( dir, &block )
180
+ curdir = pwd
181
+ begin
182
+ cd dir
183
+ return block.call
184
+ ensure
185
+ cd curdir
186
+ end
187
+ end
188
+
151
189
  # EOF
@@ -8,12 +8,14 @@ namespace :spec do
8
8
  Spec::Rake::SpecTask.new(:run) do |t|
9
9
  t.spec_opts = PROJ.spec_opts
10
10
  t.spec_files = PROJ.specs
11
+ t.libs += PROJ.libs
11
12
  end
12
13
 
13
14
  desc 'Run all specs with text output'
14
15
  Spec::Rake::SpecTask.new(:specdoc) do |t|
15
16
  t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
16
17
  t.spec_files = PROJ.specs
18
+ t.libs += PROJ.libs
17
19
  end
18
20
 
19
21
  if HAVE_RCOV
@@ -21,6 +23,7 @@ namespace :spec do
21
23
  Spec::Rake::SpecTask.new(:rcov) do |t|
22
24
  t.spec_opts = PROJ.spec_opts
23
25
  t.spec_files = PROJ.specs
26
+ t.libs += PROJ.libs
24
27
  t.rcov = true
25
28
  t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
26
29
  end
@@ -1,9 +1,9 @@
1
- # $Id: bones.rb 449 2008-01-04 17:54:36Z tim_pease $
1
+ # $Id: bones.rb 483 2008-01-24 18:46:49Z tim_pease $
2
2
 
3
3
  module Bones
4
4
 
5
5
  # :stopdoc:
6
- VERSION = '1.3.0'
6
+ VERSION = '1.3.1'
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'
@@ -25,6 +25,10 @@ module Bones
25
25
  Dir.glob(search_me).sort.each {|rb| require rb}
26
26
  end
27
27
 
28
+ # TODO: fix file lists for Test::Unit and RSpec
29
+ # these guys are just grabbing whatever is there and not pulling
30
+ # the filenames from the manifest
31
+
28
32
  end # module Bones
29
33
 
30
34
 
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: doc.rake 486 2008-01-27 04:14:41Z tim_pease $
2
2
 
3
3
  require 'rake/rdoctask'
4
4
 
@@ -7,7 +7,6 @@ namespace :doc do
7
7
  desc 'Generate RDoc documentation'
8
8
  Rake::RDocTask.new do |rd|
9
9
  rd.main = PROJ.rdoc_main
10
- rd.options << '-d' if !WIN32 and `which dot` =~ %r/\/dot/
11
10
  rd.rdoc_dir = PROJ.rdoc_dir
12
11
 
13
12
  incl = Regexp.new(PROJ.rdoc_include.join('|'))
@@ -24,6 +23,7 @@ namespace :doc do
24
23
  title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
25
24
 
26
25
  rd.options << "-t #{title}"
26
+ rd.options.concat(PROJ.rdoc_opts)
27
27
  end
28
28
 
29
29
  desc 'Generate ri locally for testing'
@@ -69,12 +69,12 @@ namespace :gem do
69
69
 
70
70
  desc 'Install the gem'
71
71
  task :install => [:clobber, :package] do
72
- sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.file_name}"
72
+ sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.full_name}"
73
73
  end
74
74
 
75
75
  desc 'Uninstall the gem'
76
76
  task :uninstall do
77
- sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' #{PROJ.name}"
77
+ sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' -x #{PROJ.name}"
78
78
  end
79
79
 
80
80
  end # namespace :gem
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: manifest.rake 489 2008-02-01 17:32:57Z tim_pease $
2
2
 
3
3
  require 'find'
4
4
 
@@ -36,6 +36,9 @@ namespace :manifest do
36
36
  files << fn unless test ?f, fn
37
37
  File.open(fn, 'w') {|fp| fp.puts files.sort}
38
38
  end
39
- end
39
+ end # namespace :manifest
40
+
41
+ desc 'Alias to manifest:check'
42
+ task :manifest => 'manifest:check'
40
43
 
41
44
  # EOF
@@ -0,0 +1,18 @@
1
+ # $Id: post_load.rake 497 2008-02-01 18:19:50Z tim_pease $
2
+
3
+ # This file does not define any rake tasks. It is used to load some project
4
+ # settings if they are not defined by the user.
5
+
6
+ unless PROJ.changes
7
+ PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
8
+ end
9
+
10
+ unless PROJ.description
11
+ PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
12
+ end
13
+
14
+ unless PROJ.summary
15
+ PROJ.summary = PROJ.description.split('.').first
16
+ end
17
+
18
+ # EOF
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: setup.rb 497 2008-02-01 18:19:50Z tim_pease $
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
@@ -68,7 +68,9 @@ PROJ.svn_tags = 'tags'
68
68
  PROJ.svn_branches = 'branches'
69
69
 
70
70
  # Load the other rake files in the tasks folder
71
- Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
71
+ rakefiles = Dir.glob('tasks/*.rake').sort
72
+ rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
73
+ import(*rakefiles)
72
74
 
73
75
  # Setup some constants
74
76
  WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
@@ -115,8 +117,28 @@ end
115
117
  # changes = paragraphs_of('History.txt', 0..1).join("\n\n")
116
118
  # summary, *description = paragraphs_of('README.txt', 3, 3..8)
117
119
  #
118
- def paragraphs_of(path, *paragraphs)
119
- File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
120
+ def paragraphs_of( path, *paragraphs )
121
+ title = String === paragraphs.first ? paragraphs.shift : nil
122
+ ary = File.read(path).delete("\r").split(/\n\n+/)
123
+
124
+ result = if title
125
+ tmp, matching = [], false
126
+ rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
127
+ paragraphs << (0..-1) if paragraphs.empty?
128
+
129
+ ary.each do |val|
130
+ if val =~ rgxp
131
+ break if matching
132
+ matching = true
133
+ rgxp = %r/^=+/i
134
+ elsif matching
135
+ tmp << val
136
+ end
137
+ end
138
+ tmp
139
+ else ary end
140
+
141
+ result.values_at(*paragraphs)
120
142
  end
121
143
 
122
144
  # Adds the given gem _name_ to the current project's dependency list. An
@@ -130,11 +152,13 @@ def depend_on( name, version = nil )
130
152
  PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
131
153
  end
132
154
 
133
- # Adds the given _path_ to the include path if it is not already there
155
+ # Adds the given arguments to the include path if they are not already there
134
156
  #
135
- def ensure_in_path( path )
136
- path = File.expand_path(path)
137
- $:.unshift(path) if test(?d, path) and not $:.include?(path)
157
+ def ensure_in_path( *args )
158
+ args.each do |path|
159
+ path = File.expand_path(path)
160
+ $:.unshift(path) if test(?d, path) and not $:.include?(path)
161
+ end
138
162
  end
139
163
 
140
164
  # Find a rake task using the task name and remove any description text. This
@@ -148,4 +172,18 @@ def remove_desc_for_task( names )
148
172
  end
149
173
  end
150
174
 
175
+ # Change working directories to _dir_, call the _block_ of code, and then
176
+ # change back to the original working directory (the current directory when
177
+ # this method was called).
178
+ #
179
+ def in_directory( dir, &block )
180
+ curdir = pwd
181
+ begin
182
+ cd dir
183
+ return block.call
184
+ ensure
185
+ cd curdir
186
+ end
187
+ end
188
+
151
189
  # EOF
@@ -1,4 +1,4 @@
1
- # $Id: spec.rake 461 2008-01-04 20:55:37Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  if HAVE_SPEC_RAKE_SPECTASK
4
4
 
@@ -8,12 +8,14 @@ namespace :spec do
8
8
  Spec::Rake::SpecTask.new(:run) do |t|
9
9
  t.spec_opts = PROJ.spec_opts
10
10
  t.spec_files = PROJ.specs
11
+ t.libs += PROJ.libs
11
12
  end
12
13
 
13
14
  desc 'Run all specs with text output'
14
15
  Spec::Rake::SpecTask.new(:specdoc) do |t|
15
16
  t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
16
17
  t.spec_files = PROJ.specs
18
+ t.libs += PROJ.libs
17
19
  end
18
20
 
19
21
  if HAVE_RCOV
@@ -21,6 +23,7 @@ namespace :spec do
21
23
  Spec::Rake::SpecTask.new(:rcov) do |t|
22
24
  t.spec_opts = PROJ.spec_opts
23
25
  t.spec_files = PROJ.specs
26
+ t.libs += PROJ.libs
24
27
  t.rcov = true
25
28
  t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
26
29
  end
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.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-04 00:00:00 -07:00
12
+ date: 2008-02-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: "== DESCRIPTION: Mr Bones is a handy tool that builds a skeleton for your new Ruby projects. The skeleton contains some starter code and a collection of rake tasks to ease the management and deployment of your source code. Mr Bones is not viral -- all the code your project needs is included in the skeleton (no gem dependency required)."
16
+ description: Mr Bones is a handy tool that builds a skeleton for your new Ruby projects. The skeleton contains some starter code and a collection of rake tasks to ease the management and deployment of your source code. Mr Bones is not viral -- all the code your project needs is included in the skeleton (no gem dependency required).
17
17
  email: tim.pease@gmail.com
18
18
  executables:
19
19
  - bones
@@ -35,11 +35,13 @@ files:
35
35
  - data/Rakefile.erb
36
36
  - data/bin/NAME.erb
37
37
  - data/lib/NAME.rb.erb
38
- - data/spec/NAME_spec.rb
38
+ - data/spec/NAME_spec.rb.erb
39
+ - data/spec/spec_helper.rb.erb
39
40
  - data/tasks/annotations.rake
40
41
  - data/tasks/doc.rake
41
42
  - data/tasks/gem.rake
42
43
  - data/tasks/manifest.rake
44
+ - data/tasks/post_load.rake
43
45
  - data/tasks/rubyforge.rake
44
46
  - data/tasks/setup.rb
45
47
  - data/tasks/spec.rake
@@ -53,6 +55,7 @@ files:
53
55
  - tasks/doc.rake
54
56
  - tasks/gem.rake
55
57
  - tasks/manifest.rake
58
+ - tasks/post_load.rake
56
59
  - tasks/rubyforge.rake
57
60
  - tasks/setup.rb
58
61
  - tasks/spec.rake
File without changes