bones 1.1.2 → 1.2.0
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.
- data/History.txt +16 -10
- data/README.txt +95 -25
- data/Rakefile +1 -1
- data/data/README.txt.erb +1 -1
- data/data/tasks/annotations.rake +5 -4
- data/data/tasks/setup.rb +4 -0
- data/lib/bones.rb +3 -3
- data/lib/bones/annotation_extractor.rb +48 -26
- data/lib/bones/main.rb +104 -16
- data/tasks/annotations.rake +6 -5
- data/tasks/setup.rb +5 -1
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,25 +1,31 @@
|
|
1
|
+
== 1.2.0 / 2007-12-31
|
2
|
+
|
3
|
+
* 1 major enhancement
|
4
|
+
- Users can define their own skeletons to use (bones --freeze)
|
5
|
+
* 1 minor enhancement
|
6
|
+
- Show a list of the files a user needs to change after project creation
|
7
|
+
|
1
8
|
== 1.1.2 / 2007-12-31
|
2
9
|
|
3
10
|
* 2 minor enhancements
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
* Fixed typo in an abort message (thanks Bill Kleb)
|
11
|
+
- The pkg and doc directories are now excluded from the manifest
|
12
|
+
- Added method to hide tasks from the rake task listing
|
13
|
+
* 1 bugfix
|
14
|
+
- Fixed typo in an abort message (thanks Bill Kleb)
|
9
15
|
|
10
16
|
== 1.1.1 / 2007-12-29
|
11
17
|
|
12
18
|
* 1 bugfix
|
13
|
-
|
19
|
+
- Fixed the bad interaction with RSpec gem
|
14
20
|
|
15
21
|
== 1.1.0 / 2007-12-29
|
16
22
|
|
17
23
|
* 3 minor enhancements
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
- Output message when files are created or updated
|
25
|
+
- Directory cleanup if project creation fails
|
26
|
+
- Pulled the rails source annotation extractor into Mr Bones
|
21
27
|
|
22
28
|
== 1.0.0 / 2007-12-28
|
23
29
|
|
24
30
|
* 1 major enhancement
|
25
|
-
|
31
|
+
- Birthday!
|
data/README.txt
CHANGED
@@ -14,31 +14,33 @@ gem dependency required).
|
|
14
14
|
|
15
15
|
Mr Bones provides the following rake tasks:
|
16
16
|
|
17
|
-
clobber
|
18
|
-
doc
|
19
|
-
doc:rdoc
|
20
|
-
doc:release
|
21
|
-
doc:rerdoc
|
22
|
-
doc:ri
|
23
|
-
gem
|
24
|
-
gem:debug
|
25
|
-
gem:gem
|
26
|
-
gem:install
|
27
|
-
gem:package
|
28
|
-
gem:release
|
29
|
-
gem:repackage
|
30
|
-
gem:uninstall
|
31
|
-
manifest:check
|
32
|
-
manifest:create
|
33
|
-
notes
|
34
|
-
notes:fixme
|
35
|
-
notes:optimize
|
36
|
-
notes:todo
|
37
|
-
spec
|
38
|
-
spec:
|
39
|
-
spec:
|
40
|
-
|
41
|
-
test
|
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.2.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:check # Verify the manifest
|
32
|
+
manifest:create # Create a new manifest
|
33
|
+
notes # Enumerate all annotations
|
34
|
+
notes:fixme # Enumerate all FIXME annotations
|
35
|
+
notes:optimize # Enumerate all OPTIMIZE annotations
|
36
|
+
notes:todo # Enumerate all TODO annotations
|
37
|
+
spec # Alias to spec:run
|
38
|
+
spec:rcov # Run all specs with RCov
|
39
|
+
spec:run # Run all specs with basic output
|
40
|
+
spec:specdoc # Run all specs with text output
|
41
|
+
test # Alias to test:run
|
42
|
+
test:rcov # Run rcov on the unit tests
|
43
|
+
test:run # Run tests for run
|
42
44
|
|
43
45
|
The rake tasks in the Mr Bones framework can be found in the "tasks"
|
44
46
|
directory. Add your own tasks there when you need more functionality.
|
@@ -131,6 +133,74 @@ most current version number for the installed gem is used.
|
|
131
133
|
depend_on 'logging'
|
132
134
|
depend_on 'rake', '0.7.3'
|
133
135
|
|
136
|
+
=== Freezing a Skeleton
|
137
|
+
|
138
|
+
Freezing allows you to define your own project skeleton to instantiate with Mr
|
139
|
+
Bones when you create a new project. The default Mr Bones project skeleton is
|
140
|
+
copied to the ".mrbones" directory in your home directory. From there, the
|
141
|
+
skeleton can be modified however you like (add new files and tasks, add new
|
142
|
+
directories, etc).
|
143
|
+
|
144
|
+
bones --freeze
|
145
|
+
|
146
|
+
Typical uses of this feature would be to fill in user specific data like the
|
147
|
+
author, e-mail address, etc. You can also add more default code to the skeleton
|
148
|
+
project or your own ".rake" task files.
|
149
|
+
|
150
|
+
==== Updating a Frozen Skeleton
|
151
|
+
|
152
|
+
Just like a regular project, a frozen skeleton can be updated if a newer
|
153
|
+
version of Mr Bones comes out with better features. Updating a frozen skeleton
|
154
|
+
will only modify the tasks. All other files in the skeleton remain untouched.
|
155
|
+
|
156
|
+
bones --freeze
|
157
|
+
|
158
|
+
The freeze command is used to update the skeleton tasks to the latest Mr Bones
|
159
|
+
tasks. A copy of the current tasks are made in an "archive" directory in the
|
160
|
+
".mrbones" directory. To revert back to the archive version, you will need to
|
161
|
+
manually rename "archive" to "data" in the ".mrbones" directory.
|
162
|
+
|
163
|
+
==== Unfreezing a Skeleton
|
164
|
+
|
165
|
+
Unfreezing a skeleton will remove your customized project skeleton from the
|
166
|
+
".mrbones" directory. The default Mr Bones project skeleton will be used
|
167
|
+
instead. A copy of your custom skeleton is made in the "archive" directory of
|
168
|
+
the ".mrbones" directory before it is removed.
|
169
|
+
|
170
|
+
bones --unfreeze
|
171
|
+
|
172
|
+
==== Custom Modifications
|
173
|
+
|
174
|
+
Mr Bones will perform a limited set of substitutions on the files in the
|
175
|
+
skeleton when it generates a new project. ERB is the to insert the project name
|
176
|
+
and the derived class name into any template files. The file must end in an
|
177
|
+
".erb" suffix for ERB substitutions to take place. The ".erb" suffix is
|
178
|
+
stripped from the file during project generation. Therefore, your ERB files
|
179
|
+
should have two suffixes -- the ".erb" suffix that will be stripped, and the
|
180
|
+
suffix you want the resulting project file to have.
|
181
|
+
|
182
|
+
Only two values can be substituted into files using ERB -- the project name and
|
183
|
+
the derived class name.
|
184
|
+
|
185
|
+
<%= name %>
|
186
|
+
<%= classname %>
|
187
|
+
|
188
|
+
The project +name+ is passed in from the command line and used "as is" (with
|
189
|
+
the exception that spaces are converted to underscores). The +classname+ is
|
190
|
+
generated by camel casing the project name where the underscores occur.
|
191
|
+
|
192
|
+
get fuzzy => GetFuzzy
|
193
|
+
foo_bar => FooBar
|
194
|
+
|
195
|
+
Finally, file names can be modified by substituting in the project name. If a
|
196
|
+
file name contains the string "NAME" it is replaced with the project name. If
|
197
|
+
our project is call "get fuzzy" then the following transformations will take
|
198
|
+
place.
|
199
|
+
|
200
|
+
NAME.rb => get_fuzzy.rb
|
201
|
+
test_NAME.rb => test_get_fuzzy.rb
|
202
|
+
NAME_spec.rb => get_fuzzy_spec.rb
|
203
|
+
|
134
204
|
== ACKNOWLEDGEMENTS:
|
135
205
|
|
136
206
|
Ryan Davis and Eric Hodel and their Hoe gem (from which much of the Mr Bones
|
data/Rakefile
CHANGED
data/data/README.txt.erb
CHANGED
@@ -26,7 +26,7 @@ FIXME (describe your package)
|
|
26
26
|
|
27
27
|
(The MIT License)
|
28
28
|
|
29
|
-
Copyright (c)
|
29
|
+
Copyright (c) 2008 FIXME (different license?)
|
30
30
|
|
31
31
|
Permission is hereby granted, free of charge, to any person obtaining
|
32
32
|
a copy of this software and associated documentation files (the
|
data/data/tasks/annotations.rake
CHANGED
@@ -4,23 +4,24 @@ if HAVE_BONES
|
|
4
4
|
|
5
5
|
desc "Enumerate all annotations"
|
6
6
|
task :notes do
|
7
|
-
Bones::AnnotationExtractor.enumerate
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
|
8
9
|
end
|
9
10
|
|
10
11
|
namespace :notes do
|
11
12
|
desc "Enumerate all OPTIMIZE annotations"
|
12
13
|
task :optimize do
|
13
|
-
Bones::AnnotationExtractor.enumerate "OPTIMIZE"
|
14
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
|
14
15
|
end
|
15
16
|
|
16
17
|
desc "Enumerate all FIXME annotations"
|
17
18
|
task :fixme do
|
18
|
-
Bones::AnnotationExtractor.enumerate "FIXME"
|
19
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
|
19
20
|
end
|
20
21
|
|
21
22
|
desc "Enumerate all TODO annotations"
|
22
23
|
task :todo do
|
23
|
-
Bones::AnnotationExtractor.enumerate "TODO"
|
24
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
data/data/tasks/setup.rb
CHANGED
@@ -56,6 +56,10 @@ PROJ.dependencies = []
|
|
56
56
|
PROJ.need_tar = true
|
57
57
|
PROJ.need_zip = false
|
58
58
|
|
59
|
+
# File Annotations
|
60
|
+
PROJ.annotation_exclude = []
|
61
|
+
PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
|
62
|
+
|
59
63
|
# Load the other rake files in the tasks folder
|
60
64
|
Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
|
61
65
|
|
data/lib/bones.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# $Id: bones.rb
|
1
|
+
# $Id: bones.rb 432 2007-12-31 23:41:04Z tim_pease $
|
2
2
|
|
3
3
|
module Bones
|
4
4
|
|
5
5
|
# :stopdoc:
|
6
|
-
VERSION = '1.
|
6
|
+
VERSION = '1.2.0'
|
7
7
|
PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
8
|
-
WIN32 = %r/win32/ =~ RUBY_PLATFORM
|
8
|
+
WIN32 = %r/win32/ =~ RUBY_PLATFORM
|
9
9
|
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
10
10
|
# :startdoc:
|
11
11
|
|
@@ -1,50 +1,68 @@
|
|
1
|
-
# $Id: annotation_extractor.rb
|
1
|
+
# $Id: annotation_extractor.rb 431 2007-12-31 21:24:37Z tim_pease $
|
2
2
|
|
3
3
|
module Bones
|
4
|
+
|
5
|
+
# A helper class used to find and display any annotations in a collection of
|
6
|
+
# project files.
|
7
|
+
#
|
4
8
|
class AnnotationExtractor
|
5
9
|
|
6
10
|
class Annotation < Struct.new(:line, :tag, :text)
|
7
|
-
|
11
|
+
# Returns a string representation of the annotation. If the
|
12
|
+
# <tt>:tag</tt> parameter is given as +true+, then the annotation tag
|
13
|
+
# will be included in the string.
|
14
|
+
#
|
15
|
+
def to_s( opts = {} )
|
8
16
|
s = "[%3d] " % line
|
9
|
-
s << "[#{tag}] " if
|
17
|
+
s << "[#{tag}] " if opts[:tag]
|
10
18
|
s << text
|
11
19
|
end
|
12
20
|
end
|
13
21
|
|
14
|
-
|
15
|
-
|
16
|
-
|
22
|
+
# Enumerate all the annoations for the given _project_ and _tag_. This
|
23
|
+
# will search for all athe annotations and display them on standard
|
24
|
+
# output.
|
25
|
+
#
|
26
|
+
def self.enumerate( project, tag, opts = {} )
|
27
|
+
extractor = new(project, tag)
|
28
|
+
extractor.display(extractor.find, opts)
|
17
29
|
end
|
18
30
|
|
19
|
-
attr_reader :tag
|
31
|
+
attr_reader :tag, :project
|
20
32
|
|
21
|
-
|
33
|
+
# Creates a new annotation extractor configured to use the _project_ open
|
34
|
+
# strcut and to search for the given _tag_ (which can be more than one tag
|
35
|
+
# via a regular expression 'or' operation -- i.e. THIS|THAT|OTHER)
|
36
|
+
#
|
37
|
+
def initialize( project, tag )
|
38
|
+
@project = project
|
22
39
|
@tag = tag
|
23
40
|
end
|
24
41
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
def
|
42
|
+
# Iterate over all the files in the project manifest and extract
|
43
|
+
# annotations from the those files. Returns the results as a hash for
|
44
|
+
# display.
|
45
|
+
#
|
46
|
+
def find
|
30
47
|
results = {}
|
48
|
+
rgxp = %r/(#{tag}):?\s*(.*?)(?:\s*(?:-?%>|\*+\/))?$/o
|
49
|
+
extensions = project.annotation_extensions.dup
|
50
|
+
exclude = if project.annotation_exclude.empty? then nil
|
51
|
+
else Regexp.new(project.annotation_exclude.join('|')) end
|
31
52
|
|
32
|
-
|
33
|
-
next if
|
34
|
-
|
35
|
-
|
36
|
-
results.update(find_in(item))
|
37
|
-
elsif item =~ /\.(builder|(r(?:b|xml|js)))$/
|
38
|
-
results.update(extract_annotations_from(item, /#\s*(#{tag}):?\s*(.*)$/))
|
39
|
-
elsif item =~ /\.(rhtml|erb)$/
|
40
|
-
results.update(extract_annotations_from(item, /<%\s*#\s*(#{tag}):?\s*(.*?)\s*%>/))
|
41
|
-
end
|
53
|
+
project.files.each do |fn|
|
54
|
+
next if exclude && exclude =~ fn
|
55
|
+
next unless extensions.include? File.extname(fn)
|
56
|
+
results.update(extract_annotations_from(fn, rgxp))
|
42
57
|
end
|
43
58
|
|
44
59
|
results
|
45
60
|
end
|
46
61
|
|
47
|
-
|
62
|
+
# Extract any annotations from the given _file_ using the regular
|
63
|
+
# expression _pattern_ provided.
|
64
|
+
#
|
65
|
+
def extract_annotations_from( file, pattern )
|
48
66
|
lineno = 0
|
49
67
|
result = File.readlines(file).inject([]) do |list, line|
|
50
68
|
lineno += 1
|
@@ -54,11 +72,15 @@ class AnnotationExtractor
|
|
54
72
|
result.empty? ? {} : { file => result }
|
55
73
|
end
|
56
74
|
|
57
|
-
|
75
|
+
# Print the results of the annotation extraction to the screen. If the
|
76
|
+
# <tt>:tags</tt> option is set to +true+, then the annotation tag will be
|
77
|
+
# displayed.
|
78
|
+
#
|
79
|
+
def display( results, opts = {} )
|
58
80
|
results.keys.sort.each do |file|
|
59
81
|
puts "#{file}:"
|
60
82
|
results[file].each do |note|
|
61
|
-
puts " * #{note.to_s(
|
83
|
+
puts " * #{note.to_s(opts)}"
|
62
84
|
end
|
63
85
|
puts
|
64
86
|
end
|
data/lib/bones/main.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: main.rb
|
1
|
+
# $Id: main.rb 433 2008-01-01 04:32:48Z tim_pease $
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'optparse'
|
@@ -25,7 +25,8 @@ class Main
|
|
25
25
|
# the +create+ and +update+ methods.
|
26
26
|
#
|
27
27
|
def parse( args )
|
28
|
-
self.data = File.join(
|
28
|
+
self.data = File.join(mrbones_dir, 'data')
|
29
|
+
self.data = File.join(::Bones::PATH, 'data') unless test(?d, data)
|
29
30
|
self.update = false
|
30
31
|
self.verbose = false
|
31
32
|
|
@@ -38,6 +39,17 @@ class Main
|
|
38
39
|
opts.on('-v', '--verbose',
|
39
40
|
'enable verbose output') {self.verbose = true}
|
40
41
|
|
42
|
+
opts.separator ''
|
43
|
+
opts.on('--freeze', 'freeze the project skeleton') {freeze; exit}
|
44
|
+
opts.on('--unfreeze', 'use the standard project skeleton') {unfreeze; exit}
|
45
|
+
opts.on('-i', '--info',
|
46
|
+
'report on the project skeleton being used') do
|
47
|
+
STDOUT.puts "the project skeleton will be copied from"
|
48
|
+
STDOUT.write " "
|
49
|
+
STDOUT.puts data
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
|
41
53
|
opts.separator ''
|
42
54
|
opts.separator 'common options:'
|
43
55
|
|
@@ -49,7 +61,7 @@ class Main
|
|
49
61
|
|
50
62
|
# parse the command line arguments
|
51
63
|
opts.parse! args
|
52
|
-
self.name = args.
|
64
|
+
self.name = args.join('_')
|
53
65
|
|
54
66
|
if name.nil?
|
55
67
|
puts opts
|
@@ -65,7 +77,7 @@ class Main
|
|
65
77
|
@update
|
66
78
|
end
|
67
79
|
|
68
|
-
# Returns the project name but converted to be
|
80
|
+
# Returns the project name but converted to be usable as a Ruby class
|
69
81
|
# name.
|
70
82
|
#
|
71
83
|
def classname
|
@@ -75,14 +87,6 @@ class Main
|
|
75
87
|
# Create a new project from the bones/data project template.
|
76
88
|
#
|
77
89
|
def create
|
78
|
-
# * copy files from either
|
79
|
-
# 1) the user's '.bones/data' directory or
|
80
|
-
# 2) the Bones 'data' directory
|
81
|
-
#
|
82
|
-
# TODO - figure out if this really is the best way of doing this
|
83
|
-
# should I just use either the .bones data or the gem data, not
|
84
|
-
# both
|
85
|
-
|
86
90
|
# see if the directory already exists
|
87
91
|
abort "'#{name}' already exists" if test ?e, name
|
88
92
|
|
@@ -93,6 +97,8 @@ class Main
|
|
93
97
|
begin
|
94
98
|
FileUtils.cd name
|
95
99
|
system "rake manifest:create 2>&1 > #{::Bones::DEV_NULL}"
|
100
|
+
STDOUT.puts "created '#{name}'\nnow you need to fix these files"
|
101
|
+
system "rake notes"
|
96
102
|
ensure
|
97
103
|
FileUtils.cd pwd
|
98
104
|
end
|
@@ -100,8 +106,6 @@ class Main
|
|
100
106
|
FileUtils.rm_rf name
|
101
107
|
abort "could not create '#{name}'"
|
102
108
|
end
|
103
|
-
|
104
|
-
STDOUT.puts "created '#{name}'"
|
105
109
|
end
|
106
110
|
|
107
111
|
# Archive any existing tasks in the project's tasks folder, and then
|
@@ -123,19 +127,87 @@ class Main
|
|
123
127
|
end
|
124
128
|
|
125
129
|
files_to_copy.each do |fn|
|
126
|
-
next unless
|
130
|
+
next unless %r/^tasks\// =~ fn
|
127
131
|
cp fn
|
128
132
|
end
|
129
133
|
|
130
134
|
STDOUT.puts "updated tasks for '#{name}'"
|
131
135
|
end
|
132
136
|
|
137
|
+
# Freeze the project skeleton to the current Mr Bones gem. If the project
|
138
|
+
# skeleton has already been frozen, then it will be archived before being
|
139
|
+
# overwritten by the current Mr Bones skeleton.
|
140
|
+
#
|
141
|
+
# If the project skeleton is already frozen, only the tasks from the Mr
|
142
|
+
# Bones skeleton will be copied to the user's data directory.
|
143
|
+
#
|
144
|
+
def freeze
|
145
|
+
bones_data_dir = File.join(::Bones::PATH, 'data')
|
146
|
+
data_dir = File.join(mrbones_dir, 'data')
|
147
|
+
archive_dir = File.join(mrbones_dir, 'archive')
|
148
|
+
tasks_only = false
|
149
|
+
|
150
|
+
if test(?d, data_dir)
|
151
|
+
STDOUT.puts "archiving #{data_dir}" if verbose
|
152
|
+
FileUtils.rm_rf(archive_dir)
|
153
|
+
FileUtils.mkdir(archive_dir)
|
154
|
+
FileUtils.cp_r(File.join(data_dir, '.'), archive_dir)
|
155
|
+
tasks_only = true
|
156
|
+
else
|
157
|
+
FileUtils.mkdir_p(data_dir)
|
158
|
+
end
|
159
|
+
|
160
|
+
files_to_copy.each do |file|
|
161
|
+
next if tasks_only && !(%r/^tasks\// =~ file)
|
162
|
+
|
163
|
+
src = File.join(bones_data_dir, file)
|
164
|
+
dst = File.join(data_dir, file)
|
165
|
+
|
166
|
+
STDOUT.puts "freezing #{dst}" if verbose
|
167
|
+
FileUtils.mkdir_p(File.dirname(dst))
|
168
|
+
FileUtils.cp(src, dst)
|
169
|
+
end
|
170
|
+
|
171
|
+
File.open(frozen_version_file, 'w') {|fd| fd.puts ::Bones::VERSION}
|
172
|
+
|
173
|
+
if tasks_only
|
174
|
+
STDOUT.puts "project skeleton tasks have been updated " <<
|
175
|
+
"from Mr Bones #{::Bones::VERSION}"
|
176
|
+
else
|
177
|
+
STDOUT.puts "project skeleton has been frozen " <<
|
178
|
+
"to Mr Bones #{::Bones::VERSION}"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Unfreeze the project skeleton. The default Mr Bones skeleton will be
|
183
|
+
# used insetad. This method will archive the current frozen skeleton if
|
184
|
+
# one exists.
|
185
|
+
#
|
186
|
+
def unfreeze
|
187
|
+
data_dir = File.join(mrbones_dir, 'data')
|
188
|
+
archive_dir = File.join(mrbones_dir, 'archive')
|
189
|
+
|
190
|
+
if test(?d, data_dir)
|
191
|
+
STDOUT.puts "archiving #{data_dir}" if verbose
|
192
|
+
FileUtils.rm_rf(archive_dir)
|
193
|
+
FileUtils.mkdir(archive_dir)
|
194
|
+
FileUtils.cp_r(File.join(data_dir, '.'), archive_dir)
|
195
|
+
FileUtils.rm_rf(data_dir)
|
196
|
+
|
197
|
+
STDOUT.puts "project skeleton has been unfrozen"
|
198
|
+
STDOUT.puts "(default Mr Bones #{::Bones::VERSION} sekeleton will be used)"
|
199
|
+
else
|
200
|
+
STDOUT.puts "project skeleton is not frozen (no action taken)"
|
201
|
+
end
|
202
|
+
FileUtils.rm_f frozen_version_file
|
203
|
+
end
|
204
|
+
|
133
205
|
|
134
206
|
private
|
135
207
|
|
136
208
|
# Copy a file from the Bones prototype project location to the user
|
137
209
|
# specified project location. A message will be displayed to the screen
|
138
|
-
# indicating
|
210
|
+
# indicating that the file is being created.
|
139
211
|
#
|
140
212
|
def cp( file )
|
141
213
|
dir = File.dirname(file)
|
@@ -181,6 +253,22 @@ class Main
|
|
181
253
|
ary
|
182
254
|
end
|
183
255
|
|
256
|
+
# Returns the .bones resource directory in the user's home directory.
|
257
|
+
#
|
258
|
+
def mrbones_dir
|
259
|
+
return @mrbones_dir if defined? @mrbones_dir
|
260
|
+
|
261
|
+
path = (::Bones::WIN32 ? ENV['HOMEPATH'].tr("\\", "/") : ENV['HOME'])
|
262
|
+
path = File.join(path, '.mrbones')
|
263
|
+
@mrbones_dir = File.expand_path(path)
|
264
|
+
end
|
265
|
+
|
266
|
+
# File containing the Mr Bones version from which the skeleton was frozen.
|
267
|
+
#
|
268
|
+
def frozen_version_file
|
269
|
+
File.join(mrbones_dir, 'version.txt')
|
270
|
+
end
|
271
|
+
|
184
272
|
end # class Main
|
185
273
|
end # module Bones
|
186
274
|
|
data/tasks/annotations.rake
CHANGED
@@ -1,26 +1,27 @@
|
|
1
|
-
# $Id: annotations.rake
|
1
|
+
# $Id: annotations.rake 431 2007-12-31 21:24:37Z tim_pease $
|
2
2
|
|
3
3
|
if HAVE_BONES
|
4
4
|
|
5
5
|
desc "Enumerate all annotations"
|
6
6
|
task :notes do
|
7
|
-
Bones::AnnotationExtractor.enumerate
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
|
8
9
|
end
|
9
10
|
|
10
11
|
namespace :notes do
|
11
12
|
desc "Enumerate all OPTIMIZE annotations"
|
12
13
|
task :optimize do
|
13
|
-
Bones::AnnotationExtractor.enumerate "OPTIMIZE"
|
14
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
|
14
15
|
end
|
15
16
|
|
16
17
|
desc "Enumerate all FIXME annotations"
|
17
18
|
task :fixme do
|
18
|
-
Bones::AnnotationExtractor.enumerate "FIXME"
|
19
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
|
19
20
|
end
|
20
21
|
|
21
22
|
desc "Enumerate all TODO annotations"
|
22
23
|
task :todo do
|
23
|
-
Bones::AnnotationExtractor.enumerate "TODO"
|
24
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
data/tasks/setup.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: setup.rb
|
1
|
+
# $Id: setup.rb 431 2007-12-31 21:24:37Z tim_pease $
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rake'
|
@@ -56,6 +56,10 @@ PROJ.dependencies = []
|
|
56
56
|
PROJ.need_tar = true
|
57
57
|
PROJ.need_zip = false
|
58
58
|
|
59
|
+
# File Annotations
|
60
|
+
PROJ.annotation_exclude = []
|
61
|
+
PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
|
62
|
+
|
59
63
|
# Load the other rake files in the tasks folder
|
60
64
|
Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
|
61
65
|
|