forked from TwP/bones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
346 lines (259 loc) · 12.3 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
Mr Bones
by Tim Pease
http://codeforpeople.rubyforge.org/bones
== 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).
== VERSION 2.1.0 CHANGES:
With my Mr Bones projects, I found myself constantly updating the tasks as new
versions of Mr Bones were released. This quickly became annoying. Why not use
the tasks from the Mr Bones gem and only copy those tasks to my own projects
when they are packaged and released? That is the goal of this release of Mr
Bones.
Version 2.1.0 of Mr Bones allows your projects to use the rake tasks found
in the Mr Bones gem but still remain independent from Mr Bones when
deployed. This is accomplished by copying the rake tasks into your project
only when it is packaged into a gem (or zip file or tarball).
You still have the option of copy the tasks to your local project when it is
created. Or you can add tasks to your project at a later time.
So, if you have an exsiting project and you want to use the Mr Bones tasks,
simply delete your "tasks" folder and put the following at the top of your
Rakefile:
begin
require 'bones'
Bones.setup
rescue LoadError
load 'tasks/setup.rb' # this line should already be there
end
== FEATURES:
Mr Bones provides the following rake tasks:
ann # Alias to ann:announcement
ann:announcement # Create an announcement file
ann:email # Send an email announcement
bones:debug # Show the PROJ open struct
clean # Remove any temporary products.
clobber # Remove any generated file.
doc # Alias to doc:rdoc
doc:rdoc # Build the rdoc HTML Files
doc:release # Publish RDoc to RubyForge
doc:rerdoc # Force a rebuild of the RDOC files
doc:ri # Generate ri locally for testing
gem # Alias to gem:package
gem:cleanup # Cleanup the gem
gem:debug # Show information about the gem
gem:install # Install the gem
gem:package # Build all the packages
gem:reinstall # Reinstall the gem
gem:release # Package and upload to RubyForge
gem:repackage # Force a rebuild of the package files
gem:uninstall # Uninstall the gem
git:create_tag # Create a new tag in the Git repository
git:show_tags # Show tags from the Git repository
manifest # Alias to manifest:check
manifest:check # Verify the manifest
manifest:create # Create a new manifest
notes # Enumerate all annotations
notes:fixme # Enumerate all FIXME annotations
notes:optimize # Enumerate all OPTIMIZE annotations
notes:todo # Enumerate all TODO annotations
spec # Alias to spec:run
spec:rcov # Run all specs with RCov
spec:run # Run all specs with basic output
spec:specdoc # Run all specs with text output
spec:verify # Verify that rcov coverage is at least 90.0%
test # Alias to test:run
test:rcov # Run rcov on the unit tests
test:run # Run tests for run
The rake tasks in the Mr Bones framework can be found in the "tasks"
directory. Add your own tasks there when you need more functionality.
== SYNOPSIS:
To create a new "Get Fuzzy" project:
bones get_fuzzy
If you ever get confused about what Mr Bones can do:
bones --help
== REQUIREMENTS:
Mr Bones does not have any "requirements", but if you do not have the
following gems installed you will not get all that Mr Bones has to offer.
* rubyforge - for easy gem publishing to rubyforge.org
* rcov - for code coverage testing
* rspec - if that's the way you roll
* facets - for pretty colors
Actually, you will need at least version 1.2.0 of rubygems installed to use
Mr Bones.
== INSTALL:
* sudo gem install bones
== MANUAL:
The +bones+ command line tool is used to create a skeleton for a Ruby
project. In that skeleton is a "tasks" directory that contains the Mr Bones
rake files. These files are quite generic, and their functionality is
controlled by options configured in the top-level Rakefile. Take a look at
the Rakefile for the Mr Bones gem itself:
begin
require 'bones'
Bones.setup
rescue LoadError
load 'tasks/setup.rb'
end
ensure_in_path 'lib'
require 'bones'
task :default => 'spec:run'
PROJ.name = 'bones'
PROJ.authors = 'Tim Pease'
PROJ.email = '[email protected]'
PROJ.url = 'http://codeforpeople.rubyforge.org/bones'
PROJ.version = Bones::VERSION
PROJ.rubyforge.name = 'codeforpeople'
PROJ.rdoc.remote_dir = 'bones'
PROJ.rdoc.exclude << '^data'
PROJ.notes.exclude = %w(^README\.txt$ ^data/)
PROJ.svn.path = 'bones'
PROJ.spec_opts << '--color'
# EOF
The +PROJ+ constant is an open struct that contains all the configuration
options for the project. The open struct is created in the "tasks/setup.rb"
file, and that is also where all the configurable options are defined. Take
a look in the "setup.rb" file to see what options are available, but always
make your changes in the Rakefile itself.
The Mr Bones rake system is based on a "Manifest.txt" file that contains a
list of all the files that will be used in the project. If a file does not
appear in the manifest, it will not be included in the gem. Use the
+manifest+ rake tasks to create and update the manifest as needed.
You can exclude files from being seen by the manifest -- the files are
invisible to the Mr Bones rake tasks. You would do this for any subversion
directories, backup files, or anything else you don't want gumming up the
works. The files to exclude are given as an array of regular expression
patterns; a file is excluded if it matches any of the patterns.
PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg ^doc)
PROJ.exclude << '^tags$'
If your project depends on other gems, use the +depend_on+ command in your
Rakefile to declare the dependency. If you do not specify a version, the
most current version number for the installed gem is used.
depend_on 'logging'
depend_on 'rake', '0.8.2'
=== Freezing a Skeleton
Freezing allows you to define your own project skeleton to instantiate with Mr
Bones when you create a new project. The default Mr Bones project skeleton is
copied to the ".mrbones" directory in your home directory. From there, the
skeleton can be modified however you like (add new files and tasks, add new
directories, etc).
bones --freeze
Typical uses of this feature would be to fill in user specific data like the
author, e-mail address, etc. You can also add more default code to the skeleton
project or your own ".rake" task files.
You can have multiple skeletons with different names. Your projects can be
instantiated from any of these skeletons. Just supply a name when freezing:
bones --freeze foo
You can instantiate a project from the "foo" skeleton:
bones --skeleton foo get_fuzzy
The default skeleton name is "data". If no skeleton name is provided, then this
is the skeleton that will be used.
==== Unfreezing a Skeleton
Unfreezing a skeleton will remove your customized project skeleton from the
".mrbones" directory. The default Mr Bones project skeleton will be used
instead. A copy of your custom skeleton is stored in an archive directory of
the ".mrbones" directory before it is removed.
bones --unfreeze
You can unfreeze named skeletons, too:
bones --unfreeze foo
==== Custom Modifications
Mr Bones will perform a limited set of substitutions on the files in the
skeleton when it generates a new project. ERB is used to insert the project
name and the derived class name into template files. The file must end in an
".erb" suffix for ERB substitutions to take place. The ".erb" suffix is
stripped from the file during project generation. Therefore, your ERB files
should have two suffixes -- the ".erb" suffix that will be stripped, and the
suffix you want the resulting project file to have.
Only two values can be substituted into files using ERB -- the project name and
the derived class name.
<%= name %>
<%= classname %>
The project +name+ is passed in from the command line and used "as is" (with
the exception that spaces are converted to underscores). The +classname+ is
generated by camel casing the project name where the underscores occur.
get fuzzy => GetFuzzy
foo_bar => FooBar
Finally, file names can be modified by substituting in the project name. If a
file name contains the string "NAME" it is replaced with the project name. If
our project is call "get fuzzy" then the following transformations will take
place.
NAME.rb => get_fuzzy.rb
test_NAME.rb => test_get_fuzzy.rb
NAME_spec.rb => get_fuzzy_spec.rb
== ACKNOWLEDGEMENTS:
Ryan Davis and Eric Hodel and their Hoe gem (from which much of the Mr Bones
rake tasks have been stolen). The rails team and their source annotation
extractor. Bruce Williams for help in coming up with the project name. Ara T.
Howard for letting me squat in the codeforpeople rubyforge project.
== LICENSE:
MIT License
Copyright (c) 2007 - 2008
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub-license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
== VERSION 2.0.0 CHANGES:
Version 2.0.0 of Mr Bones introduces backwards incompatibilities. Here is
what you need to update in order for your current projects to work with
this latest release.
Perform an update the tasks in your project directory:
bones -u your/project/directory
The following .rake files have been renamed in Mr Bones 2.0.0 (the old
name is on the left and the new name is on the right). You will need to
delete the old version and use only the new version.
doc.rake => rdoc.rake
annotations.rake => notes.rake
The PROJ openstruct has been amended to contain a collection of nested
openstructs. This will affect any settings you might have in the
top-level Rakefile for your project. Here is the translation key (old
names on the left and new names on the right).
rubyforge_name => rubyforge.name
specs => spec.files
spec_opts => spec.opts
tests => test.files
test_file => test.file
test_opts => test.opts
rcov_dir => rcov.dir
rcov_opts => rcov.opts
rcov_threshold => rcov.threshold
rcov_threshold_exact => rcov.threshold_exact
rdoc_opts => rdoc.opts
rdoc_include => rdoc.include
rdoc_exclude => rdoc.exclude
rdoc_main => rdoc.main
rdoc_dir => rdoc.dir
rdoc_remote_dir => rdoc.remote_dir
dependencies => gem.dependencies
executables => gem.executables
extensions => gem.extensions
files => gem.files
need_tar => gem.need_tar
need_zip => gem.need_zip
post_install_message => gem.extras['post_install_message']
annotation_exclude => notes.exclude
annotation_extensions => notes.extensions
annotation_tags => notes.tags
svn => svn.path
svn_root => svn.root
svn_trunk => svn.trunk
svn_tags => svn.tags
svn_branches => svn.branches
ann_file => ann.file
ann_text => ann.text
ann_paragraphs => ann.paragraphs
ann_email => ann.email
And of course, each name should be prepended with PROJ in your Rakefile.