bones 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,13 @@
1
- == 1.2.1 /
1
+ == 1.3.0 /
2
+
3
+ * 2 minor enhancements
4
+ - Added a few more methods to the default framework
5
+ - Added tasks to support tagging releases in SVN
6
+ * 1 bug fix
7
+ - Fixed a nil value error for the remote rdoc directory
8
+ (patch supplied by Chris Shea)
9
+
10
+ == 1.2.1 / 2008-01-02
2
11
 
3
12
  * 2 bug fixes
4
13
  - With no arguments, the bones command was not showing the help message
data/Manifest.txt CHANGED
@@ -17,6 +17,7 @@ data/tasks/manifest.rake
17
17
  data/tasks/rubyforge.rake
18
18
  data/tasks/setup.rb
19
19
  data/tasks/spec.rake
20
+ data/tasks/svn.rake
20
21
  data/tasks/test.rake
21
22
  data/test/test_NAME.rb
22
23
  lib/bones.rb
@@ -29,4 +30,5 @@ tasks/manifest.rake
29
30
  tasks/rubyforge.rake
30
31
  tasks/setup.rb
31
32
  tasks/spec.rake
33
+ tasks/svn.rake
32
34
  tasks/test.rake
data/README.txt CHANGED
@@ -22,7 +22,7 @@ Mr Bones provides the following rake tasks:
22
22
  doc:ri # Generate ri locally for testing
23
23
  gem # Alias to gem:package
24
24
  gem:debug # Show information about the gem
25
- gem:gem # Build the gem file bones-1.2.0.gem
25
+ gem:gem # Build the gem file bones-1.3.0.gem
26
26
  gem:install # Install the gem
27
27
  gem:package # Build all the packages
28
28
  gem:release # Package and upload to RubyForge
@@ -38,6 +38,8 @@ Mr Bones provides the following rake tasks:
38
38
  spec:rcov # Run all specs with RCov
39
39
  spec:run # Run all specs with basic output
40
40
  spec:specdoc # Run all specs with text output
41
+ svn:create_tag # Create a new tag in the SVN repository
42
+ svn:show_tags # Show tags from the SVN repository
41
43
  test # Alias to test:run
42
44
  test:rcov # Run rcov on the unit tests
43
45
  test:run # Run tests for run
@@ -99,8 +101,9 @@ the Rakefile for the Mr Bones gem itself:
99
101
  PROJ.rdoc_remote_dir = 'bones'
100
102
  PROJ.version = Bones::VERSION
101
103
 
102
- PROJ.exclude << '^doc'
103
104
  PROJ.rdoc_exclude << '^data'
105
+ PROJ.annotation_exclude = %w(^README\.txt$ ^data/)
106
+ PROJ.svn = 'bones'
104
107
 
105
108
  PROJ.spec_opts << '--color'
106
109
 
@@ -123,8 +126,8 @@ directories, backup files, or anything else you don't want gumming up the
123
126
  works. The files to exclude are given as an array of regular expression
124
127
  patterns; a file is excluded if it matches any of the patterns.
125
128
 
126
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg)
127
- PROJ.exclude << '^doc'
129
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg ^doc)
130
+ PROJ.exclude << '^tags$'
128
131
 
129
132
  If your project depends on other gems, use the +depend_on+ command in your
130
133
  Rakefile to declare the dependency. If you do not specify a version, the
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: Rakefile 460 2008-01-04 20:53:46Z tim_pease $
2
2
 
3
3
  $:.unshift('lib')
4
4
 
@@ -18,8 +18,9 @@ PROJ.rubyforge_name = 'codeforpeople'
18
18
  PROJ.rdoc_remote_dir = 'bones'
19
19
  PROJ.version = Bones::VERSION
20
20
 
21
- PROJ.rdoc_exclude << '^data'
22
- PROJ.annotation_exclude = %w(^README\.txt$ ^data\/)
21
+ PROJ.rdoc_exclude << '^data/'
22
+ PROJ.annotation_exclude = %w(^README\.txt$ ^data/)
23
+ PROJ.svn = 'bones'
23
24
 
24
25
  PROJ.spec_opts << '--color'
25
26
 
data/data/lib/NAME.rb.erb CHANGED
@@ -1,7 +1,56 @@
1
1
  # $Id$
2
2
 
3
- class <%= classname %>
3
+ # Equivalent to a header guard in C/C++
4
+ # Used to prevent the class/module from being loaded more than once
5
+ unless defined? <%= classname %>
6
+
7
+ module <%= classname %>
8
+
9
+ # :stopdoc:
4
10
  VERSION = '1.0.0'
5
- end
11
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
12
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
13
+ # :startdoc:
14
+
15
+ # Returns the version string for the library.
16
+ #
17
+ def self.version
18
+ VERSION
19
+ end
20
+
21
+ # Returns the library path for the module. If any arguments are given,
22
+ # they will be joined to the end of the libray path using
23
+ # <tt>File.join</tt>.
24
+ #
25
+ def self.libpath( *args )
26
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, *args)
27
+ end
28
+
29
+ # Returns the lpath for the module. If any arguments are given,
30
+ # they will be joined to the end of the path using
31
+ # <tt>File.join</tt>.
32
+ #
33
+ def self.path( *args )
34
+ args.empty? ? PATH : ::File.join(PATH, *args)
35
+ end
36
+
37
+ # Utility method used to rquire all files ending in .rb that lie in the
38
+ # directory below this file that has the same name as the filename passed
39
+ # in. Optionally, a specific _directory_ name can be passed in such that
40
+ # the _filename_ does not have to be equivalent to the directory.
41
+ #
42
+ def self.require_all_libs_relative_to( fname, dir = nil )
43
+ dir ||= ::File.basename(fname, '.*')
44
+ search_me = ::File.expand_path(
45
+ ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
46
+
47
+ Dir.glob(search_me).sort.each {|rb| require rb}
48
+ end
49
+
50
+ end # module <%= classname %>
51
+
52
+ <%= classname %>.require_all_libs_relative_to __FILE__
53
+
54
+ end # unless defined?
6
55
 
7
56
  # EOF
@@ -45,7 +45,7 @@ namespace :doc do
45
45
 
46
46
  host = "#{config['username']}@rubyforge.org"
47
47
  remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
48
- remote_dir << PROJ.rdoc_remote_dir || PROJ.name
48
+ remote_dir << PROJ.rdoc_remote_dir if PROJ.rdoc_remote_dir
49
49
  local_dir = PROJ.rdoc_dir
50
50
 
51
51
  Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
data/data/tasks/setup.rb CHANGED
@@ -16,7 +16,7 @@ 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/)
20
20
 
21
21
  # Rspec
22
22
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -32,8 +32,8 @@ PROJ.rcov_opts = ['--sort', 'coverage', '-T']
32
32
 
33
33
  # Rdoc
34
34
  PROJ.rdoc_opts = []
35
- PROJ.rdoc_include = %w(^lib ^bin ^ext txt$)
36
- PROJ.rdoc_exclude = %w(extconf\.rb$ ^Manifest\.txt$)
35
+ PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
36
+ PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
37
37
  PROJ.rdoc_main = 'README.txt'
38
38
  PROJ.rdoc_dir = 'doc'
39
39
  PROJ.rdoc_remote_dir = nil
@@ -60,6 +60,13 @@ PROJ.need_zip = false
60
60
  PROJ.annotation_exclude = []
61
61
  PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
62
62
 
63
+ # Subversion Repository
64
+ PROJ.svn = false
65
+ PROJ.svn_root = nil
66
+ PROJ.svn_trunk = 'trunk'
67
+ PROJ.svn_tags = 'tags'
68
+ PROJ.svn_branches = 'branches'
69
+
63
70
  # Load the other rake files in the tasks folder
64
71
  Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
65
72
 
@@ -0,0 +1,44 @@
1
+ # $Id$
2
+
3
+
4
+ if PROJ.svn and system("svn --version 2>&1 > #{DEV_NULL}")
5
+
6
+ unless PROJ.svn_root
7
+ info = %x/svn info ./
8
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
9
+ PROJ.svn_root = (m.nil? ? '' : m[1])
10
+ end
11
+ PROJ.svn_root = File.join(PROJ.svn_root, PROJ.svn) if String === PROJ.svn
12
+
13
+ namespace :svn do
14
+
15
+ desc 'Show tags from the SVN repository'
16
+ task :show_tags do |t|
17
+ tags = %x/svn list #{File.join(PROJ.svn_root, PROJ.svn_tags)}/
18
+ tags.gsub!(%r/\/$/, '')
19
+ puts tags
20
+ end
21
+
22
+ desc 'Create a new tag in the SVN repository'
23
+ task :create_tag do |t|
24
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
25
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
26
+
27
+ trunk = File.join(PROJ.svn_root, PROJ.svn_trunk)
28
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
29
+ tag = File.join(PROJ.svn_root, PROJ.svn_tags, tag)
30
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
31
+
32
+ puts "Creating SVN tag '#{tag}'"
33
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
34
+ abort "Tag creation failed"
35
+ end
36
+ end
37
+
38
+ end # namespace :svn
39
+
40
+ task 'gem:release' => 'svn:create_tag'
41
+
42
+ end # if PROJ.svn
43
+
44
+ # EOF
data/lib/bones.rb CHANGED
@@ -1,9 +1,9 @@
1
- # $Id: bones.rb 448 2008-01-02 16:40:37Z tim_pease $
1
+ # $Id: bones.rb 449 2008-01-04 17:54:36Z tim_pease $
2
2
 
3
3
  module Bones
4
4
 
5
5
  # :stopdoc:
6
- VERSION = '1.2.1'
6
+ VERSION = '1.3.0'
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'
data/lib/bones/main.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: main.rb 448 2008-01-02 16:40:37Z tim_pease $
1
+ # $Id: main.rb 462 2008-01-04 20:56:16Z tim_pease $
2
2
 
3
3
  require 'fileutils'
4
4
  require 'optparse'
@@ -55,7 +55,7 @@ class Main
55
55
 
56
56
  opts.on_tail( '-h', '--help', 'show this message' ) {puts opts; exit}
57
57
  opts.on_tail( '--version', 'show version' ) do
58
- puts "Bones #{::Bones::VERSION}"
58
+ puts "Mr Bones #{::Bones::VERSION}"
59
59
  exit
60
60
  end
61
61
 
@@ -1,4 +1,4 @@
1
- # $Id: annotations.rake 431 2007-12-31 21:24:37Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  if HAVE_BONES
4
4
 
data/tasks/doc.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: doc.rake 428 2007-12-31 17:55:51Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/rdoctask'
4
4
 
data/tasks/gem.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: gem.rake 428 2007-12-31 17:55:51Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/gempackagetask'
4
4
 
data/tasks/manifest.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: manifest.rake 419 2007-12-29 04:39:36Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'find'
4
4
 
data/tasks/rubyforge.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: rubyforge.rake 417 2007-12-29 03:21:48Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  if PROJ.rubyforge_name && HAVE_RUBYFORGE
4
4
 
@@ -45,7 +45,7 @@ namespace :doc do
45
45
 
46
46
  host = "#{config['username']}@rubyforge.org"
47
47
  remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
48
- remote_dir << PROJ.rdoc_remote_dir || PROJ.name
48
+ remote_dir << PROJ.rdoc_remote_dir if PROJ.rdoc_remote_dir
49
49
  local_dir = PROJ.rdoc_dir
50
50
 
51
51
  Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
data/tasks/setup.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: setup.rb 431 2007-12-31 21:24:37Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
@@ -16,7 +16,7 @@ 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/)
20
20
 
21
21
  # Rspec
22
22
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -32,8 +32,8 @@ PROJ.rcov_opts = ['--sort', 'coverage', '-T']
32
32
 
33
33
  # Rdoc
34
34
  PROJ.rdoc_opts = []
35
- PROJ.rdoc_include = %w(^lib ^bin ^ext txt$)
36
- PROJ.rdoc_exclude = %w(extconf\.rb$ ^Manifest\.txt$)
35
+ PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
36
+ PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
37
37
  PROJ.rdoc_main = 'README.txt'
38
38
  PROJ.rdoc_dir = 'doc'
39
39
  PROJ.rdoc_remote_dir = nil
@@ -60,6 +60,13 @@ PROJ.need_zip = false
60
60
  PROJ.annotation_exclude = []
61
61
  PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
62
62
 
63
+ # Subversion Repository
64
+ PROJ.svn = false
65
+ PROJ.svn_root = nil
66
+ PROJ.svn_trunk = 'trunk'
67
+ PROJ.svn_tags = 'tags'
68
+ PROJ.svn_branches = 'branches'
69
+
63
70
  # Load the other rake files in the tasks folder
64
71
  Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
65
72
 
data/tasks/spec.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: spec.rake 428 2007-12-31 17:55:51Z tim_pease $
1
+ # $Id: spec.rake 461 2008-01-04 20:55:37Z tim_pease $
2
2
 
3
3
  if HAVE_SPEC_RAKE_SPECTASK
4
4
 
@@ -35,6 +35,6 @@ task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
35
35
 
36
36
  remove_desc_for_task %w(spec:clobber_rcov)
37
37
 
38
- end # if HAVE_SPEC
38
+ end # if HAVE_SPEC_RAKE_SPECTASK
39
39
 
40
40
  # EOF
data/tasks/svn.rake ADDED
@@ -0,0 +1,44 @@
1
+ # $Id$
2
+
3
+
4
+ if PROJ.svn and system("svn --version 2>&1 > #{DEV_NULL}")
5
+
6
+ unless PROJ.svn_root
7
+ info = %x/svn info ./
8
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
9
+ PROJ.svn_root = (m.nil? ? '' : m[1])
10
+ end
11
+ PROJ.svn_root = File.join(PROJ.svn_root, PROJ.svn) if String === PROJ.svn
12
+
13
+ namespace :svn do
14
+
15
+ desc 'Show tags from the SVN repository'
16
+ task :show_tags do |t|
17
+ tags = %x/svn list #{File.join(PROJ.svn_root, PROJ.svn_tags)}/
18
+ tags.gsub!(%r/\/$/, '')
19
+ puts tags
20
+ end
21
+
22
+ desc 'Create a new tag in the SVN repository'
23
+ task :create_tag do |t|
24
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
25
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
26
+
27
+ trunk = File.join(PROJ.svn_root, PROJ.svn_trunk)
28
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
29
+ tag = File.join(PROJ.svn_root, PROJ.svn_tags, tag)
30
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
31
+
32
+ puts "Creating SVN tag '#{tag}'"
33
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
34
+ abort "Tag creation failed"
35
+ end
36
+ end
37
+
38
+ end # namespace :svn
39
+
40
+ task 'gem:release' => 'svn:create_tag'
41
+
42
+ end # if PROJ.svn
43
+
44
+ # EOF
data/tasks/test.rake CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: test.rake 428 2007-12-31 17:55:51Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/testtask'
4
4
 
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.2.1
4
+ version: 1.3.0
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-01-02 00:00:00 -07:00
12
+ date: 2008-01-04 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -43,6 +43,7 @@ files:
43
43
  - data/tasks/rubyforge.rake
44
44
  - data/tasks/setup.rb
45
45
  - data/tasks/spec.rake
46
+ - data/tasks/svn.rake
46
47
  - data/tasks/test.rake
47
48
  - data/test/test_NAME.rb
48
49
  - lib/bones.rb
@@ -55,6 +56,7 @@ files:
55
56
  - tasks/rubyforge.rake
56
57
  - tasks/setup.rb
57
58
  - tasks/spec.rake
59
+ - tasks/svn.rake
58
60
  - tasks/test.rake
59
61
  has_rdoc: true
60
62
  homepage: http://codeforpeople.rubyforge.org/bones